fix retrieving group members with numerical uids from LDAP
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
parent
b02d3a27ba
commit
8acec5309c
|
@ -207,6 +207,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
|
||||||
* @param string $dnGroup
|
* @param string $dnGroup
|
||||||
* @param array|null &$seen
|
* @param array|null &$seen
|
||||||
* @return array|mixed|null
|
* @return array|mixed|null
|
||||||
|
* @throws \OC\ServerNotAvailableException
|
||||||
*/
|
*/
|
||||||
private function _groupMembers($dnGroup, &$seen = null) {
|
private function _groupMembers($dnGroup, &$seen = null) {
|
||||||
if ($seen === null) {
|
if ($seen === null) {
|
||||||
|
@ -220,26 +221,26 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
|
||||||
// used extensively in cron job, caching makes sense for nested groups
|
// used extensively in cron job, caching makes sense for nested groups
|
||||||
$cacheKey = '_groupMembers'.$dnGroup;
|
$cacheKey = '_groupMembers'.$dnGroup;
|
||||||
$groupMembers = $this->access->connection->getFromCache($cacheKey);
|
$groupMembers = $this->access->connection->getFromCache($cacheKey);
|
||||||
if(!is_null($groupMembers)) {
|
if($groupMembers !== null) {
|
||||||
return $groupMembers;
|
return $groupMembers;
|
||||||
}
|
}
|
||||||
$seen[$dnGroup] = 1;
|
$seen[$dnGroup] = 1;
|
||||||
$members = $this->access->readAttribute($dnGroup, $this->access->connection->ldapGroupMemberAssocAttr,
|
$members = $this->access->readAttribute($dnGroup, $this->access->connection->ldapGroupMemberAssocAttr,
|
||||||
$this->access->connection->ldapGroupFilter);
|
$this->access->connection->ldapGroupFilter);
|
||||||
if (is_array($members)) {
|
if (is_array($members)) {
|
||||||
foreach ($members as $memberDN) {
|
foreach ($members as $member) {
|
||||||
$allMembers[$memberDN] = 1;
|
$allMembers[$member] = 1;
|
||||||
$nestedGroups = $this->access->connection->ldapNestedGroups;
|
$nestedGroups = $this->access->connection->ldapNestedGroups;
|
||||||
if (!empty($nestedGroups)) {
|
if (!empty($nestedGroups)) {
|
||||||
$subMembers = $this->_groupMembers($memberDN, $seen);
|
$subMembers = $this->_groupMembers($member, $seen);
|
||||||
if ($subMembers) {
|
if ($subMembers) {
|
||||||
$allMembers = array_merge($allMembers, $subMembers);
|
$allMembers += $subMembers;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$allMembers = array_merge($allMembers, $this->getDynamicGroupMembers($dnGroup));
|
$allMembers += $this->getDynamicGroupMembers($dnGroup);
|
||||||
|
|
||||||
$this->access->connection->writeToCache($cacheKey, $allMembers);
|
$this->access->connection->writeToCache($cacheKey, $allMembers);
|
||||||
return $allMembers;
|
return $allMembers;
|
||||||
|
|
Loading…
Reference in New Issue