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();
$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") {
$this->writeln('');
@ -158,32 +147,6 @@ class SynchroUsersCommand extends Command
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
$this->writeln('');
$this->writeln('== OPTIONS ==========================================');
@ -416,6 +379,15 @@ class SynchroUsersCommand extends Command
$this->writeln('== GROUPS ============================================');
$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(!$group->getLdapfilter()) continue;
if(!in_array($group->getId(),$this->ldapgroups)) {
@ -444,23 +416,10 @@ class SynchroUsersCommand extends Command
$this->writeln('== SYNCHONISATION NINEGATE TO BUNDLE ================');
$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");
$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) {
$url="http://".$this->container->getParameter("appWeburl").$appmasterurl;
}
@ -482,6 +441,7 @@ class SynchroUsersCommand extends Command
}
catch (\Exception $e) {
// On tente avec le proxy s'il y en a un
echo "pouet";
$proxyUse = $this->container->getParameter("proxyUse");
if($proxyUse) {
$proxyHost = $this->container->getParameter("proxyHost");
@ -492,11 +452,11 @@ class SynchroUsersCommand extends Command
$response = \Unirest\Request::post($url.'/rest/login/'.$appmasterkey,$headers,$query);
}
catch (\Exception $e) {
die("Erreur de communication API = ".$e->getMessage()."\n");
die("Erreur de communication API with proxy $url = ".$e->getMessage()."\n");
}
}
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 ============================================');
$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();
}
}
if(!$group->getIdexternal()) continue;
if(!in_array($group->getIdexternal(),$lstgroups)) {

View File

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