Merge branch 'master' into dist/envole/6/master

This commit is contained in:
Arnaud Fornerot 2021-02-24 10:55:33 +01:00
commit 69848cf0cf
2 changed files with 20 additions and 0 deletions

View File

@ -79,6 +79,7 @@ class SynchroCommand extends Command
$ldap_member = strtolower($this->container->getParameter('ldap_member'));
$scribe_group = strtolower($this->container->getParameter('scribe_group'));
$ldap_type = $this->container->getParameter('ldap_type');
$ldap_template = $this->container->getParameter('ldap_template');
$ldap_usersadmin = $this->container->getParameter('ldap_usersadmin');
$scribe_master = strtolower($this->container->getParameter('scribe_master'));
@ -633,10 +634,13 @@ class SynchroCommand extends Command
$dn=$this->ldap->getNiveau01DN($data->getLabel());
$attrs["memberuid"]=array();
$attrs["cadolesMember"]=array();
if($ldap_type=="AD") $attrs["member"]=array();
foreach($data->getUsers() as $userniveau01) {
array_push($attrs["memberuid"],$userniveau01->getUsername());
array_push($attrs["cadolesMember"],$this->ldap->getUserDN($userniveau01));
if($ldap_type=="AD") array_push($attrs["member"],$this->ldap->getUserDN($userniveau01));
$this->writeln(' > '.$userniveau01->getUsername());
}
if(!$simulate) $this->ldap->ldapModify($dn, $attrs);
@ -664,10 +668,13 @@ class SynchroCommand extends Command
$dn=$this->ldap->getNiveau02DN($data->getLabel());
$attrs["memberuid"]=array();
$attrs["cadolesMember"]=array();
if($ldap_type=="AD") $attrs["member"]=array();
foreach($data->getUsers() as $userniveau01) {
array_push($attrs["memberuid"],$userniveau01->getUsername());
array_push($attrs["cadolesMember"],$this->ldap->getUserDN($userniveau01));
if($ldap_type=="AD") array_push($attrs["member"],$this->ldap->getUserDN($userniveau01));
$this->writeln(' > '.$userniveau01->getUsername());
}
if(!$simulate) $this->ldap->ldapModify($dn, $attrs);
@ -696,11 +703,14 @@ class SynchroCommand extends Command
$dn=$this->ldap->getGroupDN($data->getLabel());
$attrs["memberuid"]=array();
$attrs["cadolesMember"]=array();
if($ldap_type=="AD") $attrs['member']=array();
foreach($data->getUsers() as $usergroupe) {
if(!in_array($usergroupe->getUser()->getUsername(), $attrs["memberuid"])) {
array_push($attrs["memberuid"],$usergroupe->getUser()->getUsername());
array_push($attrs["cadolesMember"],$this->ldap->getUserDN($usergroupe->getUser()));
if($ldap_type=="AD") array_push($attrs["member"],$this->ldap->getUserDN($usergroupe->getUser()));
$this->writeln(' > '.$usergroupe->getUser()->getUsername());
}
else {

View File

@ -241,6 +241,7 @@ class ldapService
$dn = $this->getNiveau01DN($result["cn"]);
$entry['memberuid'] = $user->getUsername();
$entry['cadolesMember'] = $this->getUserDN($user);
if($this->type=="AD") $entry['member'] = $this->getUserDN($user);
$result = ldap_mod_del($connection, $dn, $entry);
if(!$result) $this->ldapError();
@ -257,6 +258,7 @@ class ldapService
$dn = $this->getNiveau01DN($user->getNiveau01()->getLabel());
$entry['memberuid'] = $user->getUsername();
$entry['cadolesMember'] = $this->getUserDN($user);
if($this->type=="AD") $entry['member'] = $this->getUserDN($user);
$result = ldap_mod_add($connection, $dn, $entry);
if(!$result) $this->ldapError();
@ -273,6 +275,8 @@ class ldapService
$dn = $this->getNiveau02DN($result["cn"]);
$entry['memberuid'] = $user->getUsername();
$entry['cadolesMember'] = $this->getUserDN($user);
if($this->type=="AD") $entry['member'] = $this->getUserDN($user);
$result = ldap_mod_del($connection, $dn, $entry);
if(!$result) $this->ldapError();
}
@ -289,6 +293,8 @@ class ldapService
$dn = $this->getNiveau02DN($user->getNiveau02()->getLabel());
$entry['memberuid'] = $user->getUsername();
$entry['cadolesMember'] = $this->getUserDN($user);
if($this->type=="AD") $entry['member'] = $this->getUserDN($user);
$result = ldap_mod_add($connection, $dn, $entry);
if(!$result) $this->ldapError();
}
@ -652,6 +658,8 @@ class ldapService
$dn = $this->getGroupDN($usergroup->getGroup()->getLabel());
$entry['memberuid'] = $usergroup->getUser()->getUsername();
$entry['cadolesMember'] = $this->getUserDN($usergroup->getUser());
if($this->type=="AD") $entry['member'] = $this->getUserDN($usergroup->getUser());
$result = ldap_mod_add($connection, $dn, $entry);
if(!$result) $this->ldapError();
}
@ -673,6 +681,8 @@ class ldapService
$dn = $this->getGroupDN($usergroup->getGroup()->getLabel());
$entry['memberuid'] = $usergroup->getUser()->getUsername();
$entry['cadolesMember'] = $this->getUserDN($usergroup->getUser());
if($this->type=="AD") $entry['member'] = $this->getUserDN($usergroup->getUser());
$result = ldap_mod_del($connection, $dn, $entry);
if(!$result) $this->ldapError();
}