Merge branch 'master' into dist/envole/6/master

This commit is contained in:
Arnaud Fornerot 2021-04-27 10:13:40 +02:00
commit da0f0ad0f3
7 changed files with 51 additions and 15 deletions

View File

@ -104,6 +104,7 @@ class SecurityController extends Controller
$user->setAvatar("noavatar.png"); $user->setAvatar("noavatar.png");
$user->setVisible(true); $user->setVisible(true);
$user->setAuthlevel("simple"); $user->setAuthlevel("simple");
$user->setBelongingpopulation("agent");
$user->setRole("ROLE_USER"); $user->setRole("ROLE_USER");
if(in_array($username,$this->getParameter("ldap_usersadmin"))) if(in_array($username,$this->getParameter("ldap_usersadmin")))

View File

@ -49,7 +49,7 @@ class ScriptCommand extends Command
$script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"visibletrue"]); $script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"visibletrue"]);
if(!$script) { if(!$script) {
$this->writelnred("== SCRIPT = visibletrue"); $this->writeln("== SCRIPT = visibletrue");
$this->visibletrue(); $this->visibletrue();
$script=new Script(); $script=new Script();
@ -61,7 +61,7 @@ class ScriptCommand extends Command
$script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"setusersniveau"]); $script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"setusersniveau"]);
if(!$script) { if(!$script) {
$this->writelnred("== SCRIPT = setusersniveau"); $this->writeln("== SCRIPT = setusersniveau");
$this->setusersniveau(); $this->setusersniveau();
$script=new Script(); $script=new Script();
@ -73,7 +73,7 @@ class ScriptCommand extends Command
$script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"setfgcancreateproject"]); $script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"setfgcancreateproject"]);
if(!$script) { if(!$script) {
$this->writelnred("== SCRIPT = setfgcancreateproject"); $this->writeln("== SCRIPT = setfgcancreateproject");
$this->setfgcancreateproject(); $this->setfgcancreateproject();
$script=new Script(); $script=new Script();
@ -85,7 +85,7 @@ class ScriptCommand extends Command
$script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"createproject"]); $script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"createproject"]);
if(!$script) { if(!$script) {
$this->writelnred("== SCRIPT = createproject"); $this->writeln("== SCRIPT = createproject");
$this->createproject(); $this->createproject();
$script=new Script(); $script=new Script();
@ -97,7 +97,7 @@ class ScriptCommand extends Command
$script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"createthumbmini"]); $script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"createthumbmini"]);
if(!$script) { if(!$script) {
$this->writelnred("== SCRIPT = createthumbmini"); $this->writeln("== SCRIPT = createthumbmini");
$this->createthumbmini(); $this->createthumbmini();
$script=new Script(); $script=new Script();
@ -109,7 +109,7 @@ class ScriptCommand extends Command
$script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"createwidgetproject"]); $script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"createwidgetproject"]);
if(!$script) { if(!$script) {
$this->writelnred("== SCRIPT = createwidgetproject"); $this->writeln("== SCRIPT = createwidgetproject");
$this->createwidgetproject(); $this->createwidgetproject();
$script=new Script(); $script=new Script();
@ -121,7 +121,7 @@ class ScriptCommand extends Command
$script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"renamegroup"]); $script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"renamegroup"]);
if(!$script) { if(!$script) {
$this->writelnred("== SCRIPT = renamegroup"); $this->writeln("== SCRIPT = renamegroup");
$this->renamegroup(); $this->renamegroup();
$script=new Script(); $script=new Script();
@ -134,7 +134,7 @@ class ScriptCommand extends Command
$script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"rolegroup"]); $script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"rolegroup"]);
if(!$script) { if(!$script) {
$this->writelnred("== SCRIPT = rolegroup"); $this->writeln("== SCRIPT = rolegroup");
$this->rolegroup(); $this->rolegroup();
$script=new Script(); $script=new Script();
@ -144,6 +144,18 @@ class ScriptCommand extends Command
$this->writeln(""); $this->writeln("");
} }
$script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"userdefaultmissing"]);
if(!$script) {
$this->writeln("== SCRIPT = userdefaultmissing");
$this->userdefaultmissing();
$script=new Script();
$script->setName("userdefaultmissing");
$this->em->persist($script);
$this->em->flush();
$this->writeln("");
}
return 1; return 1;
} }
@ -319,7 +331,28 @@ class ScriptCommand extends Command
} }
} }
private function userdefaultmissing(){
$users = $this->em->getRepository('CadolesCoreBundle:User')->findAll();
foreach($users as $user) {
if($user->getVisible()=="") {
$user->setVisible(true);
$this->em->persist($user);
$this->em->flush();
}
if($user->getAuthlevel()=="") {
$user->setAuthlevel("simple");
$this->em->persist($user);
$this->em->flush();
}
if($user->getBelongingpopulation()=="") {
$user->setBelongingpopulation("agent");
$this->em->persist($user);
$this->em->flush();
}
}
}

View File

@ -85,8 +85,8 @@ class CoreController extends Controller
switch($key) { switch($key) {
case "firstname": if($user->getFirstname()=="") $toprofil=true; break; case "firstname": if($user->getFirstname()=="") $toprofil=true; break;
case "visible": if($user->getVisible()=="") $toprofil=true; break; case "visible": if($user->getVisible()=="") $toprofil=true; break;
case "authlevel": if($user->getAuthlevel()=="") $toprofil=true; break; //case "authlevel": if($user->getAuthlevel()=="") $toprofil=true; break;
case "belongingpopulation": if($user->getBelongingpopulation()=="") $toprofil=true; break; //case "belongingpopulation": if($user->getBelongingpopulation()=="") $toprofil=true; break;
case "job": if($user->getJob()=="") $toprofil=true; break; case "job": if($user->getJob()=="") $toprofil=true; break;
case "position": if($user->getPosition()=="") $toprofil=true; break; case "position": if($user->getPosition()=="") $toprofil=true; break;
case "niveau02": if($user->geNiveau02()=="") $toprofil=true; break; case "niveau02": if($user->geNiveau02()=="") $toprofil=true; break;

View File

@ -366,8 +366,8 @@ class UserController extends Controller
// Initialisation de l'enregistrement // Initialisation de l'enregistrement
$data = new User(); $data = new User();
$data->setVisible(true); $data->setVisible(true);
$data->setBelongingpopulation("authlevel");
$data->setAuthlevel("simple"); $data->setAuthlevel("simple");
$data->setBelongingpopulation("agent");
$fields=$this->getDefaultDatauser(); $fields=$this->getDefaultDatauser();
// Création du formulaire // Création du formulaire

View File

@ -81,6 +81,7 @@ class samlUserCreatorService implements UserCreatorInterface
$user->setAvatar("noavatar.png"); $user->setAvatar("noavatar.png");
$user->setVisible(true); $user->setVisible(true);
$user->setAuthlevel("simple"); $user->setAuthlevel("simple");
$user->setBelongingpopulation("agent");
$user->setRole("ROLE_USER"); $user->setRole("ROLE_USER");
// Création // Création

View File

@ -729,6 +729,7 @@ $api('$id',data);";
$user->setAvatar("noavatar.png"); $user->setAvatar("noavatar.png");
$user->setVisible(true); $user->setVisible(true);
$user->setAuthlevel("simple"); $user->setAuthlevel("simple");
$user->setBelongingpopulation("agent");
$user->setRole("ROLE_USER"); $user->setRole("ROLE_USER");
if(in_array($username,$this->getParameter("ldap_usersadmin"))) if(in_array($username,$this->getParameter("ldap_usersadmin")))

View File

@ -13,11 +13,11 @@ INSERT IGNORE INTO `niveau01` (`id`, `label`, `siren`) VALUES
%end if %end if
%if %%getVar("ninegate_syncldap", 'non') == "oui" %if %%getVar("ninegate_syncldap", 'non') == "oui"
INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`visible`,`authlevel`,`belongingpopulation`) VALUES
(-100, -100, 'admin', 'Administrateur', '%%ninegate_organization', '', '%%system_mail_to', 'admin.jpg', 'ROLE_ADMIN', '%%ninegate_niveau01siren', 'simple'); (-100, -100, 'admin', 'Administrateur', '%%ninegate_organization', '', '%%system_mail_to', 'admin.jpg', 'ROLE_ADMIN', '%%ninegate_niveau01siren', 1, 'simple', 'agent');
%else %else
INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`visible`,`authlevel`,`belongingpopulation`) VALUES
(-100, -100, 'admin', 'Administrateur', '%%libelle_etab', 'PWD_CAS', '%%system_mail_to', 'admin.jpg', 'ROLE_ADMIN', '%%numero_etab', 'simple'); (-100, -100, 'admin', 'Administrateur', '%%libelle_etab', 'PWD_CAS', '%%system_mail_to', 'admin.jpg', 'ROLE_ADMIN', '%%numero_etab', 1, 'simple', 'agent');
%end if %end if