diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2013-05-08 14:56:52 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2013-05-08 14:56:52 +0200 |
commit | 3f1717d3d54fd82090abe6518da56c88678e24a2 (patch) | |
tree | 5d28a9fb45c111e21ade82987ebb69abf5f67dfc /apps/user_ldap | |
parent | c9b3da5bbce52f10f060fcb131697bf41e4ab037 (diff) | |
download | nextcloud-server-3f1717d3d54fd82090abe6518da56c88678e24a2.tar.gz nextcloud-server-3f1717d3d54fd82090abe6518da56c88678e24a2.zip |
LDAP: implement UUID and internal username override
Diffstat (limited to 'apps/user_ldap')
-rw-r--r-- | apps/user_ldap/lib/access.php | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php index 234e91f792f..8c372766c00 100644 --- a/apps/user_ldap/lib/access.php +++ b/apps/user_ldap/lib/access.php @@ -317,7 +317,19 @@ abstract class Access { } $ldapname = $ldapname[0]; } - $intname = $isUser ? $this->sanitizeUsername($uuid) : $ldapname; + + if($isUser) { + $usernameAttribute = $this->connection->ldapExpertUsernameAttr; + if(!emptY($usernameAttribute)) { + $username = $this->readAttribute($dn, $usernameAttribute); + $username = $username[0]; + } else { + $username = $uuid; + } + $intname = $this->sanitizeUsername($username); + } else { + $intname = $ldapname; + } //a new user/group! Add it only if it doesn't conflict with other backend's users or existing groups //disabling Cache is required to avoid that the new user is cached as not-existing in fooExists check @@ -897,6 +909,12 @@ abstract class Access { return true; } + $fixedAttribute = $this->connection->ldapExpertUUIDAttr; + if(!empty($fixedAttribute)) { + $this->connection->ldapUuidAttribute = $fixedAttribute; + return true; + } + //for now, supported (known) attributes are entryUUID, nsuniqueid, objectGUID $testAttributes = array('entryuuid', 'nsuniqueid', 'objectguid', 'guid'); |