allow an attribute to return more than one value
This commit is contained in:
parent
cd818e7419
commit
4a5cecd6fa
|
@ -710,6 +710,9 @@ class Access extends LDAPUtility implements user\IUserTools {
|
||||||
if($manyAttributes) {
|
if($manyAttributes) {
|
||||||
return $list;
|
return $list;
|
||||||
} else {
|
} else {
|
||||||
|
$list = array_reduce($list, function($carry, $item) {
|
||||||
|
$carry[] = $item[0];
|
||||||
|
}, array());
|
||||||
return array_unique($list, SORT_LOCALE_STRING);
|
return array_unique($list, SORT_LOCALE_STRING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -982,25 +985,19 @@ class Access extends LDAPUtility implements user\IUserTools {
|
||||||
|
|
||||||
if(!is_null($attr)) {
|
if(!is_null($attr)) {
|
||||||
$selection = array();
|
$selection = array();
|
||||||
$multiArray = false;
|
|
||||||
if(count($attr) > 1) {
|
|
||||||
$multiArray = true;
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
}
|
|
||||||
foreach($findings as $item) {
|
foreach($findings as $item) {
|
||||||
if(!is_array($item)) {
|
if(!is_array($item)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$item = \OCP\Util::mb_array_change_key_case($item, MB_CASE_LOWER, 'UTF-8');
|
$item = \OCP\Util::mb_array_change_key_case($item, MB_CASE_LOWER, 'UTF-8');
|
||||||
|
|
||||||
if($multiArray) {
|
|
||||||
foreach($attr as $key) {
|
foreach($attr as $key) {
|
||||||
$key = mb_strtolower($key, 'UTF-8');
|
$key = mb_strtolower($key, 'UTF-8');
|
||||||
if(isset($item[$key])) {
|
if(isset($item[$key])) {
|
||||||
if($key !== 'dn') {
|
if($key !== 'dn') {
|
||||||
$selection[$i][$key] = $this->resemblesDN($key) ?
|
$selection[$i][$key] = $this->resemblesDN($key) ?
|
||||||
$this->sanitizeDN($item[$key][0])
|
$this->sanitizeDN($item[$key])
|
||||||
: $item[$key][0];
|
: $item[$key];
|
||||||
} else {
|
} else {
|
||||||
$selection[$i][$key] = $this->sanitizeDN($item[$key]);
|
$selection[$i][$key] = $this->sanitizeDN($item[$key]);
|
||||||
}
|
}
|
||||||
|
@ -1008,18 +1005,6 @@ class Access extends LDAPUtility implements user\IUserTools {
|
||||||
|
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
} else {
|
|
||||||
//tribute to case insensitivity
|
|
||||||
$key = mb_strtolower($attr[0], 'UTF-8');
|
|
||||||
|
|
||||||
if(isset($item[$key])) {
|
|
||||||
if($this->resemblesDN($key)) {
|
|
||||||
$selection[] = $this->sanitizeDN($item[$key]);
|
|
||||||
} else {
|
|
||||||
$selection[] = $item[$key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$findings = $selection;
|
$findings = $selection;
|
||||||
}
|
}
|
||||||
|
|
|
@ -435,7 +435,7 @@ class Wizard extends LDAPUtility {
|
||||||
// detection will fail later
|
// detection will fail later
|
||||||
$result = $this->access->searchGroups($filter, array('cn', 'dn'), $limit, $offset);
|
$result = $this->access->searchGroups($filter, array('cn', 'dn'), $limit, $offset);
|
||||||
foreach($result as $item) {
|
foreach($result as $item) {
|
||||||
$groupNames[] = $item['cn'];
|
$groupNames[] = $item['cn'][0];
|
||||||
$groupEntries[] = $item;
|
$groupEntries[] = $item;
|
||||||
}
|
}
|
||||||
$offset += $limit;
|
$offset += $limit;
|
||||||
|
|
Loading…
Reference in New Issue