diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2012-08-23 18:29:43 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2012-08-23 18:29:43 +0200 |
commit | d5c111a984278a097025d267f3461c01983ca0c2 (patch) | |
tree | 95d9f8f5cbdb92b4cf731bb60d114da18f592408 /apps/user_ldap/lib/connection.php | |
parent | c90c358f0d315c8cf755ec670b7d7738ab15148a (diff) | |
download | nextcloud-server-d5c111a984278a097025d267f3461c01983ca0c2.tar.gz nextcloud-server-d5c111a984278a097025d267f3461c01983ca0c2.zip |
LDAP: identify (map) users with their directory UUID. Fixes the issue, that usernames for owncloud will change, when the DN changes (which happens rarely, but it happens).
Diffstat (limited to 'apps/user_ldap/lib/connection.php')
-rw-r--r-- | apps/user_ldap/lib/connection.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/apps/user_ldap/lib/connection.php b/apps/user_ldap/lib/connection.php index 9bb012e910e..dc160a1642d 100644 --- a/apps/user_ldap/lib/connection.php +++ b/apps/user_ldap/lib/connection.php @@ -53,6 +53,8 @@ class Connection { 'ldapQuotaDefault' => null, 'ldapEmailAttribute' => null, 'ldapCacheTTL' => null, + 'ldapUuidAttribute' => null, + 'ldapOverrideUuidAttribute' => null, ); public function __construct($configID = 'user_ldap') { @@ -74,6 +76,22 @@ class Connection { } } + public function __set($name, $value) { + $changed = false; + //omly few options are writable + if($name == 'ldapUuidAttribute') { + \OCP\Util::writeLog('user_ldap', 'Set config ldapUuidAttribute to '.$value, \OCP\Util::DEBUG); + $this->config[$name] = $value; + if(!empty($this->configID)) { + \OCP\Config::getAppValue($this->configID, 'ldap_uuid_attribute', $value); + } + $changed = true; + } + if($changed) { + $this->validateConfiguration(); + } + } + /** * @brief initializes the LDAP backend * @param $force read the config settings no matter what @@ -180,6 +198,8 @@ class Connection { $this->config['ldapGroupMemberAssocAttr'] = \OCP\Config::getAppValue($this->configID, 'ldap_group_member_assoc_attribute', 'uniqueMember'); $this->config['ldapIgnoreNamingRules'] = \OCP\Config::getSystemValue('ldapIgnoreNamingRules', false); $this->config['ldapCacheTTL'] = \OCP\Config::getAppValue($this->configID, 'ldap_cache_ttl', 10*60); + $this->config['ldapUuidAttribute'] = \OCP\Config::getAppValue($this->configID, 'ldap_uuid_attribute', 'auto'); + $this->config['ldapOverrideUuidAttribute'] = \OCP\Config::getAppValue($this->configID, 'ldap_override_uuid_attribute', 0); $this->configured = $this->validateConfiguration(); } @@ -236,6 +256,11 @@ class Connection { if(empty($this->config['ldapGroupFilter']) && empty($this->config['ldapGroupMemberAssocAttr'])) { \OCP\Util::writeLog('user_ldap', 'No group filter is specified, LDAP group feature will not be used.', \OCP\Util::INFO); } + if(!in_array($this->config['ldapUuidAttribute'], array('auto','entryuuid', 'nsuniqueid', 'objectguid'))) { + \OCP\Config::setAppValue($this->configID, 'ldap_uuid_attribute', 'auto'); + \OCP\Util::writeLog('user_ldap', 'Illegal value for the UUID Attribute, reset to autodetect.', \OCP\Util::INFO); + } + //second step: critical checks. If left empty or filled wrong, set as unconfigured and give a warning. $configurationOK = true; |