fix(morelevel): ajout de niveau03 et niveau04
All checks were successful
Cadoles/nineskeletor/pipeline/head This commit looks good

This commit is contained in:
2022-09-27 11:52:49 +02:00
parent 89cb0433c0
commit d1431bcce4
46 changed files with 7163 additions and 3839 deletions

View File

@ -77,7 +77,10 @@ class CronCommand extends Command
$command = $this->getApplication()->find($cron->getCommand());
// Réccuépration des parametres
$jsonparameter = json_decode($cron->getJsonargument(), true);
$jsonparameter = null;
if ($cron->getJsonargument()) {
$jsonparameter = json_decode($cron->getJsonargument(), true);
}
// Formater la chaine de parametre
if (!$jsonparameter) {

View File

@ -174,51 +174,6 @@ class InitCommand extends Command
'Forcer la connexion afin de rendre votre site privé'
);
$this->insertConfig(
200, // order
'site', // category
'permgroup', // id
'Rôle créateur de groupe de travail', // title
'', // value
'ROLE_MASTER', // default
'role', // type,
true, // visible
true, // changeable
true, // required
'', // grouped
'Détermine quel rôle aura la permission de créer des groupes de travail'
);
$this->insertConfig(
201, // order
'site', // category
'permannu', // id
"Rôle accédant à l'annuaire", // title
'', // value
'ROLE_USER', // default
'role', // type,
true, // visible
true, // changeable
true, // required
'', // grouped
"Détermine quel rôle aura la permission de voir l'annuaire"
);
$this->insertConfig(
202, // order
'site', // category
'scopeannu', // id
"Scope de l'annuaire", // title
'', // value
'ALL', // default
'scopeannu', // type,
true, // visible
true, // changeable
true, // required
'', // grouped
"Détermine le scope des utilisateurs visibles dans l'annuaire par d'autres utilisateurs"
);
$this->insertConfig(
500, // order
'site', // category

View File

@ -29,6 +29,8 @@ class SynchroCommand extends Command
private $synchro;
private $synchropurgeniveau01;
private $synchropurgeniveau02;
private $synchropurgeniveau03;
private $synchropurgeniveau04;
private $synchropurgegroup;
private $synchropurgeuser;
private $host;
@ -41,6 +43,8 @@ class SynchroCommand extends Command
private $baseorganisation;
private $baseniveau01;
private $baseniveau02;
private $baseniveau03;
private $baseniveau04;
private $basegroup;
private $baseuser;
private $username;
@ -86,6 +90,8 @@ class SynchroCommand extends Command
$this->synchro = $this->container->getParameter('appSynchro');
$this->synchropurgeniveau01 = $this->container->getParameter('appSynchroPurgeNiveau01');
$this->synchropurgeniveau02 = $this->container->getParameter('appSynchroPurgeNiveau02');
$this->synchropurgeniveau03 = $this->container->getParameter('appSynchroPurgeNiveau03');
$this->synchropurgeniveau04 = $this->container->getParameter('appSynchroPurgeNiveau04');
$this->synchropurgegroup = $this->container->getParameter('appSynchroPurgeGroup');
$this->synchropurgeuser = $this->container->getParameter('appSynchroPurgeUser');
@ -99,6 +105,8 @@ class SynchroCommand extends Command
$this->baseorganisation = $this->container->getParameter('ldapBaseorganisation');
$this->baseniveau01 = $this->container->getParameter('ldapBaseniveau01');
$this->baseniveau02 = $this->container->getParameter('ldapBaseniveau02');
$this->baseniveau03 = $this->container->getParameter('ldapBaseniveau03');
$this->baseniveau04 = $this->container->getParameter('ldapBaseniveau04');
$this->basegroup = $this->container->getParameter('ldapBasegroup');
$this->baseuser = $this->container->getParameter('ldapBaseuser');
$this->username = $this->container->getParameter('ldapUsername');
@ -353,6 +361,8 @@ class SynchroCommand extends Command
// Mise à jour du niveau01
if ($niveau01 != $user->getNiveau01()) {
$user->setNiveau02(null);
$user->setNiveau03(null);
$user->setNiveau04(null);
}
$user->setNiveau01($niveau01);
@ -453,6 +463,8 @@ class SynchroCommand extends Command
$resetniveau01 = $this->em->getRepository("App\Entity\User")->find(-1);
$user->setNiveau01($resetniveau01);
$user->setNiveau02(null);
$user->setNiveau03(null);
$user->setNiveau04(null);
}
$this->writeln(' > '.$niveau01->getLabel());
@ -497,6 +509,8 @@ class SynchroCommand extends Command
$this->writeln($this->baseorganisation);
$this->writeln($this->baseniveau01);
$this->writeln($this->baseniveau02);
$this->writeln($this->baseniveau03);
$this->writeln($this->baseniveau04);
$this->writeln($this->basegroup);
$this->writeln($this->baseuser);
$this->ldap->addOrganisations();
@ -563,6 +577,68 @@ class SynchroCommand extends Command
}
}
$this->writeln('');
$this->writeln('== NIVEAU04 =========================================');
$niveau04s = $this->em->getRepository("App\Entity\Niveau04")->findAll();
$attributes = $this->ldap->listAttributesNiveau04();
foreach ($niveau04s as $niveau04) {
$filter = 'gidnumber='.$niveau04->getId();
$ldapentrys = $this->ldap->search($filter, $attributes, $this->baseniveau04);
if (empty($ldapentrys)) {
$filter = str_replace('*', $niveau04->getLabel(), $this->filtergroup);
$ldapentrys = $this->ldap->search($filter, $attributes, $this->baseniveau01);
}
if (empty($ldapentrys)) {
$this->writeln($niveau04->getLabel().' = SUBMIT');
$this->ldap->addNiveau04($niveau04);
} elseif ($this->ldap->ismodifyNiveau04($niveau04, $ldapentrys[0])) {
$this->writeln($niveau04->getLabel().' = UPDATE');
$this->ldap->modifyNiveau04($niveau04, $ldapentrys[0]['cn']);
}
}
$ldapentrys = $this->ldap->search($this->filtergroup, $attributes, $this->baseniveau04);
foreach ($ldapentrys as $ldapentry) {
$niveau04 = $this->em->getRepository("App\Entity\Niveau04")->find($ldapentry['gidnumber']);
if (!$niveau04) {
$this->writeln($ldapentry['cn'].' = DELETE');
$dn = $this->ldap->getNiveau04DN($ldapentry['cn']);
$this->ldap->deleteByDN($dn);
}
}
$this->writeln('');
$this->writeln('== NIVEAU03 =========================================');
$niveau03s = $this->em->getRepository("App\Entity\Niveau03")->findAll();
$attributes = $this->ldap->listAttributesNiveau03();
foreach ($niveau03s as $niveau03) {
$filter = 'gidnumber='.$niveau03->getId();
$ldapentrys = $this->ldap->search($filter, $attributes, $this->baseniveau03);
if (empty($ldapentrys)) {
$filter = str_replace('*', $niveau03->getLabel(), $this->filtergroup);
$ldapentrys = $this->ldap->search($filter, $attributes, $this->baseniveau01);
}
if (empty($ldapentrys)) {
$this->writeln($niveau03->getLabel().' = SUBMIT');
$this->ldap->addNiveau03($niveau03);
} elseif ($this->ldap->ismodifyNiveau03($niveau03, $ldapentrys[0])) {
$this->writeln($niveau03->getLabel().' = UPDATE');
$this->ldap->modifyNiveau03($niveau03, $ldapentrys[0]['cn']);
}
}
$ldapentrys = $this->ldap->search($this->filtergroup, $attributes, $this->baseniveau03);
foreach ($ldapentrys as $ldapentry) {
$niveau03 = $this->em->getRepository("App\Entity\Niveau03")->find($ldapentry['gidnumber']);
if (!$niveau03) {
$this->writeln($ldapentry['cn'].' = DELETE');
$dn = $this->ldap->getNiveau03DN($ldapentry['cn']);
$this->ldap->deleteByDN($dn);
}
}
$this->writeln('');
$this->writeln('== NIVEAU02 =========================================');
$niveau02s = $this->em->getRepository("App\Entity\Niveau02")->findAll();
@ -824,6 +900,8 @@ class SynchroCommand extends Command
// Mise à jour du niveau01
if ($niveau01 != $user->getNiveau01()) {
$user->setNiveau02(null);
$user->setNiveau03(null);
$user->setNiveau04(null);
}
$user->setNiveau01($niveau01);
@ -919,6 +997,8 @@ class SynchroCommand extends Command
$resetniveau01 = $this->em->getRepository("App\Entity\User")->find(-1);
$user->setNiveau01($resetniveau01);
$user->setNiveau02(null);
$user->setNiveau03(null);
$user->setNiveau04(null);
}
$this->writeln(' > '.$niveau01->getLabel());