From: hickert Date: Mon, 23 Jan 2006 12:44:09 +0000 (+0000) Subject: Added some kolab acl stuff, instead of 'uid rights' now 'mail rights' X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b3bdddbe8f9921a1ddecf453f7ef1abab76ff556;p=gosa.git Added some kolab acl stuff, instead of 'uid rights' now 'mail rights' git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2543 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/groups/class_groupMail.inc b/plugins/admin/groups/class_groupMail.inc index ca5549fe3..85a800ef6 100644 --- a/plugins/admin/groups/class_groupMail.inc +++ b/plugins/admin/groups/class_groupMail.inc @@ -117,7 +117,8 @@ class mailgroup extends plugin } } - + + /* Update quota values */ if ($quota['gosaMailQuota'] == 2147483647){ $this->quotaUsage= ""; @@ -145,12 +146,46 @@ class mailgroup extends plugin } /* Load permissions */ - if (isset($this->attrs['acl'])){ - for ($i= 0; $i<$this->attrs['acl']['count']; $i++){ - list($user, $permission)= split(' ', $this->attrs['acl'][$i]); - $this->imapacl[$user]= $permission; - if ($user != "anyone" && $user != "%members%"){ - unset($this->imapacl['']); + if(preg_match("/kolab/i",$this->config->current['MAILMETHOD'])){ + + + /* In case of kolab, we save the permissions in this style + + mailaddressfromuser rights + + But we need the userID, so we search for a user, with this mail address. + */ + $ldap = $this->config->get_ldap_link(); + if (isset($this->attrs['acl'])){ + for ($i= 0; $i<$this->attrs['acl']['count']; $i++){ + list($user, $permission)= split(' ', $this->attrs['acl'][$i]); + + /* Skip entry anyone and %members %*/ + if ($user != "anyone" && $user != "%members%"){ + $mail = $ldap->search("(&(objectClass=person)(|(mail=".$user.")(uid=".$user.")))",array("uid")); + $mail = $ldap->fetch(); + if(isset($mail['uid'][0])){ + $user = $mail['uid'][0]; + } + } + + /* Add to list */ + $this->imapacl[$user]= $permission; + + #fixme What is that ? + if ($user != "anyone" && $user != "%members%"){ + unset($this->imapacl['']); + } + } + } + }else{ + if (isset($this->attrs['acl'])){ + for ($i= 0; $i<$this->attrs['acl']['count']; $i++){ + list($user, $permission)= split(' ', $this->attrs['acl'][$i]); + $this->imapacl[$user]= $permission; + if ($user != "anyone" && $user != "%members%"){ + unset($this->imapacl['']); + } } } } @@ -564,20 +599,37 @@ class mailgroup extends plugin /* Save shared folder target */ $this->attrs['gosaSharedFolderTarget']= "share+".$this->uid; - /* Save acl's */ - $this->attrs['acl']= array(); - foreach ($this->imapacl as $user => $acl){ - if ($user == ""){ - continue; + if(preg_match("/kolab/i",$this->config->current['MAILMETHOD'])){ + /* Save acl's */ + $this->attrs['acl']= array(); + foreach ($this->imapacl as $user => $acl){ + if ($user == ""){ + continue; + } + $ldap->search("(&(objectClass=person)(uid=".$user."))",array("mail")); + $mail = $ldap->fetch(); + if($mail){ + if(isset($mail['mail'][0])){ + $this->attrs['acl'][]= $mail['mail'][0]." $acl"; + } + }else{ + $this->attrs['acl'][]= "$user $acl"; + } + } + }else{ + /* Save acl's */ + $this->attrs['acl']= array(); + foreach ($this->imapacl as $user => $acl){ + if ($user == ""){ + continue; + } + $this->attrs['acl'][]= "$user $acl"; } - $this->attrs['acl'][]= "$user $acl"; } - /* Save data to LDAP */ $ldap->cd($this->dn); $ldap->modify($this->attrs); show_ldap_error($ldap->get_error()); - /* Only do IMAP actions if we are not a template */ if (!$this->is_template){ $method= new $this->method($this->config);