mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 08:23:12 +01:00
Give Administrator more control over SyncML clients
This commit is contained in:
parent
68a2a3d641
commit
41c4ae0536
@ -152,12 +152,13 @@ class EGW_SyncML_State extends Horde_SyncML_State
|
||||
function getClientDeviceInfo() {
|
||||
#Horde::logMessage("SyncML: getClientDeviceInfo " . $this->_locName
|
||||
# . ", " . $this->_sourceURI, __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||
|
||||
$syncml_prefs = $GLOBALS['egw_info']['user']['preferences']['syncml'];
|
||||
$deviceMaxEntries = 'maxEntries-' . $this->_sourceURI;
|
||||
$deviceUIDExtension = 'uidExtension-' . $this->_sourceURI;
|
||||
$deviceNonBlockingAllday = 'nonBlockingAllday-' . $this->_sourceURI;
|
||||
$deviceTimezone = 'tzid-' . $this->_sourceURI;
|
||||
$deviceCharSet = 'charset-' . $this->_sourceURI;
|
||||
$deviceMaxEntries = 'maxEntries-' . $this->_clientDeviceInfo['devId'];
|
||||
$deviceUIDExtension = 'uidExtension-' . $this->_clientDeviceInfo['devId'];
|
||||
$deviceNonBlockingAllday = 'nonBlockingAllday-' . $this->_clientDeviceInfo['devId'];
|
||||
$deviceTimezone = 'tzid-' . $this->_clientDeviceInfo['devId'];
|
||||
$deviceCharSet = 'charset-' . $this->_clientDeviceInfo['devId'];
|
||||
if (isset($this->_clientDeviceInfo)
|
||||
&& is_array($this->_clientDeviceInfo)) {
|
||||
// update user preferences
|
||||
@ -169,13 +170,15 @@ class EGW_SyncML_State extends Horde_SyncML_State
|
||||
// use cached information
|
||||
return $this->_clientDeviceInfo;
|
||||
}
|
||||
|
||||
if (($deviceID = $GLOBALS['egw']->db->select('egw_syncmldeviceowner',
|
||||
if (!($deviceID = $GLOBALS['egw']->db->select('egw_syncmldeviceowner',
|
||||
'owner_devid',
|
||||
array (
|
||||
'owner_locname' => $this->_locName,
|
||||
'owner_deviceid' => $this->_sourceURI,
|
||||
), __LINE__, __FILE__, false, '', 'syncml')->fetchColumn())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$cols = array(
|
||||
'dev_dtdversion',
|
||||
'dev_numberofchanges',
|
||||
@ -197,6 +200,8 @@ class EGW_SyncML_State extends Horde_SyncML_State
|
||||
'dev_id' => $deviceID,
|
||||
);
|
||||
|
||||
|
||||
|
||||
if (($row = $GLOBALS['egw']->db->select('egw_syncmldevinfo',
|
||||
$cols, $where, __LINE__, __FILE__, false, '', 'syncml')->fetch())) {
|
||||
$this->_clientDeviceInfo = array (
|
||||
@ -217,11 +222,11 @@ class EGW_SyncML_State extends Horde_SyncML_State
|
||||
'nonBlockingAllday' => $syncml_prefs[$deviceNonBlockingAllday],
|
||||
'tzid' => $syncml_prefs[$deviceTimezone],
|
||||
'charset' => $syncml_prefs[$deviceCharSet],
|
||||
'devId' => $deviceID,
|
||||
'dataStore' => unserialize($row['dev_datastore']),
|
||||
);
|
||||
return $this->_clientDeviceInfo;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -365,16 +370,44 @@ class EGW_SyncML_State extends Horde_SyncML_State
|
||||
session_id($sessionID);
|
||||
$GLOBALS['sessionid'] = $sessionID;
|
||||
@session_start();
|
||||
|
||||
Horde::logMessage('SyncML_EGW[' . $GLOBALS['sessionid']
|
||||
.']: Authentication of ' . $this->_locName . ' succeded',
|
||||
__FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||
|
||||
$config =& CreateObject('phpgwapi.config','syncml');
|
||||
$config->read_repository();
|
||||
$GLOBALS['config_syncml'] =& $config->config_data;
|
||||
unset($config);
|
||||
|
||||
$syncml_prefs = $GLOBALS['egw_info']['user']['preferences']['syncml'];
|
||||
if (($deviceID = $GLOBALS['egw']->db->select('egw_syncmldeviceowner',
|
||||
'owner_devid',
|
||||
array (
|
||||
'owner_locname' => $this->_locName,
|
||||
'owner_deviceid' => $this->_sourceURI,
|
||||
), __LINE__, __FILE__, false, '', 'syncml')->fetchColumn())) {
|
||||
$allowed_name = 'allowed-' . $deviceID;
|
||||
if (isset($syncml_prefs[$allowed_name]))
|
||||
{
|
||||
$deviceAllowed = $syncml_prefs[$allowed_name];
|
||||
}
|
||||
else
|
||||
{
|
||||
$deviceAllowed = -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$deviceAllowed = -1; // Unkown device
|
||||
}
|
||||
if (!$GLOBALS['egw_info']['user']['apps']['admin'] &&
|
||||
isset($syncml_prefs['deny_unknown_devices']) &&
|
||||
$syncml_prefs['deny_unknown_devices'] != 0)
|
||||
{
|
||||
if ($syncml_prefs['deny_unknown_devices'] == -1 &&
|
||||
$deviceAllowed != 1 ||
|
||||
$syncml_prefs['deny_unknown_devices'] == 1 &&
|
||||
$deviceAllowed == 0)
|
||||
{
|
||||
$this->_isAuthorized = -1;
|
||||
Horde::logMessage('SyncML: Device is not allowed for user ' . $this->_locName,
|
||||
__FILE__, __LINE__, PEAR_LOG_INFO);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user