LdapUserGroupBackend: Fetch the uid for a member's DN

refs #9772
This commit is contained in:
Johannes Meyer 2015-09-29 09:48:57 +02:00
parent ef1a81897b
commit d33b1954aa

View File

@ -439,13 +439,37 @@ class LdapUserGroupBackend extends LdapRepository implements UserGroupBackendInt
if ($this->groupClass === null) { if ($this->groupClass === null) {
throw new ProgrammingError('It is required to set the objectClass where to look for groups first'); throw new ProgrammingError('It is required to set the objectClass where to look for groups first');
} }
if ($this->groupMemberAttribute === null) {
throw new ProgrammingError('It is required to set a attribute name where to find a group\'s members first');
}
return array( $rules = array(
$this->groupClass => array( $this->groupClass => array(
'created_at' => 'generalized_time', 'created_at' => 'generalized_time',
'last_modified' => 'generalized_time' 'last_modified' => 'generalized_time'
) )
); );
if (! $this->isAmbiguous($this->groupClass, $this->groupMemberAttribute)) {
$rules[$this->groupClass][] = 'user_name';
}
return $rules;
}
/**
* Return the uid for the given distinguished name
*
* @param string $username
*
* @param string
*/
protected function retrieveUserName($dn)
{
return $this->ds
->select()
->from($this->userClass, array($this->userNameAttribute))
->setBase($dn)
->fetchOne();
} }
/** /**