index 3dbdf1b6265d52b427af43d320e252e48d39b1ea..edde1af9411fabee4e29d35906e97df24c55fa2b 100644 (file)
}
}
}
-
- /* In this section we dectect which acl is tho most used
- This will be used as %members% acl
- */
- $tmp2 = array();
- foreach($tmp as $acl => $user){
- $tmp2[count($tmp[$acl])]=$acl;
- }
- /* Most used at last
- */
- ksort($tmp2);
-
- /* Assign last (most used acl) to %members% acl
- */
- $str = array_pop($tmp2);
- if(!empty($str)) {
- $this->imapacl['%members%']=$str;
- }
-
- /* Open ldap connection
- */
- $ldap = $this->config->get_ldap_link();
- $ldap->cd($this->config->current['BASE']);
-
- /* Remove those users, that use %members% acl && are member of this group. */
- foreach($this->imapacl as $mail => $permission){
- $ldap->search("(&(objectClass=person)(mail=".$mail."))",array("uid"));
- $atr = $ldap->fetch();
- if((isset($this->attrs['memberUid'])) && (is_array($this->attrs['memberUid']))){
- if((isset($atr['uid'][0]))&&(in_array($atr['uid'][0],$this->attrs['memberUid']))&&($permission == $this->imapacl['%members%'])){
- unset($this->imapacl[$mail]);
- }
+ }else{
+ foreach($this->imapacl as $user => $permission){
+ if ($user != "anyone" && $user != "%members%"){
+ $tmp[$permission][] = $user;
+ }
+ if ($user != "anyone" && $user != "%members%"){
+ unset($this->imapacl['']);
}
}
- /* Append an empty entry, for special acl handling */
- if(count($this->imapacl)==2){
- $this->imapacl[''] ="";
- }
-
- }else{ // Not kolab
- /* 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['']);
- }
+ }
+
+
+ /**
+ * Detect group member with same acl and replace them with %members%
+ **/
+
+ /* In this section we dectect which acl is tho most used
+ This will be used as %members% acl
+ */
+ $tmp2 = array();
+ foreach($tmp as $acl => $user){
+ $tmp2[count($tmp[$acl])]=$acl;
+ }
+ /* Most used at last
+ */
+ ksort($tmp2);
+
+ /* Assign last (most used acl) to %members% acl
+ */
+ $str = array_pop($tmp2);
+ if(!empty($str)) {
+ $this->imapacl['%members%']=$str;
+ }
+
+ /* Open ldap connection
+ */
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd($this->config->current['BASE']);
+
+ /* Remove those users, that use %members% acl && are member of this group. */
+ foreach($this->imapacl as $mail => $permission){
+ $ldap->search("(&(objectClass=person)(|(mail=".$mail.")(uid=".$mail.")))",array("uid"));
+ $atr = $ldap->fetch();
+ if((isset($this->attrs['memberUid'])) && (is_array($this->attrs['memberUid']))){
+ if((isset($atr['uid'][0]))&&(in_array($atr['uid'][0],$this->attrs['memberUid']))&&($permission == $this->imapacl['%members%'])){
+ unset($this->imapacl[$mail]);
}
}
}
+ /**
+ * ENDE: Detect group member with same acl and replace them with %members%
+ **/
+
+
+ /* Append an empty entry, for special acl handling */
+ if(count($this->imapacl)==2){
+ $this->imapacl[''] ="lrsw";
+ $this->indexed_user[] = '';
+ }
+
/* Load Mailserver
*/
if(isset($this->attrs['gosaMailServer'][0])){
/* Add ACL? */
if (isset($_POST["add_acl"])){
- $this->imapacl[""]= "l";
+ $this->imapacl[""]= "lrsw";
+ $this->indexed_user[] = "";
}
foreach ($this->indexed_user as $nr => $user){
if (isset($_POST["del_$nr"])){
$tmp.= "</select> ";
if ($nr == $count - 1){
}
- if ($count > 3){
+ if ($count > 2){
$tmp.= "<input type=submit value=\""._("Remove")."\" ".
"name=\"del_$nr\" $perm></td></tr>";
}
$this->is_modified= TRUE;
}
$this->imapacl[$_POST["user_$nr"]]= $_POST["perm_$nr"];
+ $this->indexed_user[$nr] = $_POST["user_$nr"];
}
}
}
/* In case of kolab methods add acl attribute too */
if(preg_match("/olab/i",$this->mmethod)){
$this->attrs['acl'][]= $name." ".$acl;
+ unset($this->imapacl[$user]);
}
$this->imapacl[$name] = $acl;
}else{
$this->imapacl[$user] = $acl;
}
}
-
+
if ((!$this->is_template)&&(!empty($this->gosaMailServer))){
$method= new $this->method($this->config);
$method->fixAttributesOnStore($this);