app ldap connect
This commit is contained in:
@ -347,6 +347,28 @@ class LdapService
|
||||
// == Function User==================================================================================================================================================
|
||||
// ==================================================================================================================================================================
|
||||
|
||||
public function fixtureUser(User $user,$dn)
|
||||
{
|
||||
$connection = $this->connect();
|
||||
|
||||
$attrs = [];
|
||||
$attrs['objectclass'] = $this->getObjectClassesUser();
|
||||
$this->fillAttributesUser($user, $attrs);
|
||||
|
||||
foreach ($attrs as $key => $value) {
|
||||
if (empty($value)) {
|
||||
unset($attrs[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
$result = ldap_add($connection, $dn, $attrs);
|
||||
if (!$result) {
|
||||
$this->ldapError();
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function addUser(User $user)
|
||||
{
|
||||
$connection = $this->connect();
|
||||
@ -643,8 +665,6 @@ class LdapService
|
||||
$attrs['sn'] = $user->getLastname();
|
||||
$attrs['mail'] = $user->getEmail();
|
||||
$attrs['displayname'] = $user->getFirstname().' '.$user->getLastname();
|
||||
$attrs['telephonenumber'] = $user->getTelephonenumber();
|
||||
$attrs['postaladdress'] = $user->getPostaladress();
|
||||
$attrs['userpassword'] = $user->getPassword();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user