Fix remarks in #9848
This commit is contained in:
parent
71f3326035
commit
fc662917e7
1 changed files with 13 additions and 11 deletions
|
@ -285,6 +285,7 @@ class Wizard extends LDAPUtility {
|
||||||
* fetches all groups from LDAP
|
* fetches all groups from LDAP
|
||||||
* @param string $dbKey
|
* @param string $dbKey
|
||||||
* @param string $confKey
|
* @param string $confKey
|
||||||
|
* @return array $groupEntries
|
||||||
*/
|
*/
|
||||||
public function fetchGroups($dbKey, $confKey) {
|
public function fetchGroups($dbKey, $confKey) {
|
||||||
$obclasses = array('posixGroup', 'group', 'zimbraDistributionList', 'groupOfNames');
|
$obclasses = array('posixGroup', 'group', 'zimbraDistributionList', 'groupOfNames');
|
||||||
|
@ -300,21 +301,21 @@ class Wizard extends LDAPUtility {
|
||||||
$filter = $ldapAccess->combineFilterWithOr($filterParts);
|
$filter = $ldapAccess->combineFilterWithOr($filterParts);
|
||||||
$filter = $ldapAccess->combineFilterWithAnd(array($filter, 'cn=*'));
|
$filter = $ldapAccess->combineFilterWithAnd(array($filter, 'cn=*'));
|
||||||
|
|
||||||
$groupdns = array();
|
$groupEntries = array();
|
||||||
$limit = 400;
|
$limit = 400;
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
do {
|
do {
|
||||||
$result = $ldapAccess->searchGroups($filter, array('cn','dn'), $limit, $offset);
|
$result = $ldapAccess->searchGroups($filter, array('cn','dn'), $limit, $offset);
|
||||||
foreach($result as $item) {
|
foreach($result as $item) {
|
||||||
$groups[] = $item['cn'];
|
$groupNames[] = $item['cn'];
|
||||||
$groupdns[] = $item;
|
$groupEntries[] = $item;
|
||||||
}
|
}
|
||||||
$offset += $limit;
|
$offset += $limit;
|
||||||
} while (count($groups) > 0 && count($groups) % $limit === 0);
|
} while (count($groupNames) > 0 && count($groupNames) % $limit === 0);
|
||||||
|
|
||||||
if(count($groups) > 0) {
|
if(count($groupNames) > 0) {
|
||||||
natsort($groups);
|
natsort($groupNames);
|
||||||
$this->result->addOptions($dbKey, array_values($groups));
|
$this->result->addOptions($dbKey, array_values($groupNames));
|
||||||
} else {
|
} else {
|
||||||
throw new \Exception(self::$l->t('Could not find the desired feature'));
|
throw new \Exception(self::$l->t('Could not find the desired feature'));
|
||||||
}
|
}
|
||||||
|
@ -324,7 +325,7 @@ class Wizard extends LDAPUtility {
|
||||||
//something is already configured? pre-select it.
|
//something is already configured? pre-select it.
|
||||||
$this->result->addChange($dbKey, $setFeatures);
|
$this->result->addChange($dbKey, $setFeatures);
|
||||||
}
|
}
|
||||||
return $groupdns;
|
return $groupEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function determineGroupMemberAssoc() {
|
public function determineGroupMemberAssoc() {
|
||||||
|
@ -656,6 +657,7 @@ class Wizard extends LDAPUtility {
|
||||||
* Checks whether the server supports memberOf in LDAP Filter.
|
* Checks whether the server supports memberOf in LDAP Filter.
|
||||||
* Requires that groups are determined, thus internally called from within
|
* Requires that groups are determined, thus internally called from within
|
||||||
* determineGroups()
|
* determineGroups()
|
||||||
|
* @param array $groups
|
||||||
* @return bool true if it does, false otherwise
|
* @return bool true if it does, false otherwise
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
|
@ -672,12 +674,12 @@ class Wizard extends LDAPUtility {
|
||||||
$filterPrefix = '(&(objectclass=*)(memberOf=';
|
$filterPrefix = '(&(objectclass=*)(memberOf=';
|
||||||
$filterSuffix = '))';
|
$filterSuffix = '))';
|
||||||
|
|
||||||
foreach($groups as $properties) {
|
foreach($groups as $groupProperties) {
|
||||||
if(!isset($properties['cn'])) {
|
if(!isset($groupProperties['cn'])) {
|
||||||
//assuming only groups have their cn cached :)
|
//assuming only groups have their cn cached :)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$filter = strtolower($filterPrefix . $properties['dn'] . $filterSuffix);
|
$filter = strtolower($filterPrefix . $groupProperties['dn'] . $filterSuffix);
|
||||||
$rr = $this->ldap->search($cr, $base, $filter, array('dn'));
|
$rr = $this->ldap->search($cr, $base, $filter, array('dn'));
|
||||||
if(!$this->ldap->isResource($rr)) {
|
if(!$this->ldap->isResource($rr)) {
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in a new issue