mise en place d'une auto creation des groupes sur le modele LDAP-Open
This commit is contained in:
@ -144,7 +144,7 @@ class InitDataCommand extends ContainerAwareCommand
|
||||
if($ldap_template=="scribe")
|
||||
$niveau01->setLdapfilter("(&(uid=*)(objectclass=inetOrgPerson)(!(description=Computer)))");
|
||||
else
|
||||
$niveau01->setLdapfilter("(uid=*)");
|
||||
$niveau01->setLdapfilter($this->getContainer()->getParameter('openldapreqniveau01'));
|
||||
|
||||
$em->persist($niveau01);
|
||||
$em->flush();
|
||||
|
@ -174,6 +174,22 @@ class SynchroCommand extends Command
|
||||
if(!$simulate) $this->addmodGroup($label,$ldapfilter,$scribe_group);
|
||||
}
|
||||
}
|
||||
elseif($ldap_template=="open") {
|
||||
if($this->container->getParameter('openldapsynchrogroup')) {
|
||||
$this->writeln('');
|
||||
$this->writeln('== GROUPES ==========================================');
|
||||
|
||||
$results = $this->ldap->search($this->container->getParameter('openldapreqgroup'), ['cn','description','gidNumber'], $this->ldap_basedn);
|
||||
foreach($results as $result) {
|
||||
$cn=$result["cn"];
|
||||
$ldapfilter="(&".$this->container->getParameter('openldapreqgroup')."(cn=$cn))";
|
||||
|
||||
$label=$result["cn"];
|
||||
$this->writeln(" - $label");
|
||||
if(!$simulate) $this->addmodGroup($label,$ldapfilter,false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->writeln('');
|
||||
$this->writeln('== USERS ============================================');
|
||||
@ -760,6 +776,12 @@ class SynchroCommand extends Command
|
||||
|
||||
protected function addmodGroup($label,$ldapfilter,$fgcanshare) {
|
||||
$portal_activate = $this->container->getParameter('portal_activate');
|
||||
$group=$this->em->getRepository('CadolesCoreBundle:Group')->findOneBy(array('fgtemplate' => false, 'label' => $label));
|
||||
if($group) {
|
||||
$this->writelnred(" - ".$label." existe déjà comme groupe interne à Ninegate");
|
||||
return 0;
|
||||
}
|
||||
|
||||
$group=$this->em->getRepository('CadolesCoreBundle:Group')->findOneBy(array('fgtemplate' => true, 'label' => $label));
|
||||
if(!$group) {
|
||||
$group=new Group();
|
||||
|
Reference in New Issue
Block a user