From 53413791f74aeeb8d8ab257dbbad55c55c59599e Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 9 Mar 2006 11:24:40 +0000 Subject: [PATCH] Only save complete tab, if group is mailGroup git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2832 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/personal/posix/class_posixAccount.inc | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/plugins/personal/posix/class_posixAccount.inc b/plugins/personal/posix/class_posixAccount.inc index 4df3640f4..a5498c798 100644 --- a/plugins/personal/posix/class_posixAccount.inc +++ b/plugins/personal/posix/class_posixAccount.inc @@ -850,22 +850,37 @@ $ldap->modify ($this->attrs); $g->save (); } } - + /* Take care about groupMembership values: add to groups */ foreach ($this->groupMembership as $key => $value){ - $g= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $key); - $g->by_object['group']->addUser ($this->uid); + $g= new group($this->config, $key); + $g->addUser ($this->uid); $g->save(); - } - /* Remove from groups not listed in groupMembership */ - foreach ($this->savedGroupMembership as $key => $value){ - if (!array_key_exists ($key, $this->groupMembership)){ + /* May need to save the mail part, too */ + if ($g->has_mailAccount){ $g= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $key); $g->by_object['group']->removeUser ($this->uid); $g->save(); } } + + /* Remove from groups not listed in groupMembership */ + foreach ($this->savedGroupMembership as $key => $value){ + if (!isset($this->groupMembership[$key])){ + + $g= new group($this->config, $key); + $g->removeUser ($this->uid); + $g->save(); + + /* May need to save the mail part, too */ + if ($g->has_mailAccount){ + $g= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $key); + $g->by_object['group']->removeUser ($this->uid); + $g->save(); + } + } + } /* Optionally execute a command after we're done */ if ($this->initially_was_account == $this->is_account){ -- 2.30.2