Code

Checked and fixed department acl
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 2 Dec 2005 13:20:07 +0000 (13:20 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 2 Dec 2005 13:20:07 +0000 (13:20 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2208 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/departments/class_departmentGeneric.inc
plugins/admin/departments/class_departmentManagement.inc
plugins/admin/groups/acl_definition.inc

index 74e871a5b5c650d719e7f2a1c2170bfbac53a962..afa6e2744fa614fa12cdeccee17141b40c69b41e 100644 (file)
@@ -43,75 +43,84 @@ class department extends plugin
 
   function department ($config, $dn)
   {
-       plugin::plugin($config, $dn);
-       $this->is_account= TRUE;
-       $this->ui= get_userinfo();
-       $this->dn= $dn;
-       $this->orig_dn= $dn;
-       $this->config= $config;
-
-       /* Set base */
-    if ($this->dn == "new"){
-               $ui= get_userinfo();
-               if(isset($_SESSION['depfilter']['depselect'])){
-                       $this->base = $_SESSION['depfilter']['depselect'];
-               }else{
-                       $this->base= dn2base($ui->dn);
-               }
-       } else {
-                $this->base= preg_replace ("/^[^,]+,/", "", $this->dn);
-        }
+
+         plugin::plugin($config, $dn);
+         $this->is_account= TRUE;
+         $this->ui= get_userinfo();
+         $this->dn= $dn;
+         $this->orig_dn= $dn;
+         $this->config= $config;
+
+         /* Set base */
+         if ($this->dn == "new"){
+                 $ui= get_userinfo();
+                 if(isset($_SESSION['depfilter']['depselect'])){
+                         $this->base = $_SESSION['depfilter']['depselect'];
+                 }else{
+                         $this->base= dn2base($ui->dn);
+                 }
+         } else {
+                 $this->base= preg_replace ("/^[^,]+,/", "", $this->dn);
+         }
+         /* set permissions */
+         $ui= get_userinfo();
+         $acl= get_permissions ($ui->dn, $ui->subtreeACL);
+         $this->acl= get_module_permission($acl, "department", $ui->dn);
   }
 
   function execute()
   {
-       /* Call parent execute */
-       plugin::execute();
-
-       /* Reload departments */
-       $this->config->departments= get_departments($this->dn);
-       $this->config->make_idepartments();
-       $smarty= get_smarty();
-
-       /* Hide all departments, that are subtrees of this department */
-       $bases  = $this->config->idepartments;
-       $tmp    = array();      
-       foreach($bases as $dn=>$base){
-               $fixed = str_replace("/","\\",$this->dn);
-               /* Only attach departments which are not a subtree of this one */
-               if(!preg_match("/".$fixed."/",$dn)){
-                       $tmp[$dn]=$base;
+         /* Call parent execute */
+         plugin::execute();
+
+         /* Reload departments */
+         $this->config->departments= get_departments($this->dn);
+         $this->config->make_idepartments();
+         $smarty= get_smarty();
+
+         /* Hide all departments, that are subtrees of this department */
+         $bases        = $this->config->idepartments;
+         if(($this->dn == "new")||($this->dn == "")){
+               $tmp = $bases;
+         }else{
+                 $tmp  = array();      
+                 foreach($bases as $dn=>$base){
+                         $fixed = str_replace("/","\\",$this->dn);
+                         /* Only attach departments which are not a subtree of this one */
+                         if(!preg_match("/".$fixed."/",$dn)){
+                                 $tmp[$dn]=$base;
+                         }
+                 }
                }
-       }
-       $smarty->assign("bases", $tmp);
-
-       foreach ($this->attributes as $val){
-               $smarty->assign("$val", $this->$val);
-               $smarty->assign("$val"."ACL", chkacl($this->acl, "$val"));
-       }
-       $smarty->assign("base_select", $this->base);
-       return($smarty->fetch (get_template_path('generic.tpl', TRUE)));
+         $smarty->assign("bases", $tmp);
+
+         foreach ($this->attributes as $val){
+                 $smarty->assign("$val", $this->$val);
+                 $smarty->assign("$val"."ACL", chkacl($this->acl, "$val"));
+         }
+         $smarty->assign("base_select", $this->base);
+         return($smarty->fetch (get_template_path('generic.tpl', TRUE)));
   }
 
   function clear_fields()
   {
-       $this->dn= "";
-       $this->base= "";
-       $this->acl= "#none#";
+         $this->dn= "";
+         $this->base= "";
+         $this->acl= "#none#";
 
-       foreach ($this->attributes as $val){
-               $this->$val= "";
-       }
+         foreach ($this->attributes as $val){
+                 $this->$val= "";
+         }
   }
 
 
   function remove_from_parent()
   {
-       $ldap= $this->config->get_ldap_link();
-       $ldap->cd ($this->dn);
-       $ldap->recursive_remove();
+         $ldap= $this->config->get_ldap_link();
+         $ldap->cd ($this->dn);
+         $ldap->recursive_remove();
 
-       /* Optionally execute a command after we're done */
+         /* Optionally execute a command after we're done */
        $this->handle_post_events('remove');
   }
 
@@ -136,10 +145,8 @@ class department extends plugin
        $message= array();
 
        /* Permissions for that base? */
-       $this->dn= "ou=$this->ou,".$this->base;
-       $acl= get_permissions ($this->dn, $this->ui->subtreeACL);
-       $acl= get_module_permission($acl, "department", $this->dn);
-       if (chkacl($acl, "create") != ""){
+//     $this->dn= "ou=$this->ou,".$this->base;
+       if (chkacl($this->acl, "create") != ""){
                $message[]= _("You have no permissions to create a department on this 'Base'.");
        }
 
index 0575c45fedaa69335f0f783cf6b2f065f46a08ea..52ff0768c352863f7e39768e8fa2583b03bd5787 100644 (file)
@@ -142,12 +142,9 @@ class departmentManagement extends plugin
                /* New Entry if Posted action (s_action) == new
                 */
                if ($s_action=="new"){
-                       $this->acl= array(":all");
                        $this->dn= "new";
-
                        $this->deptabs= new deptabs($this->config,
                                        $this->config->data['TABS']['DEPTABS'], $this->dn);
-                       $this->deptabs->set_acl($this->acl);
                }
 
                /* Edit Entry if Posted action (s_action) == edit 
@@ -197,7 +194,7 @@ class departmentManagement extends plugin
                if (isset($_POST['delete_department_confirm'])){
                        $acl= get_permissions ($this->dn, $this->ui->subtreeACL);
                        $acl= get_module_permission($acl, "department", $this->dn);
-                       if (chkacl($acl, "all") == ""){
+                       if (chkacl($acl, "delete") == ""){
                                $this->remove_from_parent();
                                gosa_log ("Department object'".$this->dn."' has been removed");
                                $this->reload ();
index 02c8004ae34a2bbaa62a40d754f4769e56277ac5..deafb3eb8ef0098bfdbf7558d4fdb101cbbd35f3 100644 (file)
@@ -8,11 +8,15 @@ $ACLD['application']=array("cn" => "LDAP name",
                        "gosaApplicationExecute" => "Execute",
                        "gosaApplicationFlags" => "Modify flags",
                        "gosaApplicationName" => "Visible name");
-$ACLD['department']= array("businessCategory",
+$ACLD['department']= array(
+                       "businessCategory",
                        "description",
                        "facsimileTelephoneNumber",
                        "l",
                        "ou",
+                       "create",
+                       "delete",
+                       "base",
                        "postalAddress",
                        "st",
                        "telephoneNumber");