summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2015-10-07 18:57:49 +0200
committerArthur Schiwon <blizzz@owncloud.com>2015-10-07 18:57:49 +0200
commit4a5cecd6fa64b33a63c39d289565837e6d8ac340 (patch)
tree96b39bd553845163f7c79d887bcbfaad0dcd864c /apps
parentcd818e7419fb39d97683ecc5803534b0ed632596 (diff)
downloadnextcloud-server-4a5cecd6fa64b33a63c39d289565837e6d8ac340.tar.gz
nextcloud-server-4a5cecd6fa64b33a63c39d289565837e6d8ac340.zip
allow an attribute to return more than one value
Diffstat (limited to 'apps')
-rw-r--r--apps/user_ldap/lib/access.php41
-rw-r--r--apps/user_ldap/lib/wizard.php2
2 files changed, 14 insertions, 29 deletions
diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php
index a2fdd88a240..c7ec06f356a 100644
--- a/apps/user_ldap/lib/access.php
+++ b/apps/user_ldap/lib/access.php
@@ -710,6 +710,9 @@ class Access extends LDAPUtility implements user\IUserTools {
if($manyAttributes) {
return $list;
} else {
+ $list = array_reduce($list, function($carry, $item) {
+ $carry[] = $item[0];
+ }, array());
return array_unique($list, SORT_LOCALE_STRING);
}
}
@@ -982,44 +985,26 @@ class Access extends LDAPUtility implements user\IUserTools {
if(!is_null($attr)) {
$selection = array();
- $multiArray = false;
- if(count($attr) > 1) {
- $multiArray = true;
- $i = 0;
- }
+ $i = 0;
foreach($findings as $item) {
if(!is_array($item)) {
continue;
}
$item = \OCP\Util::mb_array_change_key_case($item, MB_CASE_LOWER, 'UTF-8');
-
- if($multiArray) {
- foreach($attr as $key) {
- $key = mb_strtolower($key, 'UTF-8');
- if(isset($item[$key])) {
- if($key !== 'dn') {
- $selection[$i][$key] = $this->resemblesDN($key) ?
- $this->sanitizeDN($item[$key][0])
- : $item[$key][0];
- } else {
- $selection[$i][$key] = $this->sanitizeDN($item[$key]);
- }
- }
-
- }
- $i++;
- } else {
- //tribute to case insensitivity
- $key = mb_strtolower($attr[0], 'UTF-8');
-
+ foreach($attr as $key) {
+ $key = mb_strtolower($key, 'UTF-8');
if(isset($item[$key])) {
- if($this->resemblesDN($key)) {
- $selection[] = $this->sanitizeDN($item[$key]);
+ if($key !== 'dn') {
+ $selection[$i][$key] = $this->resemblesDN($key) ?
+ $this->sanitizeDN($item[$key])
+ : $item[$key];
} else {
- $selection[] = $item[$key];
+ $selection[$i][$key] = $this->sanitizeDN($item[$key]);
}
}
+
}
+ $i++;
}
$findings = $selection;
}
diff --git a/apps/user_ldap/lib/wizard.php b/apps/user_ldap/lib/wizard.php
index 18a0412a63d..a8fcae6314f 100644
--- a/apps/user_ldap/lib/wizard.php
+++ b/apps/user_ldap/lib/wizard.php
@@ -435,7 +435,7 @@ class Wizard extends LDAPUtility {
// detection will fail later
$result = $this->access->searchGroups($filter, array('cn', 'dn'), $limit, $offset);
foreach($result as $item) {
- $groupNames[] = $item['cn'];
+ $groupNames[] = $item['cn'][0];
$groupEntries[] = $item;
}
$offset += $limit;