コード例 #1
0
ファイル: EntryManager.php プロジェクト: Ener-Getick/symfony
 /**
  * {@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)));
     }
 }
コード例 #2
0
 private function loadUser($username, Entry $entry)
 {
     return new User($username, $entry->getAttribute('userpassword'), $this->defaultRoles);
 }
コード例 #3
0
ファイル: LdapUserProvider.php プロジェクト: ayoah/symfony
 /**
  * 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];
 }