diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/SynchroCommand.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/SynchroCommand.php index f8266e82..eec4e1cd 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/SynchroCommand.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/SynchroCommand.php @@ -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(); } } diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Service/ldapService.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Service/ldapService.php index 0b575a95..026c9a9a 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Service/ldapService.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Service/ldapService.php @@ -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(); }