Skip to content

Commit

Permalink
dn2ocname: also apply group filter to readAttribute()
Browse files Browse the repository at this point in the history
Signed-off-by: Roland Tapken <roland@bitarbeiter.net>
  • Loading branch information
Roland Tapken committed Mar 7, 2018
1 parent cf4ec7a commit 2472b93
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions apps/user_ldap/lib/Access.php
Original file line number Diff line number Diff line change
Expand Up @@ -538,9 +538,11 @@ public function dn2ocname($fdn, $ldapName = null, $isUser = true, &$newlyMapped
if($isUser) {
$mapper = $this->getUserMapper();
$nameAttribute = $this->connection->ldapUserDisplayName;
$filter = $this->connection->ldapUserFilter;
} else {
$mapper = $this->getGroupMapper();
$nameAttribute = $this->connection->ldapGroupDisplayName;
$filter = $this->connection->ldapGroupFilter;
}

//let's try to retrieve the Nextcloud name from the mappings table
Expand All @@ -564,13 +566,9 @@ public function dn2ocname($fdn, $ldapName = null, $isUser = true, &$newlyMapped
}

if(is_null($ldapName)) {
if ($isUser) {
$ldapName = $this->readAttribute($fdn, $nameAttribute, $this->connection->ldapUserFilter);
} else {
$ldapName = $this->readAttribute($fdn, $nameAttribute);
}
$ldapName = $this->readAttribute($fdn, $nameAttribute, $filter);
if(!isset($ldapName[0]) && empty($ldapName[0])) {
\OCP\Util::writeLog('user_ldap', 'No or empty name for '.$fdn.'.', \OCP\Util::INFO);
\OCP\Util::writeLog('user_ldap', 'No or empty name for '.$fdn.' with filter '.$filter.'.', \OCP\Util::INFO);
return false;
}
$ldapName = $ldapName[0];
Expand Down

0 comments on commit 2472b93

Please sign in to comment.