KMP-4: - Retrieve the zpush version from the About() service request and show it in the settings

This commit is contained in:
Ronald Toussaint
2016-12-07 11:48:14 +01:00
parent 7385ef179e
commit d610e9e181
3 changed files with 64 additions and 11 deletions

View File

@ -30,13 +30,35 @@ class PluginMDMModule extends Module
$this->url = $this->server .'/Microsoft-Server-ActiveSync?Cmd=WebserviceDevice&DeviceId=webservice&DeviceType=webservice&User=' . $this->username;
}
/**
* Returns the version of the Z-Push server
* @return String
*/
function getServerVersion()
{
// Make a call to the service, so we can read the version
// from the response headers
try {
$url = $this->server .'/Microsoft-Server-ActiveSync?Cmd=WebserviceInfo&DeviceId=webservice&DeviceType=webservice&User=' . $this->username;
$client = $this->getSoapClient($url);
return $client->About();
} catch(Exception $e){}
// If we can't find a version, we will simply return not available
return dgettext('plugin_mdm', 'n/a');
}
/**
* Helper to setup a client.
*/
function getSoapClient()
function getSoapClient($url='')
{
if ( empty($url) ){
$url = $this->url;
}
return new SoapClient(null, array(
'location' => $this->url,
'location' => $url,
'uri' => $this->server,
'trace' => 1,
'login' => $this->username,
@ -76,7 +98,7 @@ class PluginMDMModule extends Module
* @return array $response array contains a list of devices connected to the users account
*/
function getDevices()
{
{
$client = $this->getSoapClient();
return $client->ListDevicesDetails();
}
@ -92,7 +114,7 @@ class PluginMDMModule extends Module
$client = $this->getSoapClient();
return $client->RemoveDevice($deviceid);
}
/**
* Executes all the actions in the $data variable.
* @return boolean true on success of false on fialure.
@ -108,21 +130,21 @@ class PluginMDMModule extends Module
case 'wipe':
$this->wipeDevice($actionData['deviceid'], $actionData['password']);
$this->addActionData('wipe', array(
'type' => 3,
'type' => 3,
'wipe' => $this->wipeDevice($actionData['deviceid'], $actionData['password'])
));
$GLOBALS['bus']->addData($this->getResponseData());
break;
case 'resync':
$this->addActionData('resync', array(
'type' => 3,
'type' => 3,
'resync' => $this->resyncDevice($actionData['deviceid'])
));
$GLOBALS['bus']->addData($this->getResponseData());
break;
case 'remove':
$this->addActionData('remove', array(
'type' => 3,
'type' => 3,
'remove' => $this->removeDevice($actionData['deviceid'])
));
$GLOBALS['bus']->addData($this->getResponseData());