[Pkg-owncloud-commits] [owncloud] 05/27: allow an attribute to return more than one value
David Prévot
taffit at moszumanska.debian.org
Wed Oct 28 17:03:04 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag v8.1.4RC2
in repository owncloud.
commit 6ccc5a6cd34deea57f0ae7a64c10a16e7ca5c30f
Author: Arthur Schiwon <blizzz at owncloud.com>
Date: Wed Oct 7 18:57:49 2015 +0200
allow an attribute to return more than one value
---
apps/user_ldap/lib/access.php | 41 +++++++++++++----------------------------
apps/user_ldap/lib/wizard.php | 2 +-
2 files changed, 14 insertions(+), 29 deletions(-)
diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php
index c1c6a8f..0005bad 100644
--- a/apps/user_ldap/lib/access.php
+++ b/apps/user_ldap/lib/access.php
@@ -720,6 +720,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);
}
}
@@ -992,44 +995,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 6ca84c8..2b0b888 100644
--- a/apps/user_ldap/lib/wizard.php
+++ b/apps/user_ldap/lib/wizard.php
@@ -434,7 +434,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;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list