diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2019-02-14 14:02:03 +0100 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2019-02-14 14:13:32 +0100 |
commit | 5c10a464453adb7c23fe29a98c71dde198007642 (patch) | |
tree | 6cba6a041b6d834afdd1782e92213c12b6d57053 /apps/user_ldap/lib/User/Manager.php | |
parent | e65f7f05de6443bd66b1c31325cbc3cbe149d1e5 (diff) | |
download | nextcloud-server-5c10a464453adb7c23fe29a98c71dde198007642.tar.gz nextcloud-server-5c10a464453adb7c23fe29a98c71dde198007642.zip |
ensure attribute names are lower cased
otherwise they will be skipped when the results is being formatted and the
lower-cased result keys do not match.
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap/lib/User/Manager.php')
-rw-r--r-- | apps/user_ldap/lib/User/Manager.php | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/apps/user_ldap/lib/User/Manager.php b/apps/user_ldap/lib/User/Manager.php index 13555f9e31b..6185c0da45c 100644 --- a/apps/user_ldap/lib/User/Manager.php +++ b/apps/user_ldap/lib/User/Manager.php @@ -169,19 +169,14 @@ class Manager { * @return string[] */ public function getAttributes($minimal = false) { - $attributes = array_merge(Access::UUID_ATTRIBUTES, ['dn', 'uid', 'samaccountname', 'memberof']); - $possible = array( + $baseAttributes = array_merge(Access::UUID_ATTRIBUTES, ['dn', 'uid', 'samaccountname', 'memberof']); + $attributes = [ $this->access->getConnection()->ldapExpertUUIDUserAttr, $this->access->getConnection()->ldapQuotaAttribute, $this->access->getConnection()->ldapEmailAttribute, $this->access->getConnection()->ldapUserDisplayName, $this->access->getConnection()->ldapUserDisplayName2, - ); - foreach($possible as $attr) { - if(!is_null($attr)) { - $attributes[] = $attr; - } - } + ]; $homeRule = $this->access->getConnection()->homeFolderNamingRule; if(strpos($homeRule, 'attr:') === 0) { @@ -197,11 +192,16 @@ class Manager { ); } - // remove possible empty attributes - $attributes = array_values( - array_filter($attributes, function ($attributeName) { - return !empty($attributeName); - }) + $attributes = array_reduce($attributes, + function($list, $attribute) { + $attribute = strtolower(trim((string)$attribute)); + if(!empty($attribute) && !in_array($attribute, $list)) { + $list[] = $attribute; + } + + return $list; + }, + $baseAttributes // hard-coded, lower-case, non-empty attributes ); return $attributes; |