Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function remove(Entry $entry)
 {
     $con = $this->connection->getResource();
     if (!@ldap_delete($con, $entry->getDn())) {
         throw new LdapException(sprintf('Could not remove entry "%s": %s', $entry->getDn(), ldap_error($con)));
     }
 }
Exemplo n.º 2
0
 private function loadUser($username, Entry $entry)
 {
     return new User($username, $entry->getAttribute('userpassword'), $this->defaultRoles);
 }
Exemplo n.º 3
0
 /**
  * Fetches the password from an LDAP entry.
  *
  * @param null|Entry $entry
  */
 private function getPassword(Entry $entry)
 {
     if (null === $this->passwordAttribute) {
         return;
     }
     if (!$entry->hasAttribute($this->passwordAttribute)) {
         throw new InvalidArgumentException(sprintf('Missing attribute "%s" for user "%s".', $this->passwordAttribute, $entry->getDn()));
     }
     $values = $entry->getAttribute($this->passwordAttribute);
     if (1 !== count($values)) {
         throw new InvalidArgumentException(sprintf('Attribute "%s" has multiple values.', $this->passwordAttribute));
     }
     return $values[0];
 }