switch primary group in additional group memberships (RFE 108)

This commit is contained in:
Roland Gruber 2013-10-23 17:26:00 +00:00
parent 1710cd8b40
commit 0f1bd1b550
1 changed files with 9 additions and 0 deletions

View File

@ -988,6 +988,15 @@ class posixAccount extends baseModule implements passwordService {
$errorMessage = $this->messages['gidNumber'][2];
$errorMessage[] = array($this->orig['gidNumber'][0], $this->orig['uidNumber'][0], $_POST['gidNumber']);
$errors[] = $errorMessage;
if ($this->isBooleanConfigOptionSet('posixAccount_primaryGroupAsSecondary') && !empty($this->attributes['gidNumber'][0])) {
// change primary group in $this->groups
$oldGroupName = $this->getGroupName($this->attributes['gidNumber'][0]);
$newGroupName = $this->getGroupName($_POST['gidNumber']);
if (!empty($oldGroupName) && !empty($newGroupName)) {
$this->groups = array_delete(array($oldGroupName), $this->groups);
$this->groups[] = $newGroupName;
}
}
}
if (isset($this->orig['uidNumber'][0]) && $this->orig['uidNumber'][0]!='' && trim($_POST['uidNumber'])!=$this->attributes['uidNumber'][0]) {
$errorMessage = $this->messages['uidNumber'][5];