Code

Updated Mail Account ACLs
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 9 Dec 2008 11:52:08 +0000 (11:52 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 9 Dec 2008 11:52:08 +0000 (11:52 +0000)
-Ensure that GOsa keep unknown ACL settings.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13202 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/kolab/personal/mail/kolab/class_mail-methods-kolab22.inc
gosa-plugins/mail/admin/groups/mail/class_groupMail.inc
gosa-plugins/mail/personal/mail/class_mail-methods-cyrus.inc
gosa-plugins/mail/personal/mail/class_mail-methods.inc

index 6b78f4653c3f92442cf62c50c082a38e2cb7eb76..19835b188f863448c6eff7857c790016f5b7f6a3 100644 (file)
@@ -27,23 +27,6 @@ class mailMethodKolab22 extends mailMethodKolab
   {
     return(array("gonicus.de"));
   } 
-
-
-  /*! \brief  Returns a list of all possible acls.
-      @return Array   ACLs.
-  */
-  public function getAclTypes()
-  {
-    $acls["lrsw"]     = _("read");
-    $acls["lrswp"]    = _("post");
-    $acls["p"]        = _("external post");
-    $acls["lrswip"]   = _("append");
-    $acls["lrswipcd"] = _("write");
-    $acls["lrswipcda"]= _("admin");
-    $acls["lrswipkxtecda"]= _("super-admin");
-    $acls[" "]= _("none");
-    return($acls);
-  }
 }
 
 
index 557537538018df33b001ed23116e26142efdc181..c829a64e899ac8abadf99dccbaf20d97a0da7fe1 100644 (file)
@@ -52,7 +52,6 @@ class mailgroup extends plugin
     $this->mailMethod->fixAttributesOnLoad();
     $this->mailDomainParts      = $this->mailMethod->getMailDomains();
     $this->AvailableFolderTypes = $this->mailMethod->getAvailableFolderTypes();
-    $this->AclTypes             = $this->mailMethod->getAclTypes();
     $this->MailBoxes = array();
 
     /* Remember account status
@@ -149,6 +148,7 @@ class mailgroup extends plugin
     /* Disconnect mailMethod. Connect on demand later.
      */
     $this->mailMethod->disconnect();
+    $this->AclTypes = $this->mailMethod->getAclTypes();
 
     /* Summarize most used ACLs as member acl 
      */
index 147a5d1f49cf1aba372d6de11ee6106f470d8b8b..5f958c9304229fb9b9a02cb455e10b6f78ed3118 100644 (file)
@@ -337,6 +337,15 @@ class mailMethodCyrus extends mailMethod{
       $folder_acls[$user] = $acl;
     }
 
+    /* Merge given ACL with acl mapping
+       This ensures that no ACL will accidentally overwritten by gosa.
+     */
+    foreach($folder_acls as $user => $acl){
+      if(!isset($this->acl_mapping[$acl])){
+        $this->acl_mapping[$acl] = $acl;
+      }
+    }
+
     return($folder_acls);
   }
 
index 3d5698a947041a7f81bbc4530ff7bf6ba5d8fa8d..7490d8c3fc2fdefcbc142d8f76f931d10554bdbc 100644 (file)
@@ -43,6 +43,18 @@ class mailMethod{
   protected $error              = "";
   protected $parent             = NULL;   
   protected $MailServer         = "";
+
+
+  protected $acl_map = array(
+      "lrsw"     => "read",
+      "lrswp"    => "post",
+      "p"        => "external post",
+      "lrswip"   => "append",
+      "lrswipcd" => "write",
+      "lrswipcda"=> "admin",
+      " "         => "none");
+
+  protected $acl_mapping = array();
  
 
   /*! \brief  Constructs the mail class 
@@ -98,6 +110,12 @@ class mailMethod{
             sprintf(_("The configured mail attribute '%s' is unsupported!"), $new_uattrib), ERROR_DIALOG);
       }
     }
+
+    /* Create ACL map */
+    foreach($this->acl_map as $acl => $name){
+      $this->acl_mapping[$acl] = _($name);
+    }
+
     $this->build_account_id();
     $this->initial_account_id = $this->account_id;
   }
@@ -591,13 +609,8 @@ class mailMethod{
   public function getAvailableFolderTypes()
   {
     $ret = array();
-    $ret['CAT']['mail'] = _("Mail"); 
-    $ret['CAT']['peter']= _("User"); 
-    $ret['SUB_CAT']['mail']['a'] = "a";
-    $ret['SUB_CAT']['mail']['b'] = "b";
-    $ret['SUB_CAT']['peter']['tt'] = "tt";
-    $ret['SUB_CAT']['peter']['dd'] = "dd";
-    $ret['SUB_CAT']['peter']['did'] = "did";
+    $ret['CAT'][''] = _("None"); 
+    $ret['SUB_CAT'][''][''] = _("None");
     return($ret);
   }
 
@@ -608,12 +621,7 @@ class mailMethod{
    */
   public function getFolderType($default)
   {
-    if($this->enableFolderTypes && $this->parent->attrs['kolabFolderType'][0]){
-      list($cat,$sub) = split("\.",$this->parent->attrs['kolabFolderType'][0]);
-      return(array("CAT" => $cat, "SUB_CAT" => $sub));
-    }else{
-      return($default);
-    }
+    return($default);
   }
 
  
@@ -623,10 +631,7 @@ class mailMethod{
    */
   public function setFolderType($type)
   {
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd ($this->parent->dn);
-    $ldap->modify(array("kolabFolderType" => $type['CAT'].".".$type['SUB_CAT']));
-    echo "Move me to KOLAB";
+    return(TRUE) ;   
   }
 
 
@@ -634,6 +639,15 @@ class mailMethod{
    */
   public function  getFolderACLs($folder_acls)
   {
+    /* Merge given ACL with acl mapping 
+       This ensures that no ACL will accidentally overwritten by gosa.
+     */
+    foreach($folder_acls as $user => $acl){
+      if(!isset($this->acl_mapping[$acl])){
+        $this->acl_mapping[$acl] = $acl;
+      }
+    }
+
     return($folder_acls);
   }
 
@@ -651,14 +665,7 @@ class mailMethod{
   */
   public function getAclTypes()
   {
-    $acls["lrsw"]     = _("read");
-    $acls["lrswp"]    = _("post");
-    $acls["p"]        = _("external post");
-    $acls["lrswip"]   = _("append");
-    $acls["lrswipcd"] = _("write");
-    $acls["lrswipcda"]= _("admin");
-    $acls[" "]= _("none");
-    return($acls);
+    return( $this->acl_mapping);
   }
 
   public function folderTypesEnabled()