From: Michael J. Rubinsky Date: Thu, 29 Apr 2010 20:59:21 +0000 (-0400) Subject: Implement user-initiated remote wiping for provisioned devices. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=23d659d1c10c6acf18d640045f6558ab068fabbc;p=horde.git Implement user-initiated remote wiping for provisioned devices. Also allow the clearing of all device state. --- diff --git a/horde/lib/Prefs/Ui.php b/horde/lib/Prefs/Ui.php index 34bf60e8a..c02a5a498 100644 --- a/horde/lib/Prefs/Ui.php +++ b/horde/lib/Prefs/Ui.php @@ -404,25 +404,25 @@ class Horde_Prefs_Ui $t = $GLOBALS['injector']->createInstance('Horde_Template'); $t->setOption('gettext', true); + $t->set('reset', $ui->selfUrl()->add('reset', 1)); $devices = $stateMachine->listDevices(Horde_Auth::getAuth()); $devs = array(); - $reseturl = $ui->selfUrl()->add('reset', 1); $i = 1; foreach ($devices as $device) { $device['class'] = fmod($i++, 2) ? 'rowOdd' : 'rowEven'; - $device['reset'] = $reseturl; - $device['ts'] = strftime($GLOBALS['prefs']->getValue('date_format') . ' %H:%M', $stateMachine->getLastSyncTimestamp($device['device_id'])); + $ts = $stateMachine->getLastSyncTimestamp($device['device_id']); + $device['ts'] = empty($ts) ? _("None") : strftime($GLOBALS['prefs']->getValue('date_format') . ' %H:%M', $ts); switch ($device['device_rwstatus']) { case Horde_ActiveSync::RWSTATUS_PENDING: - $status = 'Wipe is pending'; + $status = '' . _("Wipe is pending") . ''; break; case Horde_ActiveSync::RWSTATUS_WIPED: - $status = 'Device is wiped'; + $status = '' . _("Device is wiped") . ''; break; default: - $status = 'Device is partnered'; + $status = $device['device_policykey'] ?_("Provisioned") : _("Not Provisioned"); } - $device['status'] = $status . '
Device id: ' . $device['device_id'] . '
User Agent: ' . $device['device_agent']; + $device['status'] = $status . '
' . _("Device id:") . $device['device_id'] . '
' . _("Policy Key:") . $device['device_policykey'] . '
' . _("User Agent:") . $device['device_agent']; $devs[] = $device; } @@ -569,12 +569,16 @@ class Horde_Prefs_Ui $state_params = $GLOBALS['conf']['activesync']['state']['params']; $state_params['db'] = $GLOBALS['injector']->getInstance('Horde_Db_Adapter_Base'); $stateMachine = new Horde_ActiveSync_State_History($state_params); + $stateMachine->setLogger($GLOBALS['injector']->getInstance('Horde_Log_Logger')); if ($ui->vars->wipe) { $stateMachine->setDeviceRWStatus($ui->vars->wipe, Horde_ActiveSync::RWSTATUS_PENDING); - $GLOBALS['notification']->push(sprintf(_("A Remote Wipe for device id %s has been initiated. The device will be wiped durint the next SYNC request."), $ui->vars->wipe)); + $GLOBALS['notification']->push(sprintf(_("A Remote Wipe for device id %s has been initiated. The device will be wiped during the next SYNC request."), $ui->vars->wipe)); } elseif ($ui->vars->reset) { - // @TODO - //$stateMachine->removeState(); + $devices = $stateMachine->listDevices(Horde_Auth::getAuth()); + foreach ($devices as $device) { + $stateMachine->removeState(null, $device['device_id']); + } + $GLOBALS['notification']->push(_("All state removed for your devices. They will resynchronize next time they connect to the server.")); } } } diff --git a/horde/templates/prefs/activesync.html b/horde/templates/prefs/activesync.html index d4e5d6ad0..a492faee0 100644 --- a/horde/templates/prefs/activesync.html +++ b/horde/templates/prefs/activesync.html @@ -1,7 +1,10 @@
+ State Management +
+

Reset all device state. This will cause your devices to resyncronize all items. +

Device Management
- @@ -25,8 +28,3 @@

NOTE: WIPING A DEVICE MAY RESET IT TO FACTORY DEFAULTS. PLEASE MAKE SURE YOU REALLY WANT TO DO THIS BEFORE REQUESTING A WIPE

- -
- State Management -
-

Reset all device state. This will cause your devices to resyncronize all items.Reset \ No newline at end of file