fix(activeuser): user isactive & adress niveau & route all
Some checks reported warnings
Cadoles/nineskeletor/pipeline/head This commit is unstable
Cadoles/nineskeletor/pipeline/pr-master This commit is unstable

This commit is contained in:
2022-10-02 14:50:48 +02:00
parent 2cad98ca86
commit 84230eb347
35 changed files with 749 additions and 214 deletions

View File

@@ -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();
}
}
}
}