parametrer la synchro scribe (ref #183)

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

View File

@ -74,6 +74,8 @@
<variable type='oui/non' name='ninegate_syncldap' description="Synchroniser Ninegate vers votre annuaire"><value>non</value></variable>
<variable type='string' name='ninegate_ldaptemplate' description="Modèle d'annuaire"><value>scribe</value></variable>
<variable type='oui/non' name='ninegate_scribegroup' description="Considérer les classes/options comme des groupes de travail"><value>oui</value></variable>
<variable type='oui/non' name='ninegate_scribemaster' description="Placer les professeurs comme manager des groupes classes/options"><value>oui</value></variable>
<variable type='string' name='ninegate_pwdadmin' description="Mot de passe du compte admin durant l'instance (idem valeur Cadoles ldap)" mandatory='True'><value>cadoles</value></variable>
<variable type='string' name='ninegate_organization' description="Nom de l'organisation principale (idem valeur Cadoles ldap)" mandatory='True'><value>cadoles</value></variable>
@ -398,6 +400,8 @@
<target type='variable'>ninegate_syncldap</target>
<target type='variable'>ninegate_ldaptemplate</target>
<target type='variable'>ninegate_scribegroup</target>
<target type='variable'>ninegate_scribemaster</target>
<target type='variable'>ninegate_pwdadmin</target>
<target type='variable'>ninegate_organization</target>
@ -517,6 +521,17 @@
</auto>
<!-- AFFICHAGE EN FONCTION DU MODE SCRIBE -->
<condition name='hidden_if_not_in' source='ninegate_ldaptemplate'>
<param>scribe</param>
<target type='variable'>ninegate_scribegroup</target>
<target type='variable'>ninegate_scribemaster</target>
</condition>
<!-- AFFICHAGE EN FONCTION DU MODULE PORTAL -->
<condition name='hidden_if_in' source='ninegate_activate_portal'>
<param>non</param>

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);

View File

@ -184,6 +184,20 @@ parameters:
ldap_email: mail
ldap_usersadmin: [admin]
# Template scribe
%if %%getVar("ninegate_scribegroup", 'non') == "oui"
scribe_group: true
%else
scribe_group: false
%end if
%if %%getVar("ninegate_scribemaster", 'non') == "oui"
scribe_master: true
%else
scribe_master: false
%end if
# Activation Widget
%if %%getVar("ninegate_activate_widadminer", 'non') == "oui"
activate_widadminer: true