Code

Centralized copy & paste ACL checks.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 29 May 2008 06:12:56 +0000 (06:12 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 29 May 2008 06:12:56 +0000 (06:12 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11090 594d385d-05f5-0310-b6e9-bd551577e9d8

27 files changed:
gosa-core/include/class_userinfo.inc
gosa-core/plugins/admin/acl/class_aclManagement.inc
gosa-core/plugins/admin/acl/class_divListACL.inc
gosa-core/plugins/admin/groups/class_divListGroup.inc
gosa-core/plugins/admin/groups/class_groupManagement.inc
gosa-core/plugins/admin/ogroups/class_divListOGroup.inc
gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc
gosa-core/plugins/admin/users/class_divListUsers.inc
gosa-core/plugins/admin/users/class_userManagement.inc
gosa-plugins/fai/admin/fai/class_divListFai.inc
gosa-plugins/fai/admin/fai/class_faiManagement.inc
gosa-plugins/gofax/gofax/blocklists/class_blocklistManagement.inc
gosa-plugins/gofax/gofax/blocklists/class_divListBlocklists.inc
gosa-plugins/gofon/gofon/conference/class_divListConferences.inc
gosa-plugins/gofon/gofon/conference/class_phoneConferenceManagment.inc
gosa-plugins/gofon/gofon/macro/class_divListMacros.inc
gosa-plugins/gofon/gofon/macro/class_gofonMacroManagement.inc
gosa-plugins/goto/admin/applications/class_applicationManagement.inc
gosa-plugins/goto/admin/applications/class_divListApplication.inc
gosa-plugins/goto/admin/devices/class_deviceManagement.inc
gosa-plugins/goto/admin/devices/class_divListDevices.inc
gosa-plugins/goto/admin/mimetypes/class_divListMimeTypes.inc
gosa-plugins/goto/admin/mimetypes/class_mimetypeManagement.inc
gosa-plugins/sudo/admin/sudo/class_divListSudo.inc
gosa-plugins/sudo/admin/sudo/class_sudoManagement.inc
gosa-plugins/systems/admin/systems/class_divListSystem.inc
gosa-plugins/systems/admin/systems/class_systemManagement.inc

index 5f68ac99989044c9f93fe27fa87b582c264b41d0..45f6a1324ad44fa32f80de5c5e0f26ace5dec402 100644 (file)
@@ -198,6 +198,23 @@ class userinfo
   }
 
 
+  function is_copyable($dn, $object, $class)
+  {
+    return(preg_match("/r/",$this->has_complete_category_acls($dn, $object)));
+  }
+
+  function is_cutable($dn, $object, $class)
+  {
+    $remove = preg_match("/d/",$this->get_permissions($dn,$object."/".$class));
+    $read   = preg_match("/r/",$this->has_complete_category_acls($dn, $object));
+    return($remove && $read);
+  }
+
+  function is_pasteable($dn, $object, $class)
+  {
+    return(preg_match("/w/",$this->has_complete_category_acls($dn, $object)));
+  }
+
   function get_permissions($dn, $object, $attribute= "", $skip_write= FALSE)
   {
     /* If we are forced to skip ACLs checks for the current user 
index 1eded9773625814ff23d2a4bfaa232f6a4a2a033..7bf405a5027284716c1a25c3488182b3ecc57fd5 100644 (file)
@@ -588,11 +588,11 @@ class aclManagement extends plugin
       $dn = $this->list[$s_entry]['dn'];
 
       /* We can only copy & cut roles */ 
-      if(isset($this->list[$id]['objectClass']) && in_array("gosaRole",$this->list[$s_entry]['objectClass'])){
-        if($s_action == "copy" && preg_match("/r/",$ui->has_complete_category_acls($dn,"aclroles"))){
+      if(isset($this->list[$s_entry]['objectClass']) && in_array("gosaRole",$this->list[$s_entry]['objectClass'])){
+        if($s_action == "copy" && $ui->is_copyable($dn,"aclroles","aclrole")){ 
           $this->CopyPasteHandler->add_to_queue($dn,$s_action,"aclroletab","ACLROLETAB","aclroles");
         }
-        if($s_action == "cut" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"aclroles"))){
+        if($s_action == "cut" && $ui->is_cutable($dn,"aclroles","aclrole")){
           $this->CopyPasteHandler->add_to_queue($dn,$s_action,"aclroletab","ACLROLETAB","aclroles");
         }
       }
@@ -610,10 +610,10 @@ class aclManagement extends plugin
 
         if(isset($this->list[$id]['objectClass']) && in_array("gosaRole",$this->list[$id]['objectClass'])){
 
-          if($s_action == "copy_multiple" && preg_match("/r/",$ui->has_complete_category_acls($dn,"aclroles"))){
+          if($s_action == "copy_multiple" && $ui->is_copyable($dn,"aclroles","aclrole")){ 
             $this->CopyPasteHandler->add_to_queue($dn,"copy","aclroletab","ACLROLETAB","aclroles");
           }
-          if($s_action == "cut_multiple" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"aclroles"))){
+          if($s_action == "cut_multiple" && $ui->is_cutable($dn,"aclroles","aclrole")){
             $this->CopyPasteHandler->add_to_queue($dn,"cut","aclroletab","ACLROLETAB","aclroles");
           }
         }
index 99c07ced49346b8a360e4b3ff21e4bfd688d5066..0da6caed1ea582981a2987224eac5f6c5983f867 100644 (file)
@@ -204,7 +204,7 @@ class divListACL extends MultiSelectWindow
 
   function setEntries($list)
   {
-
+    $ui = get_userinfo();
     foreach($list as $key => $acl_entry){
 
       /* Get copy & paste icon */
@@ -224,13 +224,21 @@ class divListACL extends MultiSelectWindow
         }
 
         /* Add copy & paste handler */
-        if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
-          $action.= "<input class='center' type='image'
+        if($ui->is_cutable($acl_entry['dn'],"acl","aclRole") && $this->parent->CopyPasteHandler){
+          $action .= "<input class='center' type='image'
             src='images/lists/cut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
+        }else{
+          $action.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
+        }
+
+        if($ui->is_copyable($acl_entry['dn'],"acl","aclRole") && $this->parent->CopyPasteHandler){
           $action.= "<input class='center' type='image'
             src='images/lists/copy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
+        }else{
+          $action.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
         }
 
+
         /* Add actions depending on acls */
         if(preg_match("/r/", $acl)){
           $action.= "<input class='center' type='image' src='images/lists/edit.png' alt='"._("edit")."'     
index 7edccb3d3492db6a80300511fb8acce9c8f195b7..d58ace3ed028541301ef58c33ce34cc079cd23cd 100644 (file)
@@ -297,14 +297,15 @@ class divListGroup extends MultiSelectWindow
       $acl_all  = $ui->has_complete_category_acls($val['dn'],"groups");
 
       $actions= "";
-      if(preg_match("/(r.*d|r.*d)/",$acl_all) && $this->parent->CopyPasteHandler){
-        $actions.= "<input class='center' type='image'
+
+      if($ui->is_cutable($val['dn'],"groups","group") && $this->parent->CopyPasteHandler){
+        $actions .= "<input class='center' type='image'
           src='images/lists/cut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
       }else{
         $actions.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
       }
 
-      if(preg_match("/r/",$acl_all) && $this->parent->CopyPasteHandler){
+      if($ui->is_copyable($val['dn'],"groups","group") && $this->parent->CopyPasteHandler){
         $actions.= "<input class='center' type='image'
           src='images/lists/copy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
       }else{
index f28e1664434a653e6264982fdf99e46c696ffdb0..70ae8ef626f943ee314eca70e62e7159ed06b05d 100644 (file)
@@ -733,10 +733,10 @@ class groupManagement extends plugin
       /* Cleanup object queue */
       $this->CopyPasteHandler->cleanup_queue();
       $dn = $this->grouplist[$s_entry]['dn'];
-      if($s_action == "copy" && preg_match("/r/",$ui->has_complete_category_acls($dn,"groups"))){
+      if($s_action == "copy" && $ui->is_copyable($dn,"groups","group")){
         $this->CopyPasteHandler->add_to_queue($dn,$s_action,"grouptabs","GROUPTABS","groups");
       }
-      if($s_action == "cut" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"groups"))){
+      if($s_action == "cut" && $ui->is_cutable($dn,"groups","group")){
         $this->CopyPasteHandler->add_to_queue($dn,$s_action,"grouptabs","GROUPTABS","groups");
       }
 
@@ -753,10 +753,10 @@ class groupManagement extends plugin
       foreach($this->list_get_selected_items() as $id){
         $dn = $this->grouplist[$id]['dn'];
 
-        if($s_action == "copy_multiple" && preg_match("/r/",$ui->has_complete_category_acls($dn,"groups"))){
+        if($s_action == "copy_multiple" && $ui->is_copyable($dn,"groups","group")){
           $this->CopyPasteHandler->add_to_queue($dn,"copy","grouptabs","GROUPTABS","groups");
         }
-        if($s_action == "cut_multiple" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"groups"))){
+        if($s_action == "cut_multiple" && $ui->is_cutable($dn,"groups","group")){
           $this->CopyPasteHandler->add_to_queue($dn,"cut","grouptabs","GROUPTABS","groups");
         }
       }
index e13efd64b524cf1068432a0492e269ee5f48b2f8..cd60dead1a6db71b9f05340781f2e7fa3301bc68 100644 (file)
@@ -275,28 +275,26 @@ class divListOGroup extends MultiSelectWindow
     // Assigning ogroups
     foreach($list as $key => $val){
 
+      $actions = "";
+      
       /* Create action icons */
       $acl    = $ui->get_permissions($val['dn'],"ogroups/ogroup");
       $acl_all= $ui->has_complete_category_acls($val['dn'],"ogroups");
 
-      // Cut
-      $actions= "";
-      if(preg_match("/(r.*d|r.*d)/",$acl_all) && $this->parent->CopyPasteHandler){
+      if($ui->is_cutable($val['dn'],"ogroups","ogroup") && $this->parent->CopyPasteHandler){
         $actions .= "<input class='center' type='image'
           src='images/lists/cut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
       }else{
         $actions.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
       }
 
-      // Copy 
-      if(preg_match("/r/",$acl_all) && $this->parent->CopyPasteHandler){
+      if($ui->is_copyable($val['dn'],"ogroups","ogroup") && $this->parent->CopyPasteHandler){
         $actions.= "<input class='center' type='image'
           src='images/lists/copy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
       }else{
         $actions.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
       }
 
-
       $actions.= "<input class='center' type='image'
         src='images/lists/edit.png' alt='"._("edit")."' name='group_edit_%KEY%' title='"._("Edit this entry")."'>";
     
index 13f84e40ee7a02aebc0e3fadc15b3124b5aafa21..6fe2d6ea249ea72cbc2b706994a5e80d81c429b4 100644 (file)
@@ -651,10 +651,10 @@ class ogroupManagement extends plugin
       /* Cleanup object queue */
       $this->CopyPasteHandler->cleanup_queue();
       $dn = $this->ogrouplist[$s_entry]['dn'];
-      if($s_action == "copy" && preg_match("/r/",$ui->has_complete_category_acls($dn,"ogroups"))){
-        $this->CopyPasteHandler->add_to_queue($dn,$s_action, "ogrouptabs","OGROUPTABS","ogroups");
+      if($s_action == "copy" && $ui->is_copyable($dn,"ogroups","ogroup")){
+        $this->CopyPasteHandler->add_to_queue($dn,$s_action,"ogrouptabs","OGROUPTABS","ogroups");
       }
-      if($s_action == "cut" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"ogroups"))){
+      if($s_action == "cut" && $ui->is_cutable($dn,"ogroups","ogroup")){
         $this->CopyPasteHandler->add_to_queue($dn,$s_action,"ogrouptabs","OGROUPTABS","ogroups");
       }
     }
@@ -670,10 +670,10 @@ class ogroupManagement extends plugin
       foreach($this->list_get_selected_items() as $id){
         $dn = $this->ogrouplist[$id]['dn'];
 
-        if($s_action == "copy_multiple" && preg_match("/r/",$ui->has_complete_category_acls($dn,"ogroups"))){
+        if($s_action == "copy_multiple" && $ui->is_copyable($dn,"ogroups","ogroup")){ 
           $this->CopyPasteHandler->add_to_queue($dn,"copy","ogrouptabs","OGROUPTABS","ogroups");
         }
-        if($s_action == "cut_multiple" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"ogroups"))){
+        if($s_action == "cut_multiple" && $ui->is_cutable($dn,"ogroups","ogroup")){
           $this->CopyPasteHandler->add_to_queue($dn,"cut","ogrouptabs","OGROUPTABS","ogroups");
         }
       }
index fb29fd472c7f51706aba17308a2f6bb8022a82d9..3aaf8bac251c363276585dbfe8d511d5465d7c1b 100644 (file)
@@ -305,14 +305,14 @@ class divListUsers extends MultiSelectWindow
       $acl      = $ui->get_permissions($val['dn'],"users/user");
       $acl_all  = $ui->has_complete_category_acls($val['dn'],"users");
      
-      if(preg_match("/(r.*d|r.*d)/",$acl_all) && $this->parent->CopyPasteHandler){
+      if($ui->is_cutable($val['dn'],"users","user") && $this->parent->CopyPasteHandler){
         $action .= "<input class='center' type='image'
           src='images/lists/cut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
       }else{
         $action.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
       }
 
-      if(preg_match("/r/",$acl_all) && $this->parent->CopyPasteHandler){
+      if($ui->is_copyable($val['dn'],"users","user") && $this->parent->CopyPasteHandler){
         $action.= "<input class='center' type='image'
           src='images/lists/copy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
       }else{
index 202e617cde77b9b7418a5e0bedb7c28079e2ee80..2b84bfc2b87b33e3c58703e40aecf1d274e27ce8 100644 (file)
@@ -1119,10 +1119,10 @@ class userManagement extends plugin
       /* Cleanup object queue */
       $this->CopyPasteHandler->cleanup_queue();
       $dn = $this->list[$s_entry]['dn'];
-      if($s_action == "copy" && preg_match("/r/",$ui->has_complete_category_acls($dn,"users"))){
+      if($s_action == "copy" && $ui->is_copyable($dn,"users","user")){
         $this->CopyPasteHandler->add_to_queue($dn,$s_action,"usertabs","USERTABS","users");
       }
-      if($s_action == "cut" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"users"))){
+      if($s_action == "cut" && $ui->is_cutable($dn,"users","user")){
         $this->CopyPasteHandler->add_to_queue($dn,$s_action,"usertabs","USERTABS","users");
       }
     }
@@ -1137,10 +1137,10 @@ class userManagement extends plugin
       foreach($this->list_get_selected_items() as $id){
         $dn = $this->list[$id]['dn'];
 
-        if($s_action == "copy_multiple" && preg_match("/r/",$ui->has_complete_category_acls($dn,"users"))){
+        if($s_action == "copy_multiple" && $ui->is_copyable($dn,"users","user")){
           $this->CopyPasteHandler->add_to_queue($dn,"copy","usertabs","USERTABS","users");
         }
-        if($s_action == "cut_multiple" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"users"))){
+        if($s_action == "cut_multiple" && $ui->is_cutable($dn,"users","user")){
           $this->CopyPasteHandler->add_to_queue($dn,"cut","usertabs","USERTABS","users");
         }
       }
index 02f00d44cdbe9d8be8ca77cc3ba76379f7fdabce..9f0362e4ded39b8cd453a7aa77c7f056c9bc08fb 100644 (file)
@@ -255,7 +255,7 @@ class divListFai extends MultiSelectWindow
        $ui = get_userinfo();
        $action ="";
        $acl_all = $ui->has_complete_category_acls($this->parent->fai_base,$this->module);
-       if(preg_match("/r/",$acl_all) && $this->parent->CopyPasteHandler){
+       if($ui->is_copyable($value['dn'],"fai",$value['class']) && $this->parent->CopyPasteHandler){
          $action .= "<input class='center' type='image'
            src='images/lists/copy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
        }
index 2f781b979b19ed9752563a11a7329d979d73c776..b5b335cab57fce6b48fc2a8553a90dbb74d60865 100644 (file)
@@ -1089,6 +1089,7 @@ class faiManagement extends plugin
           $obj['cn']                         = $object['cn'][0];
           $obj['dn']                         = $object['dn'];
           $obj['acl']                      = $acl;
+          $obj['class']                          = $rest ['ACL'];
           $obj['description']   = $object['description'][0];
           $obj['objectClass']   = $object['objectClass'];
 
@@ -1219,6 +1220,7 @@ class faiManagement extends plugin
       return("");
     }
 
+    $ui = get_userinfo();
 
     /* Add a single entry to queue */
     if($s_action == "copy"){
@@ -1228,7 +1230,10 @@ class faiManagement extends plugin
       $entry    = $this->objects[$s_entry];
       $a_setup  = $this->get_type($entry);
       $dn = $entry['dn'];
-      $this->CopyPasteHandler->add_to_queue($dn,$s_action,$a_setup[0],$a_setup[2],"fai");//$a_setup[1]);
+
+      if($ui->is_copyable($dn,"fai",$a_setup[1])){
+        $this->CopyPasteHandler->add_to_queue($dn,$s_action,$a_setup[0],$a_setup[2],"fai");//$a_setup[1]);
+      }
     }
 
     /* Add entries to queue */
@@ -1245,8 +1250,7 @@ class faiManagement extends plugin
         $a_setup  = $this->get_type($entry);
         $dn = $entry['dn'];
 
-
-        if($s_action == "copy_multiple"){
+        if($s_action == "copy_multiple" && $ui->is_copyable($dn,"fai",$a_setup[1])){
           $this->CopyPasteHandler->add_to_queue($dn,"copy",$a_setup[0],$a_setup[2],"fai");//$a_setup[1]);
         }
       }
index 76ddca75e74502b6993f4be75c16977c07c60829..93987e40466af3fb81808bb79ae24d65dc65a7e4 100644 (file)
@@ -446,10 +446,10 @@ class blocklist extends plugin
       /* Cleanup object queue */
       $this->CopyPasteHandler->cleanup_queue();
       $dn = $this->blocklists[$s_entry]['dn'];
-      if($s_action == "copy" && preg_match("/r/",$ui->has_complete_category_acls($dn,"gofaxlist"))){
+      if($s_action == "copy" && $ui->is_copyable($dn,"gofaxlist","blocklistGeneric")){ 
         $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"))){
+      if($s_action == "cut" && $ui->is_cutable($dn,"gofaxlist","blocklistGeneric")){
         $this->CopyPasteHandler->add_to_queue($dn,$s_action,"faxblocktabs","FAXBLOCKTABS","gofaxlist");
       }
     }
@@ -464,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" && preg_match("/r/",$ui->has_complete_category_acls($dn,"gofaxlist"))){
+        if($s_action == "copy_multiple" && $ui->is_copyable($dn,"gofaxlist","blocklistGeneric")){ 
           $this->CopyPasteHandler->add_to_queue($dn,"copy","faxblocktabs","FAXBLOCKTABS","gofaxlist");
         }
-        if($s_action == "cut_multiple" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"gofaxlist"))){
+        if($s_action == "cut_multiple" && $ui->is_cutable($dn,"gofaxlist","blocklistGeneric")){
           $this->CopyPasteHandler->add_to_queue($dn,"cut","faxblocktabs","FAXBLOCKTABS","gofaxlist");
         }
       }
index 4ba92520b3c125b4ebe7958884fe955ba1f01aa0..54dec38895aa01b048c5f0b8bc94a45940860279 100644 (file)
@@ -209,14 +209,14 @@ class divListBlocklist extends MultiSelectWindow
       }  
 
       $action ="";
-      if(preg_match("/(r.*d|r.*d)/",$acl_all) && $this->parent->CopyPasteHandler){
+      if($ui->is_cutable($val['dn'],"gofaxlist","blocklist") && $this->parent->CopyPasteHandler){
         $action .= "<input class='center' type='image'
           src='images/lists/cut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
       }else{
         $action.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
       }
 
-      if(preg_match("/r/",$acl_all) && $this->parent->CopyPasteHandler){
+      if($ui->is_copyable($val['dn'],"gofaxlist","blocklist") && $this->parent->CopyPasteHandler){
         $action.= "<input class='center' type='image'
           src='images/lists/copy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
       }else{
index 7bd2d7205dedaabcb6a302069f8d329950411038..c50340950f239430720a4dfa0b4ed20fc23f57d5 100644 (file)
@@ -194,6 +194,8 @@ class divListConference extends MultiSelectWindow
       $action_col_size += 20;
     }
 
+    $ui = get_userinfo();
+
     /* Insert conferneces*/
     foreach($list as $conferencekey => $conference ){
 
@@ -207,15 +209,14 @@ class divListConference extends MultiSelectWindow
       }
 
       $actions ="";
-
-      if(preg_match("/(r.*d|r.*d)/",$acl_all) && $this->parent->CopyPasteHandler){
+      if($ui->is_cutable($conference['dn'],"gofonconference","conference") && $this->parent->CopyPasteHandler){
         $actions .= "<input class='center' type='image'
           src='images/lists/cut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
       }else{
         $actions.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
       }
 
-      if(preg_match("/r/",$acl_all) && $this->parent->CopyPasteHandler){
+      if($ui->is_copyable($conference['dn'],"gofonconference","conference") && $this->parent->CopyPasteHandler){
         $actions.= "<input class='center' type='image'
           src='images/lists/copy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
       }else{
index 3a138c3c6d16cb1d0d0dc132c9497105c77d3c25..3cf6ec65d7e1100d0ab7609c098166b75596d350 100644 (file)
@@ -487,10 +487,10 @@ class phoneConferenceManagment extends plugin
       $this->CopyPasteHandler->cleanup_queue();
       $dn = $this->conferences[$s_entry]['dn'];
 
-      if($s_action == "copy" && preg_match("/r/",$ui->has_complete_category_acls($dn,"gofonconference"))){
+      if($s_action == "copy" && $ui->is_copyable($dn,"gofonconference","conference")){ 
         $this->CopyPasteHandler->add_to_queue($dn,$s_action,"conferencetabs","CONFERENCETABS","gofonconference");
       }
-      if($s_action == "cut" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"gofonconference"))){
+      if($s_action == "cut" && $ui->is_cutable($dn,"gofonconference","conference")){
         $this->CopyPasteHandler->add_to_queue($dn,$s_action,"conferencetabs","CONFERENCETABS","gofonconference");
       }
     }
@@ -505,10 +505,10 @@ class phoneConferenceManagment extends plugin
       foreach($this->list_get_selected_items() as $id){
         $dn = $this->conferences[$id]['dn'];
 
-        if($s_action == "copy_multiple" && preg_match("/r/",$ui->has_complete_category_acls($dn,"gofonconference"))){
+        if($s_action == "copy_multiple" && $ui->is_copyable($dn,"gofonconference","conference")){ 
           $this->CopyPasteHandler->add_to_queue($dn,"copy","conferencetabs","CONFERENCETABS","gofonconference");
         }
-        if($s_action == "cut_multiple" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"gofonconference"))){
+        if($s_action == "cut_multiple" && $ui->is_cutable($dn,"gofonconference","conference")){
           $this->CopyPasteHandler->add_to_queue($dn,"cut","conferencetabs","CONFERENCETABS","gofonconference");
         }
       }
index b9a934b1f06348f3423c2d613315ea93cd789bcd..22b1f499f90d6b4b4988c7775acd1610d9f01b9b 100644 (file)
@@ -206,14 +206,14 @@ class divListMacro extends MultiSelectWindow
         continue;
       }
 
-      if(preg_match("/(r.*d|r.*d)/",$acl_all) && $this->parent->CopyPasteHandler){
+      if($ui->is_cutable($val['dn'],"gofonmacro","macro") && $this->parent->CopyPasteHandler){
         $action .= "<input class='center' type='image'
           src='images/lists/cut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
       }else{
         $action.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
       }
 
-      if(preg_match("/r/",$acl_all) && $this->parent->CopyPasteHandler){
+      if($ui->is_copyable($val['dn'],"gofonmacro","macro") && $this->parent->CopyPasteHandler){
         $action.= "<input class='center' type='image'
           src='images/lists/copy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
       }else{
index 531b25635914377160725548e3195b610425155f..46f9d5144383a4a71ee9324eaf612829e98d7fbc 100644 (file)
@@ -464,10 +464,10 @@ class goFonMacro extends plugin
       $this->CopyPasteHandler->cleanup_queue();
       $dn = $this->macros[$s_entry]['dn'];
 
-      if($s_action == "copy" && preg_match("/r/",$ui->has_complete_category_acls($dn,"gofonmacro"))){
+      if($s_action == "copy" && $ui->is_copyable($dn,"gofonmacro","macro")){ 
         $this->CopyPasteHandler->add_to_queue($dn,$s_action,"macrotabs","MACROTABS","gofonmacro");
       }
-      if($s_action == "cut" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"gofonmacro"))){
+      if($s_action == "cut" && $ui->is_cutable($dn,"gofonmacro","macro")){
         $this->CopyPasteHandler->add_to_queue($dn,$s_action,"macrotabs","MACROTABS","gofonmacro");
       }
     }
@@ -482,10 +482,10 @@ class goFonMacro extends plugin
       foreach($this->list_get_selected_items() as $id){
         $dn = $this->macros[$id]['dn'];
 
-        if($s_action == "copy_multiple" && preg_match("/r/",$ui->has_complete_category_acls($dn,"gofonmacro"))){
+        if($s_action == "copy_multiple" && $ui->is_copyable($dn,"gofonmacro","macro")){ 
           $this->CopyPasteHandler->add_to_queue($dn,"copy","macrotabs","MACROTABS","gofonmacro");
         }
-        if($s_action == "cut_multiple" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"gofonmacro"))){
+        if($s_action == "cut_multiple" && $ui->is_cutable($dn,"gofonmacro","macro")){
           $this->CopyPasteHandler->add_to_queue($dn,"cut","macrotabs","MACROTABS","gofonmacro");
         }
       }
index b2a9cd44340de905b79c5de595ce65ce067154b6..b00a8d29c7f1906c59989e4860bc8bdbce83f826 100644 (file)
@@ -603,10 +603,10 @@ class applicationManagement extends plugin
       /* Cleanup object queue */
       $this->CopyPasteHandler->cleanup_queue();
       $dn = $this->applications[$s_entry]['dn'];
-      if($s_action == "copy" && preg_match("/r/",$ui->has_complete_category_acls($dn,"application"))){
+      if($s_action == "copy" && $ui->is_copyable($dn,"application","application")){
         $this->CopyPasteHandler->add_to_queue($dn,$s_action,"apptabs","APPSTABS","application");
       }
-      if($s_action == "cut" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"application"))){
+      if($s_action == "cut" && $ui->is_cutable($dn,"application","application")){ 
         $this->CopyPasteHandler->add_to_queue($dn,$s_action,"apptabs","APPSTABS","application");
       }
     }
@@ -622,10 +622,10 @@ class applicationManagement extends plugin
       foreach($this->list_get_selected_items() as $id){
         $dn = $this->applications[$id]['dn'];
 
-        if($s_action == "copy_multiple" && preg_match("/r/",$ui->has_complete_category_acls($dn,"application"))){
+        if($s_action == "copy_multiple" && $ui->is_copyable($dn,"application","application")){ 
           $this->CopyPasteHandler->add_to_queue($dn,"copy","apptabs","APPSTABS","application");
         }
-        if($s_action == "cut_multiple" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"application"))){
+        if($s_action == "cut_multiple" && $ui->is_cutable($dn,"application","application")){
           $this->CopyPasteHandler->add_to_queue($dn,"cut","apptabs","APPSTABS","application");
         }
       }
index 7c57a001d888ad8ef29b8aa27dab468ca7be2958..9a53e5f31aac5b7c4f92d3964550c431e0a7b202 100644 (file)
@@ -231,14 +231,14 @@ class divListApplication extends MultiSelectWindow
       $actions= "";
 
       /* Add Copy & Paste icon */
-      if(preg_match("/(r.*d|r.*d)/",$acl_all) && $this->parent->CopyPasteHandler){
+      if($ui->is_cutable($val['dn'],"application","application") && $this->parent->CopyPasteHandler){
         $actions .= "<input class='center' type='image'
           src='images/lists/cut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
       }else{
         $actions.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
       }
 
-      if(preg_match("/r/",$acl_all) && $this->parent->CopyPasteHandler){
+      if($ui->is_copyable($val['dn'],"application","application") && $this->parent->CopyPasteHandler){
         $actions.= "<input class='center' type='image'
           src='images/lists/copy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
       }else{
index 5c6e8e98da62571149d172f265970767efafa8d5..5cb193a085d0cdf8fbc562d734f8c33a7b6dd102 100644 (file)
@@ -464,10 +464,10 @@ class deviceManagement extends plugin
       /* Cleanup object queue */
       $this->CopyPasteHandler->cleanup_queue();
       $dn = $this->devices[$s_entry]['dn'];
-      if($s_action == "copy" && preg_match("/r/",$ui->has_complete_category_acls($dn,"devices"))){
+      if($s_action == "copy" && $ui->is_copyable($dn,"devices","deviceGeneric")){ 
         $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"))){
+      if($s_action == "cut" && $ui->is_cutable($dn,"devices","deviceGeneric")){ 
         $this->CopyPasteHandler->add_to_queue($dn,$s_action,"devicetabs","DEVICETABS","devices");
       }
     }
@@ -482,10 +482,10 @@ class deviceManagement extends plugin
       foreach($this->list_get_selected_items() as $id){
         $dn = $this->devices[$id]['dn'];
 
-        if($s_action == "copy_multiple" && preg_match("/r/",$ui->has_complete_category_acls($dn,"devices"))){
+        if($s_action == "copy_multiple" && $ui->is_copyable($dn,"devices","deviceGeneric")){ 
           $this->CopyPasteHandler->add_to_queue($dn,"copy","devicetabs","DEVICETABS","devices");
         }
-        if($s_action == "cut_multiple" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"devices"))){
+        if($s_action == "cut_multiple" && $ui->is_cutable($dn,"devices","deviceGeneric")){
           $this->CopyPasteHandler->add_to_queue($dn,"cut","devicetabs","DEVICETABS","devices");
         }
       }
index 0407757c67f1434f022dfe6eba1fb36b11520373..b43c492fc236f5fadb5ac88441a5b7107b2c0b8e 100644 (file)
@@ -214,14 +214,14 @@ class divListDevices extends MultiSelectWindow
       $acl_all  = $ui->has_complete_category_acls($val['dn'],"devices") ;
 
       $actions = "";
-      if(preg_match("/(r.*d|r.*d)/",$acl_all) && $this->parent->CopyPasteHandler){
+      if($ui->is_cutable($val['dn'],"devices","deviceGeneric") && $this->parent->CopyPasteHandler){
         $actions .= "<input class='center' type='image'
           src='images/lists/cut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
       }else{
         $actions.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
       }
 
-      if(preg_match("/r/",$acl_all) && $this->parent->CopyPasteHandler){
+      if($ui->is_copyable($val['dn'],"devices","deviceGeneric") && $this->parent->CopyPasteHandler){
         $actions.= "<input class='center' type='image'
           src='images/lists/copy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
       }else{
index e4962746b80cdf3a857af877c2ffe6ef55f71a77..dbc60c50142c0501673e515cbe076724e23d5f80 100644 (file)
@@ -237,14 +237,14 @@ class divListMimeTypes extends MultiSelectWindow
       $acl_all  = $ui->has_complete_category_acls($val['dn'],"mimetypes") ;
 
       $action = "";
-      if(preg_match("/(r.*d|r.*d)/",$acl_all) && $this->parent->CopyPasteHandler){
-        $action.= "<input class='center' type='image'
+      if($ui->is_cutable($val['dn'],"mimetypes","mimetype") && $this->parent->CopyPasteHandler){
+        $action .= "<input class='center' type='image'
           src='images/lists/cut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
       }else{
         $action.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
       }
 
-      if(preg_match("/r/",$acl_all) && $this->parent->CopyPasteHandler){
+      if($ui->is_copyable($val['dn'],"mimetypes","mimetype") && $this->parent->CopyPasteHandler){
         $action.= "<input class='center' type='image'
           src='images/lists/copy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
       }else{
index c56b3d2b4e568d8ff107f23f3f66d9e990c8ca8a..d911448dc5319b10503c1d5cafc44dc23377ae4f 100644 (file)
@@ -612,10 +612,10 @@ class mimetypeManagement extends plugin
       /* Cleanup object queue */
       $this->CopyPasteHandler->cleanup_queue();
       $dn = $this->mimetypes[$s_entry]['dn'];
-      if($s_action == "copy" && preg_match("/r/",$ui->has_complete_category_acls($dn,"mimetypes"))){
+      if($s_action == "copy" && $ui->is_copyable($dn,"mimetypes","mimetype")){
         $this->CopyPasteHandler->add_to_queue($dn,$s_action,"mimetabs","MIMETABS","mimetypes");
       }
-      if($s_action == "cut" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"mimetypes"))){
+      if($s_action == "cut" && $ui->is_cutable($dn,"mimetypes","mimetype")){ 
         $this->CopyPasteHandler->add_to_queue($dn,$s_action,"mimetabs","MIMETABS","mimetypes");
       }
     }
@@ -630,10 +630,10 @@ class mimetypeManagement extends plugin
       foreach($this->list_get_selected_items() as $id){
         $dn = $this->mimetypes[$id]['dn'];
 
-        if($s_action == "copy_multiple" && preg_match("/r/",$ui->has_complete_category_acls($dn,"mimetypes"))){
+        if($s_action == "copy_multiple" && $ui->is_copyable($dn,"mimetypes","mimetype")){ 
           $this->CopyPasteHandler->add_to_queue($dn,"copy","mimetabs","MIMETABS","mimetypes");
         }
-        if($s_action == "cut_multiple" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"mimetypes"))){
+        if($s_action == "cut_multiple" && $ui->is_cutable($dn,"mimetypes","mimetype")){
           $this->CopyPasteHandler->add_to_queue($dn,"cut","mimetabs","MIMETABS","mimetypes");
         }
       }
index 98f418f7d0315f7e61ce7508f276d7afd67a1499..f16ddd90c01e71d67c0bc8308c3f29a28656b9fc 100644 (file)
@@ -185,7 +185,7 @@ class divListSudo extends MultiSelectWindow
 
       /* Add edit icon */
       $actions= "";
-      if(preg_match("/r/",$acl_all) && $this->parent->CopyPasteHandler){
+      if($ui->is_copyable($val['dn'],"sudo","sudo") && $this->parent->CopyPasteHandler){
         $actions.= "<input class='center' type='image'
           src='images/lists/copy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
       }else{
index 54d6dd5232a923501fd27a33c51a22b49ede24e6..e866e24eedb3997f2ea381e533f5323547c0d251 100644 (file)
@@ -468,10 +468,10 @@ class sudoManagement extends plugin
       $this->CopyPasteHandler->cleanup_queue();
       $dn = $this->list[$s_entry]['dn'];
 
-      if($s_action == "copy" && preg_match("/r/",$ui->has_complete_category_acls($dn,"sudo"))){
+      if($s_action == "copy" && $ui->is_copyable($dn,"sudo","sudo")){
         $this->CopyPasteHandler->add_to_queue($dn,$s_action,"sudotabs","SUDOTABS","sudo");
       }
-#      if($s_action == "cut" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"sudo"))){
+#      if($s_action == "cut" && $ui->is_cutable($dn,"sudo","sudo")){ 
 #        $this->CopyPasteHandler->add_to_queue($dn,$s_action,"sudotabs","SUDOTABS","sudo");
 #      }
     }
@@ -486,10 +486,10 @@ class sudoManagement extends plugin
       foreach($this->list_get_selected_items() as $id){
         $dn = $this->list[$id]['dn'];
 
-        if($s_action == "copy_multiple" && preg_match("/r/",$ui->has_complete_category_acls($dn,"sudo"))){
+        if($s_action == "copy_multiple" && $ui->is_copyable($dn,"sudo","sudo")){ 
           $this->CopyPasteHandler->add_to_queue($dn,"copy","sudotabs","SUDOTABS","sudo");
         }
-#        if($s_action == "cut_multiple" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"sudo"))){
+#        if($s_action == "cut_multiple" && $ui->is_cutable($dn,"sudo","sudo")){
 #          $this->CopyPasteHandler->add_to_queue($dn,"cut","sudotabs","SUDOTABS","sudo");
 #        }
       }
index 3d0c1ebb960fa87c5da5f5b6a3c760cfff8cddd3..b49d1bd9c29800438a10030d553cf41d7edadfa2 100644 (file)
@@ -372,6 +372,10 @@ class divListSystem extends MultiSelectWindow
         $acl_type = "incoming";
       }
 
+      $s_acl    = $tabs[$type]['ACL'];
+      $category = preg_replace("/\/.*$/","",$s_acl);
+      $class    = preg_replace("/^.*\//","",$s_acl);
+
       /* Get complete category acls */
       $acl_all  = $ui->has_complete_category_acls($val['dn'],$acl_type) ;
   
@@ -379,20 +383,21 @@ class divListSystem extends MultiSelectWindow
       $acl      = $ui->get_permissions($val['dn'],$tabs[$type]['ACL']);
 
       $action ="";
-      if(preg_match("/(r.*d|r.*d)/",$acl_all) && $this->parent->CopyPasteHandler){
+      if($ui->is_cutable($val['dn'],$category,$class) && $this->parent->CopyPasteHandler){
         $action .= "<input class='center' type='image'
           src='images/lists/cut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
       }else{
         $action.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
       }
 
-      if(preg_match("/r/",$acl_all) && $this->parent->CopyPasteHandler){
+      if($ui->is_copyable($val['dn'],$category,$class) && $this->parent->CopyPasteHandler){
         $action.= "<input class='center' type='image'
           src='images/lists/copy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
       }else{
         $action.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
       }
 
+
       $action.= "<input class='center' type='image' src='images/lists/edit.png' 
                     alt='"._("edit")."'     name='system_edit_%KEY%' title='"._("Edit system")."'>";
 
index 5941aed45aff8102dcdd5e6728efeac7a1bf8bee..1f115d806b3c6cf60b50d70b6f477f6a00078615 100644 (file)
@@ -1520,12 +1520,13 @@ class systems extends plugin
 
       $tab_o  = $tabs[$type]['CLASS'];
       $tab_c  = $tabs[$type]['TABCLASS'];
+      $acl_c  = $tabs[$type]['TABNAME'];
       $acl    = $tabs[$type]['ACL'];
 
-      if($s_action == "copy" && preg_match("/r/",$ui->has_complete_category_acls($dn,$acl))){
+      if($s_action == "copy" && $ui->is_copyable($dn,$acl,$acl_c)){
         $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))){
+      if($s_action == "cut" && $ui->is_cutable($dn,$acl,$acl_c)){
         $this->CopyPasteHandler->add_to_queue($dn,$s_action,$tab_c,$tab_o,$acl);
       }
     }
@@ -1545,12 +1546,13 @@ class systems extends plugin
         if(isset($tabs[$type])){
           $tab_o  = $tabs[$type]['CLASS'];
           $tab_c  = $tabs[$type]['TABCLASS'];
+          $acl_c  = $tabs[$type]['TABNAME'];
           $acl    = $tabs[$type]['ACL'];
 
-          if($s_action == "copy_multiple" && preg_match("/r/",$ui->has_complete_category_acls($dn,$acl))){
+          if($s_action == "copy_multiple" && $ui->is_copyable($dn,$acl,$acl_c)){ 
             $this->CopyPasteHandler->add_to_queue($dn,"copy",$tab_c,$tab_o,$acl);
           }
-          if($s_action == "cut_multiple" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,$acl))){
+          if($s_action == "cut_multiple" && $ui->is_cutable($dn,$acl,$acl_c)){
             $this->CopyPasteHandler->add_to_queue($dn,"cut",$tab_c,$tab_o,$acl);
           }
         }