Commit 2953d8fd authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-1298 Implemented SetDeviceOptions webservice call.


Currently only the FilterType can be set. If value is set to false it's
ignored - devicedata is not touched in this case.  Other options could
be added this way later.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 056071f0
...@@ -108,6 +108,29 @@ class WebserviceDevice { ...@@ -108,6 +108,29 @@ class WebserviceDevice {
return true; return true;
} }
/**
* Sets device options of the Request::GetGETUser().
*
* @param string $deviceId the device id
* @param int $filtertype SYNC_FILTERTYPE_1DAY to SYNC_FILTERTYPE_ALL, false to ignore
*
* @access public
* @return boolean
* @throws SoapFault
*/
public function SetDeviceOptions($deviceId, $filtertype) {
$deviceId = preg_replace("/[^A-Za-z0-9]/", "", $deviceId);
ZLog::Write(LOGLEVEL_INFO, sprintf("WebserviceDevice::SetDeviceOptions('%s', '%s'): set FilterType to '%s'", $deviceId, Request::GetGETUser(), Utils::PrintAsString($filtertype)));
if (! ZPushAdmin::SetDeviceOptions(Request::GetGETUser(), $deviceId, $filtertype)) {
ZPush::GetTopCollector()->AnnounceInformation(ZLog::GetLastMessage(LOGLEVEL_ERROR), true);
throw new SoapFault("ERROR", ZLog::GetLastMessage(LOGLEVEL_ERROR));
}
ZPush::GetTopCollector()->AnnounceInformation(sprintf("FilterType set to '%s' - device id '%s'", Utils::PrintAsString($filtertype), $deviceId), true);
return true;
}
/** /**
* Marks a device of the Request::GetGETUser() for resynchronization. * Marks a device of the Request::GetGETUser() for resynchronization.
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment