From: hickert Date: Thu, 22 Nov 2007 09:02:41 +0000 (+0000) Subject: Fixed groupMail saving. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8d462dbccc73a4a5059243ae5d10e571bfb4c10d;p=gosa.git Fixed groupMail saving. Acl were generated and then resetted again, via $this->attrs['acl'] = array(); -Removed duplicated code. -Fixed acl assignement. -- When a member of the mail group, has toggled his mailAccount from inactive to active, the acl entry wasn't updated. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7847 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/groups/class_groupMail.inc b/plugins/admin/groups/class_groupMail.inc index 8b5fa3c81..58c2a5e66 100644 --- a/plugins/admin/groups/class_groupMail.inc +++ b/plugins/admin/groups/class_groupMail.inc @@ -778,21 +778,41 @@ I: Only insider delivery */ $this->attrs['gosaMailForwardingAddress'] = $this->gosaMailForwardingAddress; $this->attrs['gosaSharedFolderTarget'] = "share+".$this->uid; + /* Only do IMAP actions if we are not a template */ + if(preg_match("/olab/i",$this->mmethod)){ + if (empty($this->gosaMailServer)||is_array($this->gosaMailServer)){ + if(isset($this->attrs['gosaMailServer'][0])){ + $this->gosaMailServer = $this->attrs['gosaMailServer'][0]; + } + } + } + + /* Exchange '%member%' pseudo entry */ + $memberacl= $this->imapacl['%members%']; + + foreach ($this->members as $user){ + if (!isset($this->imapacl[$user])){ + $this->imapacl[$user]= $memberacl; + } + } + if(preg_match("/olab/i",$this->mmethod)){ + /* Save acl's */ $this->attrs['acl']= array(); foreach ($this->imapacl as $user => $acl){ - if ($user == ""){ + if ($user == "" || preg_match("/%members%/",$user)){ continue; } $ldap->search("(&(objectClass=person)(|(uid=".$user.")(mail=".$user.")))",array("mail")); $mail = $ldap->fetch(); - if($mail){ - if(isset($mail['mail'][0])){ - $this->attrs['acl'][]= $mail['mail'][0]." $acl"; - } + if(isset($mail['mail'][0])){ + $sacl = $mail['mail'][0]." ".$acl; }else{ - $this->attrs['acl'][]= "$user $acl"; + $sacl= "$user $acl"; + } + if(!in_array($sacl,$this->attrs['acl'])){ + $this->attrs['acl'][]= $sacl; } } @@ -802,63 +822,17 @@ I: Only insider delivery */ $this->attrs['kolabFolderType'] = array(); } }else{ + /* Save acl's */ $this->attrs['acl']= array(); foreach ($this->imapacl as $user => $acl){ - if ($user == ""){ + if ($user == "" || preg_match("/%members%/",$user)){ continue; } $this->attrs['acl'][]= "$user $acl"; } } - /* Only do IMAP actions if we are not a template */ - if(preg_match("/olab/i",$this->mmethod)){ - if (empty($this->gosaMailServer)||is_array($this->gosaMailServer)){ - if(isset($this->attrs['gosaMailServer'][0])){ - $this->gosaMailServer = $this->attrs['gosaMailServer'][0]; - } - } - } - - - /* Exchange '%member%' pseudo entry */ - $memberacl= $this->imapacl['%members%']; - - foreach ($this->members as $user){ - if(preg_match("/olab/i",$this->mmethod)){ - $ldap->cd($this->config->current['BASE']); - $ldap->search("(&(objectClass=person)(|(mail=".$user.")(uid=".$user.")))",array("mail")); - $at = $ldap->fetch(); - if(isset($at['mail'][0])){ - $user = $at['mail'][0]; - } - } - if (!isset($this->imapacl[$user])){ - $this->imapacl[$user]= $memberacl; - } - } - $this->attrs['acl'] = array(); - - - foreach($this->imapacl as $user => $acl){ - - /* Remove empty user entry, to avoid entry like this im imap - * "" lrs - */ - if(empty($user)){ - unset($this->imapacl[$user]); - } - - /* Skip invalid values */ - if(preg_match("/%members%/",$user) || empty($user)){ - continue; - } - - /* Append ldap acl entries */ - $this->attrs['acl'][] = $user." ".$acl; - } - if ((!$this->is_template)&&(!empty($this->gosaMailServer))){ $method= new $this->method($this->config); $method->fixAttributesOnStore($this); @@ -1079,6 +1053,17 @@ I: Only insider delivery */ /* Reset alternate mail addresses */ $this->gosaMailAlternateAddress = array(); } + + + /* Remove given ACL for given member (uid,mail) .. + */ + function removeUserAcl($index ) + { + if(isset($this->imapacl[$index])){ + unset($this->imapacl[$index]); + } + } + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?>