Code

Updated blocklist copy & paste acl checks
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 28 May 2008 06:09:38 +0000 (06:09 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 28 May 2008 06:09:38 +0000 (06:09 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11054 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/gofax/gofax/blocklists/class_blocklistManagement.inc
gosa-plugins/gofax/gofax/blocklists/class_divListBlocklists.inc

index 3712ff7b8011d71ae934e50fd96c36a372a4367d..a4c3eddd1f5efb189fa9108a68c68922349b2f2c 100644 (file)
@@ -212,24 +212,38 @@ class blocklist extends plugin
       $ids = $this->list_get_selected_items();
 
       if(count($ids)){
-
+        $disallowed = array();
         foreach($ids as $id){
-          $this->dns[$id]  = $this->blocklists[$id]['dn'];
-        }
-        if ($user= get_multiple_locks($this->dns)){
-          return(gen_locked_message($user,$this->dns));
+          $dn = $this->blocklists[$id]['dn'];
+          $acl = $this->ui->get_permissions($dn, "gofaxlist/blocklistGeneric");
+          if(preg_match("/d/",$acl)){
+            $this->dns[$id] = $dn;
+          }else{
+            $disallowed[] = $dn;
+          }
         }
 
-        $dns_names = array();
-        foreach($this->dns as $dn){
-          $dns_names[]=@LDAP::fix( $dn);
+        if(count($disallowed)){
+          msg_dialog::display(_("Permission"),msgPool::permDelete($disallowed),INFO_DIALOG);
         }
-        add_lock ($this->dns, $this->ui->dn);
 
-        /* Lock the current entry, so nobody will edit it during deletion */
-        $smarty->assign("info", msgPool::deleteInfo($dns_names,_("blocklist")));
-        $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){
+            $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("info", msgPool::deleteInfo($dns_names,_("blocklist")));
+          $smarty->assign("multiple", true);
+          return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+        }
       }
     }
 
@@ -425,12 +439,19 @@ class blocklist extends plugin
       return("");
     }
 
+    $ui = get_userinfo();
+
     /* Add a single entry to queue */
     if($s_action == "cut" || $s_action == "copy"){
       /* Cleanup object queue */
       $this->CopyPasteHandler->cleanup_queue();
       $dn = $this->blocklists[$s_entry]['dn'];
-      $this->CopyPasteHandler->add_to_queue($dn,$s_action,"faxblocktabs","FAXBLOCKTABS","gofaxlist");
+      if($s_action == "copy" && preg_match("/r/",$ui->has_complete_category_acls($dn,"gofaxlist"))){
+        $this->CopyPasteHandler->add_to_queue($dn,$s_action,"faxblocktabs","FAXBLOCKTABS","gofaxlist");
+      }
+      if($s_action == "cut" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"gofaxlist"))){
+        $this->CopyPasteHandler->add_to_queue($dn,$s_action,"faxblocktabs","FAXBLOCKTABS","gofaxlist");
+      }
     }
 
     /* Add entries to queue */
@@ -443,10 +464,10 @@ class blocklist extends plugin
       foreach($this->list_get_selected_items() as $id){
         $dn = $this->blocklists[$id]['dn'];
 
-        if($s_action == "copy_multiple"){
+        if($s_action == "copy_multiple" && preg_match("/r/",$ui->has_complete_category_acls($dn,"gofaxlist"))){
           $this->CopyPasteHandler->add_to_queue($dn,"copy","faxblocktabs","FAXBLOCKTABS","gofaxlist");
         }
-        if($s_action == "cut_multiple"){
+        if($s_action == "cut_multiple" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"gofaxlist"))){
           $this->CopyPasteHandler->add_to_queue($dn,"cut","faxblocktabs","FAXBLOCKTABS","gofaxlist");
         }
       }
index 904198dd103c3124cfcfde6c9109fb2631f53009..4ba92520b3c125b4ebe7958884fe955ba1f01aa0 100644 (file)
@@ -155,10 +155,8 @@ class divListBlocklist 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 */