This commit is contained in:
afornerot 2019-06-24 11:48:49 +02:00
parent f2b050a88d
commit 75d979fa09
2 changed files with 10 additions and 5 deletions

View File

@ -160,11 +160,18 @@ class SynchroCommand extends Command
}
}
else {
$this->writeln(" - Modification dans Bundle >> ".$result[$ldap_username]);
if(!$simulate) $this->modUser($user[0],$result[$ldap_username],$result[$ldap_firstname],$result[$ldap_lastname],$result[$ldap_email],$ldap_usersadmin);
$toadmin=false;
if(in_array($result[$ldap_username],$ldap_usersadmin)&&$user->getRole()!="ROLE_ADMIN")
$toadmin=true;
if($user->getLastname()!=$result[$ldap_username]||$user->getFirstname()!=$result[$ldap_firstname]||$user->getEmail()!=$result[$ldap_email]||$toadmin) {
$this->writeln(" - Modification dans Bundle >> ".$result[$ldap_username]);
if(!$simulate) $this->modUser($user[0],$result[$ldap_username],$result[$ldap_firstname],$result[$ldap_lastname],$result[$ldap_email],$ldap_usersadmin);
}
}
}
}
$this->em->flush();
$this->writeln('');
$this->writeln('== USERS GROUP ======================================');
@ -747,7 +754,6 @@ class SynchroCommand extends Command
$user->setRole("ROLE_USER");
$this->em->persist($user);
$this->em->flush();
}
protected function modUser($user,$username,$firstname,$lastname,$email,$usersadmin) {
@ -759,7 +765,6 @@ class SynchroCommand extends Command
$user->setRole("ROLE_ADMIN");
$this->em->persist($user);
$this->em->flush();
}
}

View File

@ -52,7 +52,7 @@ class ldapService
public function search($filter, $attributes = array(), $subBranch = '') {
$connection = $this->connect();
$branch = ($subBranch ? $subBranch : $this->baseDN);
$result = ldap_search($connection, $branch, $filter, $attributes);
$result = ldap_search($connection, $branch, $filter, $attributes,0,0,0);
if(!$result) {
$this->ldapError();
}