check number of members after potential resolving of rdns

- the type check is not necessary anymore for the return type of
  _groupMembers()

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
Arthur Schiwon 2020-11-27 18:44:27 +01:00 committed by backportbot[bot]
parent 213464afca
commit cca1fb792b
1 changed files with 5 additions and 4 deletions

View File

@ -136,10 +136,6 @@ class Group_LDAP extends BackendUtility implements GroupInterface, IGroupLDAP, I
//usually, LDAP attributes are said to be case insensitive. But there are exceptions of course. //usually, LDAP attributes are said to be case insensitive. But there are exceptions of course.
$members = $this->_groupMembers($groupDN); $members = $this->_groupMembers($groupDN);
if (!is_array($members) || count($members) === 0) {
$this->access->connection->writeToCache($cacheKey, false);
return false;
}
//extra work if we don't get back user DNs //extra work if we don't get back user DNs
switch ($this->ldapGroupMemberAssocAttr) { switch ($this->ldapGroupMemberAssocAttr) {
@ -186,6 +182,11 @@ class Group_LDAP extends BackendUtility implements GroupInterface, IGroupLDAP, I
break; break;
} }
if (count($members) === 0) {
$this->access->connection->writeToCache($cacheKey, false);
return false;
}
$isInGroup = in_array($userDN, $members); $isInGroup = in_array($userDN, $members);
$this->access->connection->writeToCache($cacheKey, $isInGroup); $this->access->connection->writeToCache($cacheKey, $isInGroup);
$this->access->connection->writeToCache($cacheKeyMembers, $members); $this->access->connection->writeToCache($cacheKeyMembers, $members);