Code

Updated ACL for systems.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 28 May 2008 05:36:48 +0000 (05:36 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 28 May 2008 05:36:48 +0000 (05:36 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11049 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/systems/admin/systems/class_divListSystem.inc
gosa-plugins/systems/admin/systems/class_systemManagement.inc

index fa8cbdb1135ab2368fa8517c25ce03b5fc24001b..3d0c1ebb960fa87c5da5f5b6a3c760cfff8cddd3 100644 (file)
@@ -263,10 +263,8 @@ class divListSystem extends MultiSelectWindow
       $s.= "..|---|\n";
       $s.= "..|<img src='images/lists/copy.png' alt='' border='0' class='center'>".
         "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
-      if(is_object($this->parent->CopyPasteHandler) && preg_match("/(r.*d|d.*r)/",$all_module_acls)){
-        $s.= "..|<img src='images/lists/cut.png' alt='' border='0' class='center'>".
-          "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
-      }
+      $s.= "..|<img src='images/lists/cut.png' alt='' border='0' class='center'>".
+        "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
     }
 
     /* Copy & paste icons */
index 7bb89b751e7faafd685b3211736f886d89ae3147..22f60379f9bba5799b6a64b99938740f1a10e14a 100644 (file)
@@ -780,26 +780,57 @@ class systems extends plugin
       $this->dns = array();
       $ids = $this->list_get_selected_items();
 
+      $ui = get_userinfo();
+      $tabs = array(
+          "ArpNewDevice"=> array("CLASS"=>"TERMTABS",     "TABCLASS" =>"termtabs",      "ACL"=> "incoming/systems"),
+          "NewDevice"   => array("CLASS"=>"TERMTABS",     "TABCLASS" =>"termtabs",      "ACL"=> "incoming/systems"),
+          "terminal"    => array("CLASS"=>"TERMTABS",     "TABCLASS" =>"termtabs",      "ACL"=> "terminal/termgeneric"),
+          "workstation" => array("CLASS"=>"WORKTABS",     "TABCLASS" =>"worktabs",      "ACL"=> "workstation/workgeneric"),
+          "server"      => array("CLASS"=>"SERVTABS",     "TABCLASS" =>"servtabs",      "ACL"=> "server/servgeneric"),
+          "printer"     => array("CLASS"=>"PRINTTABS",    "TABCLASS" =>"printtabs",     "ACL"=> "printer/printgeneric"),
+          "phone"       => array("CLASS"=>"PHONETABS",    "TABCLASS" =>"phonetabs",     "ACL"=> "phone/phoneGeneric"),
+          "winstation"  => array("CLASS"=>"WINTABS",      "TABCLASS" =>"wintabs",       "ACL"=> "winworkstation/wingeneric"),
+          "component"   => array("CLASS"=>"COMPONENTTABS","TABCLASS" =>"componenttabs", "ACL"=> "component/componentGeneric"));
+
+
       if(count($ids)){
 
+        $disallowed = array();
         foreach($ids as $id){
-          $dn = $this->terminals[$id]['dn'];
-          $this->dns[$id] = $dn;
-        }
-        if ($user= get_multiple_locks($this->dns)){
-          return(gen_locked_message($user,$this->dns));
+
+          /* Get 'dn' from posted termlinst */
+          $attrs  = $this->terminals[$id];
+          $type   = $this->get_system_type($attrs);
+          $dn     = $attrs['dn'];
+          $acl = $this->ui->get_permissions($dn, $tabs[$type]['ACL']);
+          if(preg_match("/d/",$acl)){
+            $this->dns[$id] = $dn;
+          }else{
+            $disallowed[] = $dn;
+          }
         }
 
-        $dns_names = array();
-        foreach($this->dns as $dn){
-          add_lock ($dn, $this->ui->dn);
-          $dns_names[] = @LDAP::fix($dn);
+        if(count($disallowed)){
+          msg_dialog::display(_("Permission"),msgPool::permDelete($disallowed),INFO_DIALOG);
         }
 
-        /* Lock the current entry, so nobody will edit it during deletion */
-        $smarty->assign("warning", msgPool::deleteInfo($dns_names));
-        $smarty->assign("multiple", true);
-        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+        if(count($this->dns)){
+
+          if ($user= get_multiple_locks($this->dns)){
+            return(gen_locked_message($user,$this->dns));
+          }
+
+          $dns_names = array();
+          foreach($this->dns as $dn){
+            add_lock ($dn, $this->ui->dn);
+            $dns_names[] = @LDAP::fix($dn);
+          }
+
+          /* Lock the current entry, so nobody will edit it during deletion */
+          $smarty->assign("warning", msgPool::deleteInfo($dns_names));
+          $smarty->assign("multiple", true);
+          return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+        }
       }
     }
 
@@ -1490,7 +1521,12 @@ class systems extends plugin
       $tab_c  = $tabs[$type]['TABCLASS'];
       $acl    = $tabs[$type]['ACL'];
 
-      $this->CopyPasteHandler->add_to_queue($dn,$s_action,$tab_c,$tab_o,$acl);
+      if($s_action == "copy" && preg_match("/r/",$ui->has_complete_category_acls($dn,$acl))){
+        $this->CopyPasteHandler->add_to_queue($dn,$s_action,$tab_c,$tab_o,$acl);
+      }
+      if($s_action == "cut" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,$acl))){
+        $this->CopyPasteHandler->add_to_queue($dn,$s_action,$tab_c,$tab_o,$acl);
+      }
     }
 
     /* Add entries to queue */
@@ -1510,10 +1546,10 @@ class systems extends plugin
           $tab_c  = $tabs[$type]['TABCLASS'];
           $acl    = $tabs[$type]['ACL'];
 
-          if($s_action == "copy_multiple"){
+          if($s_action == "copy_multiple" && preg_match("/r/",$ui->has_complete_category_acls($dn,$acl))){
             $this->CopyPasteHandler->add_to_queue($dn,"copy",$tab_c,$tab_o,$acl);
           }
-          if($s_action == "cut_multiple"){
+          if($s_action == "cut_multiple" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,$acl))){
             $this->CopyPasteHandler->add_to_queue($dn,"cut",$tab_c,$tab_o,$acl);
           }
         }