From a4e320805e40628e038968f60755bb0697049dad Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 22 Nov 2007 09:06:56 +0000 Subject: [PATCH] Update shared folder when a user updates his mailAccount plugin. -If he removes the mail extension from his account, then remove the acl entry from all sharedFolder too. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7848 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/personal/mail/class_mailAccount.inc | 26 +++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/plugins/personal/mail/class_mailAccount.inc b/plugins/personal/mail/class_mailAccount.inc index ba53438af..5f1056d6a 100644 --- a/plugins/personal/mail/class_mailAccount.inc +++ b/plugins/personal/mail/class_mailAccount.inc @@ -761,6 +761,9 @@ class mailAccount extends plugin } } + /* Update shared folder membership, ACL may need to be updated */ + $this->updateSharedFolder(); + /* Optionally execute a command after we're done */ $this->handle_post_events("remove", array('uid'=> $this->uid)); } @@ -924,6 +927,7 @@ class mailAccount extends plugin $this->handle_post_events("add", array('uid'=>$this->uid)); } + $this->updateSharedFolder(); } @@ -1152,6 +1156,28 @@ class mailAccount extends plugin } } } + + /* Upated shared folder ACLs + */ + function updateSharedFolder() + { + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->search("(&(objectClass=posixGroup)(objectClass=gosaMailAccount)(memberUid=".$this->uid."))",array('dn','cn')); + if(class_exists("grouptabs")){ + while($attrs = $ldap->fetch()){ + $tmp = new grouptabs($this->config, $this->config->data['TABS']['GROUPTABS'], $attrs['dn']); + if(isset($tmp->by_object['mailgroup'])){ + $tmp->by_object['mailgroup']->members= $tmp->by_object['group']->memberUid; + if(!$this->is_account){ + $tmp->by_object['mailgroup']->removeUserAcl($this->uid); + $tmp->by_object['mailgroup']->removeUserAcl($this->mail); + } + $tmp->by_object['mailgroup']->save(); + } + } + } + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -- 2.30.2