mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-27 02:14:45 +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() {
|
function getClientDeviceInfo() {
|
||||||
#Horde::logMessage("SyncML: getClientDeviceInfo " . $this->_locName
|
#Horde::logMessage("SyncML: getClientDeviceInfo " . $this->_locName
|
||||||
# . ", " . $this->_sourceURI, __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
# . ", " . $this->_sourceURI, __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
|
|
||||||
$syncml_prefs = $GLOBALS['egw_info']['user']['preferences']['syncml'];
|
$syncml_prefs = $GLOBALS['egw_info']['user']['preferences']['syncml'];
|
||||||
$deviceMaxEntries = 'maxEntries-' . $this->_sourceURI;
|
$deviceMaxEntries = 'maxEntries-' . $this->_clientDeviceInfo['devId'];
|
||||||
$deviceUIDExtension = 'uidExtension-' . $this->_sourceURI;
|
$deviceUIDExtension = 'uidExtension-' . $this->_clientDeviceInfo['devId'];
|
||||||
$deviceNonBlockingAllday = 'nonBlockingAllday-' . $this->_sourceURI;
|
$deviceNonBlockingAllday = 'nonBlockingAllday-' . $this->_clientDeviceInfo['devId'];
|
||||||
$deviceTimezone = 'tzid-' . $this->_sourceURI;
|
$deviceTimezone = 'tzid-' . $this->_clientDeviceInfo['devId'];
|
||||||
$deviceCharSet = 'charset-' . $this->_sourceURI;
|
$deviceCharSet = 'charset-' . $this->_clientDeviceInfo['devId'];
|
||||||
if (isset($this->_clientDeviceInfo)
|
if (isset($this->_clientDeviceInfo)
|
||||||
&& is_array($this->_clientDeviceInfo)) {
|
&& is_array($this->_clientDeviceInfo)) {
|
||||||
// update user preferences
|
// update user preferences
|
||||||
@ -169,13 +170,15 @@ class EGW_SyncML_State extends Horde_SyncML_State
|
|||||||
// use cached information
|
// use cached information
|
||||||
return $this->_clientDeviceInfo;
|
return $this->_clientDeviceInfo;
|
||||||
}
|
}
|
||||||
|
if (!($deviceID = $GLOBALS['egw']->db->select('egw_syncmldeviceowner',
|
||||||
if (($deviceID = $GLOBALS['egw']->db->select('egw_syncmldeviceowner',
|
|
||||||
'owner_devid',
|
'owner_devid',
|
||||||
array (
|
array (
|
||||||
'owner_locname' => $this->_locName,
|
'owner_locname' => $this->_locName,
|
||||||
'owner_deviceid' => $this->_sourceURI,
|
'owner_deviceid' => $this->_sourceURI,
|
||||||
), __LINE__, __FILE__, false, '', 'syncml')->fetchColumn())) {
|
), __LINE__, __FILE__, false, '', 'syncml')->fetchColumn())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$cols = array(
|
$cols = array(
|
||||||
'dev_dtdversion',
|
'dev_dtdversion',
|
||||||
'dev_numberofchanges',
|
'dev_numberofchanges',
|
||||||
@ -197,6 +200,8 @@ class EGW_SyncML_State extends Horde_SyncML_State
|
|||||||
'dev_id' => $deviceID,
|
'dev_id' => $deviceID,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (($row = $GLOBALS['egw']->db->select('egw_syncmldevinfo',
|
if (($row = $GLOBALS['egw']->db->select('egw_syncmldevinfo',
|
||||||
$cols, $where, __LINE__, __FILE__, false, '', 'syncml')->fetch())) {
|
$cols, $where, __LINE__, __FILE__, false, '', 'syncml')->fetch())) {
|
||||||
$this->_clientDeviceInfo = array (
|
$this->_clientDeviceInfo = array (
|
||||||
@ -217,11 +222,11 @@ class EGW_SyncML_State extends Horde_SyncML_State
|
|||||||
'nonBlockingAllday' => $syncml_prefs[$deviceNonBlockingAllday],
|
'nonBlockingAllday' => $syncml_prefs[$deviceNonBlockingAllday],
|
||||||
'tzid' => $syncml_prefs[$deviceTimezone],
|
'tzid' => $syncml_prefs[$deviceTimezone],
|
||||||
'charset' => $syncml_prefs[$deviceCharSet],
|
'charset' => $syncml_prefs[$deviceCharSet],
|
||||||
|
'devId' => $deviceID,
|
||||||
'dataStore' => unserialize($row['dev_datastore']),
|
'dataStore' => unserialize($row['dev_datastore']),
|
||||||
);
|
);
|
||||||
return $this->_clientDeviceInfo;
|
return $this->_clientDeviceInfo;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,16 +370,44 @@ class EGW_SyncML_State extends Horde_SyncML_State
|
|||||||
session_id($sessionID);
|
session_id($sessionID);
|
||||||
$GLOBALS['sessionid'] = $sessionID;
|
$GLOBALS['sessionid'] = $sessionID;
|
||||||
@session_start();
|
@session_start();
|
||||||
|
|
||||||
Horde::logMessage('SyncML_EGW[' . $GLOBALS['sessionid']
|
Horde::logMessage('SyncML_EGW[' . $GLOBALS['sessionid']
|
||||||
.']: Authentication of ' . $this->_locName . ' succeded',
|
.']: Authentication of ' . $this->_locName . ' succeded',
|
||||||
__FILE__, __LINE__, PEAR_LOG_DEBUG);
|
__FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||||
|
$syncml_prefs = $GLOBALS['egw_info']['user']['preferences']['syncml'];
|
||||||
$config =& CreateObject('phpgwapi.config','syncml');
|
if (($deviceID = $GLOBALS['egw']->db->select('egw_syncmldeviceowner',
|
||||||
$config->read_repository();
|
'owner_devid',
|
||||||
$GLOBALS['config_syncml'] =& $config->config_data;
|
array (
|
||||||
unset($config);
|
'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
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user