parametrer la synchro scribe (ref #183)

This commit is contained in:
2020-07-15 14:38:16 +02:00
parent 177f366a83
commit fb879143d5
3 changed files with 39 additions and 7 deletions

View File

@ -101,6 +101,8 @@ class SynchroCommand extends Command
$ldap_lastname = $this->container->getParameter('ldap_lastname');
$ldap_email = $this->container->getParameter('ldap_email');
$ldap_usersadmin = $this->container->getParameter('ldap_usersadmin');
$scribe_group = $this->container->getParameter('scribe_group');
$scribe_master = $this->container->getParameter('scribe_master');
$fieldstoread = array($ldap_username,$ldap_firstname,$ldap_lastname,$ldap_email);
$ldapusers = array();
$ldapmails = array();
@ -119,7 +121,7 @@ class SynchroCommand extends Command
$ldapfilter="(|(&(uid=*)(ENTPersonProfils=enseignant))(&(uid=*)(typeadmin=0))(&(uid=*)(typeadmin=2)))";
$label="PROFIL - Enseignants";
$this->writeln(" - $label");
if(!$simulate) $this->addmodGroup($label,$ldapfilter,true);
if(!$simulate) $this->addmodGroup($label,$ldapfilter,$scribe_group);
// Responsables
$ldapfilter="(&(uid=*)(ENTPersonProfils=responsable))";
@ -131,7 +133,7 @@ class SynchroCommand extends Command
$ldapfilter="(&(uid=*)(ENTPersonProfils=administratif))";
$label="PROFIL - Administratifs";
$this->writeln(" - $label");
if(!$simulate) $this->addmodGroup($label,$ldapfilter,true);
if(!$simulate) $this->addmodGroup($label,$ldapfilter,$scribe_group);
// Classes
$this->writeln('');
@ -143,7 +145,7 @@ class SynchroCommand extends Command
$label="CLASSE - ".$result["cn"];
$this->writeln(" - $label");
if(!$simulate) $this->addmodGroup($label,$ldapfilter,true);
if(!$simulate) $this->addmodGroup($label,$ldapfilter,$scribe_group);
}
// Options
@ -156,7 +158,7 @@ class SynchroCommand extends Command
$label="OPTION - ".$result["cn"];
$this->writeln(" - $label");
if(!$simulate) $this->addmodGroup($label,$ldapfilter,true);
if(!$simulate) $this->addmodGroup($label,$ldapfilter,$scribe_group);
}
// Groupes
@ -169,7 +171,7 @@ class SynchroCommand extends Command
$label="GROUPE - ".$result["cn"];
$this->writeln(" - $label");
if(!$simulate) $this->addmodGroup($label,$ldapfilter,true);
if(!$simulate) $this->addmodGroup($label,$ldapfilter,$scribe_group);
}
}
@ -701,13 +703,13 @@ class SynchroCommand extends Command
$group=$this->em->getRepository('CadolesCoreBundle:Group')->findOneBy(array('fgtemplate' => true, 'label' => $label));
if(!$group) {
$group=new Group();
$group->setFgcanshare($fgcanshare);
$group->setFgcancreatepage(false);
$group->setFgcancreateblog(false);
$group->setFgcancreatecalendar(false);
$group->setFgcancreateproject(false);
}
$group->setFgcanshare($fgcanshare);
$group->setLabel($label);
$group->setFgopen(false);
$group->setFgall(false);
@ -783,7 +785,8 @@ class SynchroCommand extends Command
// Si modèle scribe
$ldap_template = $this->container->getParameter('ldap_template');
if($ldap_template=="scribe") {
$scribe_master = $this->container->getParameter('scribe_master');
if($ldap_template=="scribe"&&$scribe_master) {
$ldapfilter="(|(&(uid=".$user->getUsername().")(ENTPersonProfils=enseignant))(&(uid=".$user->getUsername().")(typeadmin=0))(&(uid=".$user->getUsername().")(typeadmin=2)))";
$results = $this->ldap->search($ldapfilter, ['uid'], $this->ldap_basedn);
if($results) $member->setFgmanager(true);