From: hickert Date: Thu, 29 May 2008 06:12:56 +0000 (+0000) Subject: Centralized copy & paste ACL checks. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=fa5d22666fd9d7d2b6fce4c546b37b0071e59cdc;p=gosa.git Centralized copy & paste ACL checks. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11090 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_userinfo.inc b/gosa-core/include/class_userinfo.inc index 5f68ac999..45f6a1324 100644 --- a/gosa-core/include/class_userinfo.inc +++ b/gosa-core/include/class_userinfo.inc @@ -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 diff --git a/gosa-core/plugins/admin/acl/class_aclManagement.inc b/gosa-core/plugins/admin/acl/class_aclManagement.inc index 1eded9773..7bf405a50 100644 --- a/gosa-core/plugins/admin/acl/class_aclManagement.inc +++ b/gosa-core/plugins/admin/acl/class_aclManagement.inc @@ -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"); } } diff --git a/gosa-core/plugins/admin/acl/class_divListACL.inc b/gosa-core/plugins/admin/acl/class_divListACL.inc index 99c07ced4..0da6caed1 100644 --- a/gosa-core/plugins/admin/acl/class_divListACL.inc +++ b/gosa-core/plugins/admin/acl/class_divListACL.inc @@ -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.= "is_cutable($acl_entry['dn'],"acl","aclRole") && $this->parent->CopyPasteHandler){ + $action .= " "; + }else{ + $action.="  "; + } + + if($ui->is_copyable($acl_entry['dn'],"acl","aclRole") && $this->parent->CopyPasteHandler){ $action.= " "; + }else{ + $action.="  "; } + /* Add actions depending on acls */ if(preg_match("/r/", $acl)){ $action.= "has_complete_category_acls($val['dn'],"groups"); $actions= ""; - if(preg_match("/(r.*d|r.*d)/",$acl_all) && $this->parent->CopyPasteHandler){ - $actions.= "is_cutable($val['dn'],"groups","group") && $this->parent->CopyPasteHandler){ + $actions .= " "; }else{ $actions.="  "; } - if(preg_match("/r/",$acl_all) && $this->parent->CopyPasteHandler){ + if($ui->is_copyable($val['dn'],"groups","group") && $this->parent->CopyPasteHandler){ $actions.= " "; }else{ diff --git a/gosa-core/plugins/admin/groups/class_groupManagement.inc b/gosa-core/plugins/admin/groups/class_groupManagement.inc index f28e16644..70ae8ef62 100644 --- a/gosa-core/plugins/admin/groups/class_groupManagement.inc +++ b/gosa-core/plugins/admin/groups/class_groupManagement.inc @@ -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"); } } diff --git a/gosa-core/plugins/admin/ogroups/class_divListOGroup.inc b/gosa-core/plugins/admin/ogroups/class_divListOGroup.inc index e13efd64b..cd60dead1 100644 --- a/gosa-core/plugins/admin/ogroups/class_divListOGroup.inc +++ b/gosa-core/plugins/admin/ogroups/class_divListOGroup.inc @@ -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 .= " "; }else{ $actions.="  "; } - // Copy - if(preg_match("/r/",$acl_all) && $this->parent->CopyPasteHandler){ + if($ui->is_copyable($val['dn'],"ogroups","ogroup") && $this->parent->CopyPasteHandler){ $actions.= " "; }else{ $actions.="  "; } - $actions.= ""; diff --git a/gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc b/gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc index 13f84e40e..6fe2d6ea2 100644 --- a/gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc +++ b/gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc @@ -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"); } } diff --git a/gosa-core/plugins/admin/users/class_divListUsers.inc b/gosa-core/plugins/admin/users/class_divListUsers.inc index fb29fd472..3aaf8bac2 100644 --- a/gosa-core/plugins/admin/users/class_divListUsers.inc +++ b/gosa-core/plugins/admin/users/class_divListUsers.inc @@ -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 .= " "; }else{ $action.="  "; } - if(preg_match("/r/",$acl_all) && $this->parent->CopyPasteHandler){ + if($ui->is_copyable($val['dn'],"users","user") && $this->parent->CopyPasteHandler){ $action.= " "; }else{ diff --git a/gosa-core/plugins/admin/users/class_userManagement.inc b/gosa-core/plugins/admin/users/class_userManagement.inc index 202e617cd..2b84bfc2b 100644 --- a/gosa-core/plugins/admin/users/class_userManagement.inc +++ b/gosa-core/plugins/admin/users/class_userManagement.inc @@ -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"); } } diff --git a/gosa-plugins/fai/admin/fai/class_divListFai.inc b/gosa-plugins/fai/admin/fai/class_divListFai.inc index 02f00d44c..9f0362e4d 100644 --- a/gosa-plugins/fai/admin/fai/class_divListFai.inc +++ b/gosa-plugins/fai/admin/fai/class_divListFai.inc @@ -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 .= " "; } diff --git a/gosa-plugins/fai/admin/fai/class_faiManagement.inc b/gosa-plugins/fai/admin/fai/class_faiManagement.inc index 2f781b979..b5b335cab 100644 --- a/gosa-plugins/fai/admin/fai/class_faiManagement.inc +++ b/gosa-plugins/fai/admin/fai/class_faiManagement.inc @@ -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]); } } diff --git a/gosa-plugins/gofax/gofax/blocklists/class_blocklistManagement.inc b/gosa-plugins/gofax/gofax/blocklists/class_blocklistManagement.inc index 76ddca75e..93987e404 100644 --- a/gosa-plugins/gofax/gofax/blocklists/class_blocklistManagement.inc +++ b/gosa-plugins/gofax/gofax/blocklists/class_blocklistManagement.inc @@ -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"); } } diff --git a/gosa-plugins/gofax/gofax/blocklists/class_divListBlocklists.inc b/gosa-plugins/gofax/gofax/blocklists/class_divListBlocklists.inc index 4ba92520b..54dec3889 100644 --- a/gosa-plugins/gofax/gofax/blocklists/class_divListBlocklists.inc +++ b/gosa-plugins/gofax/gofax/blocklists/class_divListBlocklists.inc @@ -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 .= " "; }else{ $action.="  "; } - if(preg_match("/r/",$acl_all) && $this->parent->CopyPasteHandler){ + if($ui->is_copyable($val['dn'],"gofaxlist","blocklist") && $this->parent->CopyPasteHandler){ $action.= " "; }else{ diff --git a/gosa-plugins/gofon/gofon/conference/class_divListConferences.inc b/gosa-plugins/gofon/gofon/conference/class_divListConferences.inc index 7bd2d7205..c50340950 100644 --- a/gosa-plugins/gofon/gofon/conference/class_divListConferences.inc +++ b/gosa-plugins/gofon/gofon/conference/class_divListConferences.inc @@ -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 .= " "; }else{ $actions.="  "; } - if(preg_match("/r/",$acl_all) && $this->parent->CopyPasteHandler){ + if($ui->is_copyable($conference['dn'],"gofonconference","conference") && $this->parent->CopyPasteHandler){ $actions.= " "; }else{ diff --git a/gosa-plugins/gofon/gofon/conference/class_phoneConferenceManagment.inc b/gosa-plugins/gofon/gofon/conference/class_phoneConferenceManagment.inc index 3a138c3c6..3cf6ec65d 100644 --- a/gosa-plugins/gofon/gofon/conference/class_phoneConferenceManagment.inc +++ b/gosa-plugins/gofon/gofon/conference/class_phoneConferenceManagment.inc @@ -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"); } } diff --git a/gosa-plugins/gofon/gofon/macro/class_divListMacros.inc b/gosa-plugins/gofon/gofon/macro/class_divListMacros.inc index b9a934b1f..22b1f499f 100644 --- a/gosa-plugins/gofon/gofon/macro/class_divListMacros.inc +++ b/gosa-plugins/gofon/gofon/macro/class_divListMacros.inc @@ -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 .= " "; }else{ $action.="  "; } - if(preg_match("/r/",$acl_all) && $this->parent->CopyPasteHandler){ + if($ui->is_copyable($val['dn'],"gofonmacro","macro") && $this->parent->CopyPasteHandler){ $action.= " "; }else{ diff --git a/gosa-plugins/gofon/gofon/macro/class_gofonMacroManagement.inc b/gosa-plugins/gofon/gofon/macro/class_gofonMacroManagement.inc index 531b25635..46f9d5144 100644 --- a/gosa-plugins/gofon/gofon/macro/class_gofonMacroManagement.inc +++ b/gosa-plugins/gofon/gofon/macro/class_gofonMacroManagement.inc @@ -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"); } } diff --git a/gosa-plugins/goto/admin/applications/class_applicationManagement.inc b/gosa-plugins/goto/admin/applications/class_applicationManagement.inc index b2a9cd443..b00a8d29c 100644 --- a/gosa-plugins/goto/admin/applications/class_applicationManagement.inc +++ b/gosa-plugins/goto/admin/applications/class_applicationManagement.inc @@ -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"); } } diff --git a/gosa-plugins/goto/admin/applications/class_divListApplication.inc b/gosa-plugins/goto/admin/applications/class_divListApplication.inc index 7c57a001d..9a53e5f31 100644 --- a/gosa-plugins/goto/admin/applications/class_divListApplication.inc +++ b/gosa-plugins/goto/admin/applications/class_divListApplication.inc @@ -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 .= " "; }else{ $actions.="  "; } - if(preg_match("/r/",$acl_all) && $this->parent->CopyPasteHandler){ + if($ui->is_copyable($val['dn'],"application","application") && $this->parent->CopyPasteHandler){ $actions.= " "; }else{ diff --git a/gosa-plugins/goto/admin/devices/class_deviceManagement.inc b/gosa-plugins/goto/admin/devices/class_deviceManagement.inc index 5c6e8e98d..5cb193a08 100644 --- a/gosa-plugins/goto/admin/devices/class_deviceManagement.inc +++ b/gosa-plugins/goto/admin/devices/class_deviceManagement.inc @@ -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"); } } diff --git a/gosa-plugins/goto/admin/devices/class_divListDevices.inc b/gosa-plugins/goto/admin/devices/class_divListDevices.inc index 0407757c6..b43c492fc 100644 --- a/gosa-plugins/goto/admin/devices/class_divListDevices.inc +++ b/gosa-plugins/goto/admin/devices/class_divListDevices.inc @@ -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 .= " "; }else{ $actions.="  "; } - if(preg_match("/r/",$acl_all) && $this->parent->CopyPasteHandler){ + if($ui->is_copyable($val['dn'],"devices","deviceGeneric") && $this->parent->CopyPasteHandler){ $actions.= " "; }else{ diff --git a/gosa-plugins/goto/admin/mimetypes/class_divListMimeTypes.inc b/gosa-plugins/goto/admin/mimetypes/class_divListMimeTypes.inc index e4962746b..dbc60c501 100644 --- a/gosa-plugins/goto/admin/mimetypes/class_divListMimeTypes.inc +++ b/gosa-plugins/goto/admin/mimetypes/class_divListMimeTypes.inc @@ -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.= "is_cutable($val['dn'],"mimetypes","mimetype") && $this->parent->CopyPasteHandler){ + $action .= " "; }else{ $action.="  "; } - if(preg_match("/r/",$acl_all) && $this->parent->CopyPasteHandler){ + if($ui->is_copyable($val['dn'],"mimetypes","mimetype") && $this->parent->CopyPasteHandler){ $action.= " "; }else{ diff --git a/gosa-plugins/goto/admin/mimetypes/class_mimetypeManagement.inc b/gosa-plugins/goto/admin/mimetypes/class_mimetypeManagement.inc index c56b3d2b4..d911448dc 100644 --- a/gosa-plugins/goto/admin/mimetypes/class_mimetypeManagement.inc +++ b/gosa-plugins/goto/admin/mimetypes/class_mimetypeManagement.inc @@ -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"); } } diff --git a/gosa-plugins/sudo/admin/sudo/class_divListSudo.inc b/gosa-plugins/sudo/admin/sudo/class_divListSudo.inc index 98f418f7d..f16ddd90c 100644 --- a/gosa-plugins/sudo/admin/sudo/class_divListSudo.inc +++ b/gosa-plugins/sudo/admin/sudo/class_divListSudo.inc @@ -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.= " "; }else{ diff --git a/gosa-plugins/sudo/admin/sudo/class_sudoManagement.inc b/gosa-plugins/sudo/admin/sudo/class_sudoManagement.inc index 54d6dd523..e866e24ee 100644 --- a/gosa-plugins/sudo/admin/sudo/class_sudoManagement.inc +++ b/gosa-plugins/sudo/admin/sudo/class_sudoManagement.inc @@ -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"); # } } diff --git a/gosa-plugins/systems/admin/systems/class_divListSystem.inc b/gosa-plugins/systems/admin/systems/class_divListSystem.inc index 3d0c1ebb9..b49d1bd9c 100644 --- a/gosa-plugins/systems/admin/systems/class_divListSystem.inc +++ b/gosa-plugins/systems/admin/systems/class_divListSystem.inc @@ -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 .= " "; }else{ $action.="  "; } - if(preg_match("/r/",$acl_all) && $this->parent->CopyPasteHandler){ + if($ui->is_copyable($val['dn'],$category,$class) && $this->parent->CopyPasteHandler){ $action.= " "; }else{ $action.="  "; } + $action.= ""; diff --git a/gosa-plugins/systems/admin/systems/class_systemManagement.inc b/gosa-plugins/systems/admin/systems/class_systemManagement.inc index 5941aed45..1f115d806 100644 --- a/gosa-plugins/systems/admin/systems/class_systemManagement.inc +++ b/gosa-plugins/systems/admin/systems/class_systemManagement.inc @@ -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); } }