abstract public function setPolicyKey($devId, $key);
/**
+ * Reset ALL device policy keys. Used when server policies have changed
+ * and you want to force ALL devices to pick up the changes. This will
+ * cause all devices that support provisioning to be reprovisioned.
+ *
+ * @throws Horde_ActiveSync_Exception
+ *
+ */
+ abstract public function resetAllPolicyKeys();
+
+ /**
* Set a new remotewipe status for the device
*
* @param string $devid
}
/**
+ * Reset ALL device policy keys. Used when server policies have changed
+ * and you want to force ALL devices to pick up the changes. This will
+ * cause all devices that support provisioning to be reprovisioned.
+ *
+ * @throws Horde_ActiveSync_Exception
+ *
+ */
+ public function resetAllPolicyKeys()
+ {
+ throw new Horde_ActiveSync_Exception('Not Implemented');
+ }
+
+ /**
* Set a new remotewipe status for the device
*
* @param string $devId
}
/**
+ * Reset ALL device policy keys. Used when server policies have changed
+ * and you want to force ALL devices to pick up the changes. This will
+ * cause all devices that support provisioning to be reprovisioned.
+ *
+ * @throws Horde_ActiveSync_Exception
+ *
+ */
+ public function resetAllPolicyKeys()
+ {
+ $query = 'UPDATE ' . $this->_syncDeviceTable . ' SET device_policykey = 0';
+ try {
+ $this->_db->update($query);
+ } catch (Horde_Db_Exception $e) {
+ throw new Horde_ActiveSync_Exception($e);
+ }
+ }
+
+ /**
* Set a new remotewipe status for the device
*
* @param string $devid
switch ($actionID) {
case 'wipe':
$stateMachine->setDeviceRWStatus($deviceID, Horde_ActiveSync::RWSTATUS_PENDING);
+ $GLOBALS['notification']->push(_("A device wipe has been requested. Device will be wiped on next syncronization attempt."), 'horde.success');
break;
case 'cancelwipe':
$stateMachine->setDeviceRWStatus($deviceID, Horde_ActiveSync::RWSTATUS_OK);
+ $GLOBALS['notification']->push(_("Device wipe successfully canceled."), 'horde.success');
break;
case 'delete':
$stateMachine->removeState(null, $deviceID, Horde_Util::getPost('uid'));
+ $GLOBALS['notification']->push(_("Device successfully removed."), 'horde.success');
+ break;
+
+ case 'reset':
+ $stateMachine->resetAllPolicyKeys();
+ $GLOBALS['notification']->push(_("All policy keys successfully reset."), 'horde.success');
break;
}
- header('Location: ' . Horde::selfUrl());
+ Horde::selfUrl()->redirect();
}
Horde::addScriptFile('activesyncadmin.js');
array('html' => $spacer),
array('width' => '10%', 'html' => _("Actions"))
));
-$tree->addNode('root', null, _("Registered User Devices"), 0, true, $base_node_params);
+
+/* Root tree node, and reprovision button */
+$tree->addNode('root',
+ null,
+ _("Registered User Devices"),
+ 0,
+ true,
+ $base_node_params,
+ array('--', $spacer, '--', $spacer, '--', $spacer, '--', $spacer, '<input class="button" type="button" value="' . _("Reprovision All Devices") . '" id="reset" />' ));
/* To hold the inline javascript */
$js = array();
$i = 0;
+/* Observe the reprovision button */
+$js[] = '$("reset").observe("click", function() {HordeActiveSyncAdmin.reprovision();});';
+
/* Build the device entry */
foreach ($devices as $device) {
$node_params = array();
document.forms.activesyncadmin.uid.value = user;
document.forms.activesyncadmin.actionID.value = 'delete';
document.forms.activesyncadmin.submit();
+ },
+
+ reprovision: function() {
+ document.forms.activesyncadmin.actionID.value = 'reset';
+ document.forms.activesyncadmin.submit();
}
+
}
\ No newline at end of file