Compare commits

..

No commits in common. "88f44d5ed675121ef101e5b849ce55537b0f3789" and "61f48af4800305333ca4461335ea439628b7d1ed" have entirely different histories.

2 changed files with 24 additions and 55 deletions

View File

@ -102,17 +102,6 @@ class SynchroUsersCommand extends Command
$ldapusers = array(); $ldapusers = array();
$ldapmails = array(); $ldapmails = array();
// Suppression des groupe ninegate
$groups=$this->em->getRepository("App:Group")->findAll();
foreach($groups as $group) {
if($group->getIdexternal()) {
$this->writeln(" - Suppression dans Bundle >> ".$group->getName());
if(!$simulate) {
$this->em->remove($group);
$this->em->flush();
}
}
}
if($ldap_model=="scribe") { if($ldap_model=="scribe") {
$this->writeln(''); $this->writeln('');
@ -158,32 +147,6 @@ class SynchroUsersCommand extends Command
if(!$simulate) $this->addmodGroup($label,$ldapfilter,true); if(!$simulate) $this->addmodGroup($label,$ldapfilter,true);
} }
// Elèves des Classes
$this->writeln('');
$this->writeln('== ELEVES DES CLASSES ==========================================');
$results = $this->ldap->search("type=Classe", ['cn','description','gidNumber'], $this->ldap_basedn);
foreach($results as $result) {
$cn=$result["cn"];
$ldapfilter="(&(type=Classe)(cn=$cn))";
$label="ELEVES - ".$result["cn"];
$this->writeln(" - $label");
if(!$simulate) $this->addmodGroup($label,$ldapfilter,false);
}
// Professeurs des Classes
$this->writeln('');
$this->writeln('== PROFESSEURS DES CLASSES ==========================================');
$results = $this->ldap->search("type=Classe", ['cn','description','gidNumber'], $this->ldap_basedn);
foreach($results as $result) {
$cn=$result["cn"];
$ldapfilter="(|(&(type=Equipe)(cn=profs-$cn))(&(ENTPersonProfils=Administratif)(divcod=$cn)))";
$label="PROFESSEURS - ".$result["cn"];
$this->writeln(" - $label");
if(!$simulate) $this->addmodGroup($label,$ldapfilter,false);
}
// Options // Options
$this->writeln(''); $this->writeln('');
$this->writeln('== OPTIONS =========================================='); $this->writeln('== OPTIONS ==========================================');
@ -416,6 +379,15 @@ class SynchroUsersCommand extends Command
$this->writeln('== GROUPS ============================================'); $this->writeln('== GROUPS ============================================');
$groups=$this->em->getRepository("App:Group")->findAll(); $groups=$this->em->getRepository("App:Group")->findAll();
foreach($groups as $group) { foreach($groups as $group) {
if($group->getIdexternal()) {
$this->writeln(" - Suppression dans Bundle >> ".$group->getName());
if(!$simulate) {
$this->em->remove($group);
$this->em->flush();
}
}
if(!$group->getLdapfilter()) continue; if(!$group->getLdapfilter()) continue;
if(!in_array($group->getId(),$this->ldapgroups)) { if(!in_array($group->getId(),$this->ldapgroups)) {
@ -444,23 +416,10 @@ class SynchroUsersCommand extends Command
$this->writeln('== SYNCHONISATION NINEGATE TO BUNDLE ================'); $this->writeln('== SYNCHONISATION NINEGATE TO BUNDLE ================');
$this->writeln('====================================================='); $this->writeln('=====================================================');
// Suppression des groupe annuaire
$groups=$this->em->getRepository("App:Group")->findAll();
foreach($groups as $group) {
if($group->getLdapfilter()) {
$this->writeln(" - Suppression dans Bundle >> ".$group->getName());
if(!$simulate) {
$this->em->remove($group);
$this->em->flush();
}
}
}
$appmasterurl = $this->container->getParameter("appMasterurl"); $appmasterurl = $this->container->getParameter("appMasterurl");
$appmasterkey = $this->container->getParameter("appMasterkey"); $appmasterkey = $this->container->getParameter("appMasterkey");
// Généraltion de l'urol de communication // Généraltion de l'url de communication
if(stripos($appmasterurl,"/")===0) { if(stripos($appmasterurl,"/")===0) {
$url="http://".$this->container->getParameter("appWeburl").$appmasterurl; $url="http://".$this->container->getParameter("appWeburl").$appmasterurl;
} }
@ -482,6 +441,7 @@ class SynchroUsersCommand extends Command
} }
catch (\Exception $e) { catch (\Exception $e) {
// On tente avec le proxy s'il y en a un // On tente avec le proxy s'il y en a un
echo "pouet";
$proxyUse = $this->container->getParameter("proxyUse"); $proxyUse = $this->container->getParameter("proxyUse");
if($proxyUse) { if($proxyUse) {
$proxyHost = $this->container->getParameter("proxyHost"); $proxyHost = $this->container->getParameter("proxyHost");
@ -492,11 +452,11 @@ class SynchroUsersCommand extends Command
$response = \Unirest\Request::post($url.'/rest/login/'.$appmasterkey,$headers,$query); $response = \Unirest\Request::post($url.'/rest/login/'.$appmasterkey,$headers,$query);
} }
catch (\Exception $e) { catch (\Exception $e) {
die("Erreur de communication API = ".$e->getMessage()."\n"); die("Erreur de communication API with proxy $url = ".$e->getMessage()."\n");
} }
} }
else { else {
die("Erreur de communication API = ".$e->getMessage()."\n"); die("Erreur de communication API without proxy $url = ".$e->getMessage()."\n");
} }
} }
@ -664,6 +624,15 @@ class SynchroUsersCommand extends Command
$this->writeln('== GROUPS ============================================'); $this->writeln('== GROUPS ============================================');
$groups=$this->em->getRepository("App:Group")->findAll(); $groups=$this->em->getRepository("App:Group")->findAll();
foreach($groups as $group) { foreach($groups as $group) {
if($group->getLdapfilter()) {
$this->writeln(" - Suppression dans Bundle >> ".$group->getName());
if(!$simulate) {
$this->em->remove($group);
$this->em->flush();
}
}
if(!$group->getIdexternal()) continue; if(!$group->getIdexternal()) continue;
if(!in_array($group->getIdexternal(),$lstgroups)) { if(!in_array($group->getIdexternal(),$lstgroups)) {

View File

@ -76,8 +76,8 @@ LDAP_USERNAME=uid
LDAP_FIRSTNAME=givenname LDAP_FIRSTNAME=givenname
LDAP_LASTNAME=sn LDAP_LASTNAME=sn
LDAP_EMAIL=mail LDAP_EMAIL=mail
LDAP_FILTERGROUP='(&(ObjectClass=posixGroup)(cn=*))' LDAP_FILTERGROUP=(cn=*)
LDAP_FILTERUSER='(&(ObjectClass=person)(uid=*))' LDAP_FILTERUSER=(uid=*)
%else %else
LDAP_USERNAME=%%ninesurvey_ldapuid LDAP_USERNAME=%%ninesurvey_ldapuid
LDAP_FIRSTNAME=%%ninesurvey_ldapfirstname LDAP_FIRSTNAME=%%ninesurvey_ldapfirstname