Code

Added ogroup acls
[gosa.git] / plugins / admin / ogroups / class_ogroup.inc
index 2e2faa8bc535f5355d0336a02df43056b1d3e737..3243c58552ffefc85ed3302c160eaa85e2853569 100644 (file)
@@ -85,12 +85,6 @@ class ogroup extends plugin
      $this->base = $_SESSION['CurrentMainBase'];
     }
 
-     /* set permissions */
-    $ui= get_userinfo();
-    $acl= get_permissions ($ui->dn, $ui->subtreeACL);
-    $this->acl= get_module_permission($acl, "ogroup", $ui->dn);
-
-
     /* Load member data */
     $this->reload();
   }
@@ -176,6 +170,12 @@ class ogroup extends plugin
     /* Load templating engine */
     $smarty= get_smarty();
 
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+
     /* Base select dialog */
     $once = true;
     foreach($_POST as $name => $value){
@@ -312,12 +312,6 @@ class ogroup extends plugin
     /* Fields */
     foreach ($this->attributes as $val){
       $smarty->assign("$val", $this->$val);
-      $smarty->assign("$val"."ACL", chkacl($this->acl, "$val"));
-    }
-
-    /* Assign ACL's */
-    foreach (array("base", "members") as $val){
-      $smarty->assign("$val"."ACL", chkacl($this->acl, "$val"));
     }
 
     return ($smarty->fetch (get_template_path('generic.tpl', TRUE)));
@@ -330,11 +324,6 @@ class ogroup extends plugin
     /* Save additional values for possible next step */
     if (isset($_POST['ogroupedit'])){
       plugin::save_object();
-
-      if (chkacl ($this->acl, "base") == "" && isset($_POST["base"])){
-        $this->base= $_POST["base"];
-      }
-
     }
   }
 
@@ -649,15 +638,13 @@ class ogroup extends plugin
       $message[]= _("There is already an object with this cn.");
     } 
 
-    $ui= get_userinfo();
-    $acl= get_permissions ($new_dn, $ui->subtreeACL);
-    $acl= get_module_permission($acl, "group", $new_dn);
-    if (chkacl($acl, "create") != ""){
+    print_a($this);
+    if ($this->acl_is_createable()){
       $message[]= _("You have no permissions to create a group on this 'Base'.");
     }
 
     /* must: cn */
-    if ($this->cn == "" && chkacl ($this->acl, "cn") == ""){
+    if ($this->cn == "" && $this->acl_is_writeable("cn")){
       $message[]= "The required field 'Name' is not set.";
     }
 
@@ -712,7 +699,7 @@ class ogroup extends plugin
     $this->handle_post_events($mode);
 
     $ret= 0;
-    if (show_ldap_error($ldap->get_error(), _("Saving object group failed"))){
+    if (show_ldap_error($ldap->get_error(), sprintf(_("Saving of object group/generic with dn '%s' failed."),$this->dn))){
       $ret= 1;
     }
 
@@ -725,7 +712,7 @@ class ogroup extends plugin
 
     $ldap= $this->config->get_ldap_link();
     $ldap->rmdir($this->dn);
-    show_ldap_error($ldap->get_error(), _("Removing object group failed"));
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of object group/generic with dn '%s' failed."),$this->dn));
 
     /* Trigger remove signal */
     $this->handle_post_events("remove");
@@ -745,6 +732,26 @@ class ogroup extends plugin
       $this->cn = $_POST['cn'];
     }
   }
+
+
+  function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Generic"),
+          "plDescription" => _("Object group generic"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 0,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("ogroups" => array("description"  => _("Object groups"),
+                                                      "objectClass"  => "gosaGroupOfNames")),
+          "plProvidedAcls"=> array(
+            "cn"                => _("Name"),
+            "base"              => _("Base"),
+            "description"       => _("Description"),
+            "member"            => _("Member"))
+          ));
+  }
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: