From: hickert Date: Tue, 27 May 2008 13:45:11 +0000 (+0000) Subject: Added copy & Paste acl check X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=687fe71fd8e45ef5286beb2aef96c06f2e7df66c;p=gosa.git Added copy & Paste acl check git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11047 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/plugins/admin/ogroups/class_divListOGroup.inc b/gosa-core/plugins/admin/ogroups/class_divListOGroup.inc index 7ffedd183..e13efd64b 100644 --- a/gosa-core/plugins/admin/ogroups/class_divListOGroup.inc +++ b/gosa-core/plugins/admin/ogroups/class_divListOGroup.inc @@ -223,11 +223,8 @@ class divListOGroup extends MultiSelectWindow $s.= "..|---|\n"; $s.= "..|". " "._("Copy")."|"."multiple_copy_systems|\n"; - - if(is_object($this->parent->CopyPasteHandler) && preg_match("/(r.*d|d.*r)/",$acl_all)){ - $s.= "..|". - " "._("Cut")."|"."multiple_cut_systems|\n"; - } + $s.= "..|". + " "._("Cut")."|"."multiple_cut_systems|\n"; } /* Copy & paste icons */ diff --git a/gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc b/gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc index 2add7e445..6fd1cb247 100644 --- a/gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc +++ b/gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc @@ -221,26 +221,40 @@ class ogroupManagement extends plugin if(count($ids)){ $this->dns = array(); + $disallowed = array(); foreach($ids as $id){ - $this->dns[$id] = $this->ogrouplist[$id]['dn']; + $dn = $this->ogrouplist[$id]['dn']; + $acl = $this->ui->get_permissions($dn, "users/user"); + 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); - } + if(count($this->dns)){ - add_lock ($this->dns, $this->ui->dn); + /* Check locks */ + if ($user= get_multiple_locks($this->dns)){ + return(gen_locked_message($user,$this->dns)); + } - /* Lock the current entry, so nobody will edit it during deletion */ - $smarty->assign("info", msgPool::deleteInfo($dns_names,_("object group"))); - $smarty->assign("multiple", true); - return($smarty->fetch(get_template_path('remove.tpl', TRUE))); + $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,_("object group"))); + $smarty->assign("multiple", true); + return($smarty->fetch(get_template_path('remove.tpl', TRUE))); + } } } @@ -629,13 +643,20 @@ class ogroupManagement 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->ogrouplist[$s_entry]['dn']; - $this->CopyPasteHandler->add_to_queue($dn,$s_action,"ogrouptabs","OGROUPTABS","ogroups"); + 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 == "cut" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"ogroups"))){ + $this->CopyPasteHandler->add_to_queue($dn,$s_action,"ogrouptabs","OGROUPTABS","ogroups"); + } } @@ -649,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"){ + if($s_action == "copy_multiple" && preg_match("/r/",$ui->has_complete_category_acls($dn,"ogroups"))){ $this->CopyPasteHandler->add_to_queue($dn,"copy","ogrouptabs","OGROUPTABS","ogroups"); } - if($s_action == "cut_multiple"){ + if($s_action == "cut_multiple" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"ogroups"))){ $this->CopyPasteHandler->add_to_queue($dn,"cut","ogrouptabs","OGROUPTABS","ogroups"); } }