Code

Updated acl handling for devices. Updated Copy&paste ACL checks.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 28 May 2008 05:54:01 +0000 (05:54 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 28 May 2008 05:54:01 +0000 (05:54 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11051 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/devices/class_deviceManagement.inc
gosa-plugins/goto/admin/devices/class_divListDevices.inc

index 9560b34a3de0954b42c3e8785d735640f8c3a512..a3c271d40f78d016699967bc063ded0e87735e6a 100644 (file)
@@ -228,27 +228,39 @@ class deviceManagement extends plugin
 
       if(count($ids)){
 
-        /* collect entries */
-        $this->dns = array();
+        $disallowed = array();
         foreach($ids as $id){
-          $this->dns[$id] = $this->devices[$id]['dn'];
+          $dn = $this->devices[$id]['dn'];
+          $acl = $this->ui->get_permissions($dn, "devices/deviceGeneric");
+          if(preg_match("/d/",$acl)){
+            $this->dns[$id] = $dn;
+          }else{
+            $disallowed[] = $dn;
+          }
         }
 
-        /* Check locks */
-        if ($user= get_multiple_locks($this->dns)){
-          return(gen_locked_message($user,$this->dns));
+        if(count($disallowed)){
+          msg_dialog::display(_("Permission"),msgPool::permDelete($disallowed),INFO_DIALOG);
         }
 
-        $dns_names = array();
-        foreach($this->dns as $dn){
-          $dns_names[] =@LDAP::fix($dn);
-        }
-        add_lock ($this->dns, $this->ui->dn);
+        if(count($this->dns)){
 
-        /* Lock the current entry, so nobody will edit it during deletion */
-        $smarty->assign("intro", msgPool::deleteInfo($dns_names),_("device"));
-        $smarty->assign("multiple", true);
-        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+          /* Check locks */
+          if ($user= get_multiple_locks($this->dns)){
+            return(gen_locked_message($user,$this->dns));
+          }
+
+          $dns_names = array();
+          foreach($this->dns as $dn){
+            $dns_names[] =@LDAP::fix($dn);
+          }
+          add_lock ($this->dns, $this->ui->dn);
+
+          /* Lock the current entry, so nobody will edit it during deletion */
+          $smarty->assign("intro", msgPool::deleteInfo($dns_names),_("device"));
+          $smarty->assign("multiple", true);
+          return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+        }
       }
     }
 
@@ -450,7 +462,12 @@ class deviceManagement extends plugin
       /* Cleanup object queue */
       $this->CopyPasteHandler->cleanup_queue();
       $dn = $this->devices[$s_entry]['dn'];
-      $this->CopyPasteHandler->add_to_queue($dn,$s_action,"devicetabs","DEVICETABS","devices");
+      if($s_action == "copy" && preg_match("/r/",$ui->has_complete_category_acls($dn,"devices"))){
+        $this->CopyPasteHandler->add_to_queue($dn,$s_action,"devicetabs","DEVICETABS","devices");
+      }
+      if($s_action == "cut" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"devices"))){
+        $this->CopyPasteHandler->add_to_queue($dn,$s_action,"devicetabs","DEVICETABS","devices");
+      }
     }
 
     /* Add entries to queue */
@@ -463,10 +480,10 @@ class deviceManagement extends plugin
       foreach($this->list_get_selected_items() as $id){
         $dn = $this->devices[$id]['dn'];
 
-        if($s_action == "copy_multiple"){
+        if($s_action == "copy_multiple" && preg_match("/r/",$ui->has_complete_category_acls($dn,"devices"))){
           $this->CopyPasteHandler->add_to_queue($dn,"copy","devicetabs","DEVICETABS","devices");
         }
-        if($s_action == "cut_multiple"){
+        if($s_action == "cut_multiple" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"devices"))){
           $this->CopyPasteHandler->add_to_queue($dn,"cut","devicetabs","DEVICETABS","devices");
         }
       }
index 73e9c9677f2e466365066e72f54e8b73c6ac91d2..0407757c67f1434f022dfe6eba1fb36b11520373 100644 (file)
@@ -151,10 +151,8 @@ class divListDevices 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)/",$acl_all)){
-        $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 */