sync primary group
This commit is contained in:
parent
4d0a6d92e7
commit
bdd3dd39b9
|
@ -639,8 +639,21 @@ class posixAccount extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// add user as memberuid in primary group
|
// add user as memberuid in primary group
|
||||||
if (!in_array($this->getGroupName($this->attributes['gidNumber'][0]), $this->groups)) {
|
$primaryGroupName = $this->getGroupName($this->attributes['gidNumber'][0]);
|
||||||
$this->groups[] = $this->getGroupName($this->attributes['gidNumber'][0]);
|
if (!in_array($primaryGroupName, $this->groups)) {
|
||||||
|
$this->groups[] = $primaryGroupName;
|
||||||
|
}
|
||||||
|
// add user as member in group of names if auto-sync is activated
|
||||||
|
if ($this->isBooleanConfigOptionSet('posixGroup_autoSyncGon')) {
|
||||||
|
$allGons = $this->findGroupOfNames();
|
||||||
|
foreach ($allGons as $gonDn => $gonData) {
|
||||||
|
if (in_array_ignore_case('posixGroup', $gonData['objectclass'])) {
|
||||||
|
$gonCn = $gonData['cn'][0];
|
||||||
|
if (($gonCn === $primaryGroupName) && !in_array($gonDn, $this->gonList)) {
|
||||||
|
$this->gonList[] = $gonDn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1034,6 +1047,21 @@ class posixAccount extends baseModule implements passwordService {
|
||||||
if (!empty($oldGroupName) && !empty($newGroupName)) {
|
if (!empty($oldGroupName) && !empty($newGroupName)) {
|
||||||
$this->groups = array_delete(array($oldGroupName), $this->groups);
|
$this->groups = array_delete(array($oldGroupName), $this->groups);
|
||||||
$this->groups[] = $newGroupName;
|
$this->groups[] = $newGroupName;
|
||||||
|
// sync group of names if needed
|
||||||
|
if ($this->isBooleanConfigOptionSet('posixGroup_autoSyncGon')) {
|
||||||
|
$allGons = $this->findGroupOfNames();
|
||||||
|
foreach ($allGons as $gonDn => $gonData) {
|
||||||
|
if (in_array_ignore_case('posixGroup', $gonData['objectclass'])) {
|
||||||
|
$gonCn = $gonData['cn'][0];
|
||||||
|
if (($gonCn === $newGroupName) && !in_array($gonDn, $this->gonList)) {
|
||||||
|
$this->gonList[] = $gonDn;
|
||||||
|
}
|
||||||
|
if (($gonCn === $oldGroupName) && in_array($gonDn, $this->gonList)) {
|
||||||
|
$this->gonList = array_delete(array($gonDn), $this->gonList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue