fix(activeuser): user isactive & adress niveau & route all
This commit is contained in:
@@ -424,8 +424,13 @@ class SynchroCommand extends Command
|
||||
if (!in_array($user->getUsername(), $tbusers)) {
|
||||
if ($user->getId() > 0) {
|
||||
$this->writeln(' > '.$user->getUSername());
|
||||
$this->em->remove($user);
|
||||
$this->em->flush();
|
||||
try {
|
||||
$this->em->remove($user);
|
||||
$this->em->flush();
|
||||
} catch (\Exception $e) {
|
||||
$user->setIsactive(false);
|
||||
$this->em->flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -518,7 +523,7 @@ class SynchroCommand extends Command
|
||||
|
||||
$this->writeln('');
|
||||
$this->writeln('== USER =============================================');
|
||||
$users = $this->em->getRepository("App\Entity\User")->findAll();
|
||||
$users = $this->em->getRepository("App\Entity\User")->findBy(['isactive' => true]);
|
||||
$attributes = $this->ldap->listAttributesUser();
|
||||
foreach ($users as $user) {
|
||||
$filter = str_replace('*', $user->getUsername(), $this->filteruser);
|
||||
@@ -534,7 +539,7 @@ class SynchroCommand extends Command
|
||||
|
||||
$ldapentrys = $this->ldap->search($this->filteruser, $attributes, $this->baseuser);
|
||||
foreach ($ldapentrys as $ldapentry) {
|
||||
$user = $this->em->getRepository("App\Entity\User")->findOneBy(['username' => $ldapentry['uid']]);
|
||||
$user = $this->em->getRepository("App\Entity\User")->findOneBy(['username' => $ldapentry['uid'], 'isactive' => true]);
|
||||
if (!$user) {
|
||||
$this->writeln($ldapentry['uid'].' = DELETE');
|
||||
$dn = $this->ldap->getUserDN($ldapentry['uid']);
|
||||
@@ -959,8 +964,13 @@ class SynchroCommand extends Command
|
||||
if (!in_array($user->getUsername(), $tbusers)) {
|
||||
if ($user->getId() > 0) {
|
||||
$this->writeln(' > '.$user->getUsername());
|
||||
$this->em->remove($user);
|
||||
$this->em->flush();
|
||||
try {
|
||||
$this->em->remove($user);
|
||||
$this->em->flush();
|
||||
} catch (\Exception $e) {
|
||||
$user->setIsactive(false);
|
||||
$this->em->flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user