From b23a4a29092ec73b90f7776665af1202c46d11e4 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Sat, 24 Apr 2010 18:43:34 -0400 Subject: [PATCH] add the start of a administrative-level device management screen Not fully functionaly yet, but will provide the means for an admin to request a remote wipe or reset the device state for any device we know about. Also provides a means to just get an idea of how many devices are syncing with your server. --- horde/admin/activesync.php | 67 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 horde/admin/activesync.php diff --git a/horde/admin/activesync.php b/horde/admin/activesync.php new file mode 100644 index 000000000..e57cf6d8e --- /dev/null +++ b/horde/admin/activesync.php @@ -0,0 +1,67 @@ + + */ + +require_once dirname(__FILE__) . '/../lib/Application.php'; +Horde_Registry::appInit('horde', array('admin' => true)); + +if (!empty($GLOBALS['conf']['activesync']['enabled'])) { + $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); +} else { + throw new Horde_Exception_PermissionDenied(_("ActiveSync not activated.")); +} + +$devices = $stateMachine->listDevices(); + +$title = _("ActiveSync Device Administration"); +require HORDE_TEMPLATES . '/common-header.inc'; +require HORDE_TEMPLATES . '/admin/menu.inc'; + +$spacer = '    '; +$icondir = array('icondir' => Horde_Themes::img()); +$base_node_params = $icondir + array('icon' => 'administration.png'); +$device_node = $icondir + array('icon' => 'mobile.png'); +$user_node = $icondir + array('icon' => 'user.png'); + +$users = array(); +$tree = Horde_Tree::factory('admin_devices', 'Javascript'); +$tree->setOption(array('alternate' => true)); +$tree->setHeader(array(array('width' => '40%'), + array('width' => '10%', 'html' => 'last sync'), + array('html' => $spacer), + array('width' => '10%', 'html' => 'policy key'), + array('html' => $spacer), + array('width' => '10%', 'html' => 'remotewipe status'), + array('html' => $spacer), + array('width' => '15%' , 'html' => 'device id'),)); +$tree->addNode('root', null, _("Registered User Devices"), 0, true, $base_node_params); +foreach ($devices as $device) { + $node_params = array(); + if (array_search($device['device_user'], $users) === false) { + $users[] = $device['device_user']; + $tree->addNode($device['device_user'], 'root', $device['device_user'], 0, true, $user_node); + } + $ts = new Horde_Date($stateMachine->getLastSyncTimestamp($device['device_id'])); + $tree->addNode($device['device_id'], + $device['device_user'], + $device['device_type']. ' | ' . $device['device_agent'], + 0, + true, + $device_node + $node_params, + array($ts->format('r'), $spacer, $device['device_policykey'], $spacer, $device['device_rwstatus'], $spacer, $device['device_id'])); +} + +echo '

' . Horde::img('group.png') . ' ' . _("ActiveSync Devices") . '

'; +$tree->renderTree(); + +require HORDE_TEMPLATES . '/common-footer.inc'; -- 2.11.0