From a949052953b98ab04e87f4303a740996569ea4b2 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 28 May 2008 05:50:28 +0000 Subject: [PATCH] Updated ACL - Copy & paste git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11050 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../mimetypes/class_divListMimeTypes.inc | 6 +-- .../mimetypes/class_mimetypeManagement.inc | 54 +++++++++++++------ 2 files changed, 39 insertions(+), 21 deletions(-) diff --git a/gosa-plugins/goto/admin/mimetypes/class_divListMimeTypes.inc b/gosa-plugins/goto/admin/mimetypes/class_divListMimeTypes.inc index 53872dabb..e4962746b 100644 --- a/gosa-plugins/goto/admin/mimetypes/class_divListMimeTypes.inc +++ b/gosa-plugins/goto/admin/mimetypes/class_divListMimeTypes.inc @@ -175,10 +175,8 @@ class divListMimeTypes 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-plugins/goto/admin/mimetypes/class_mimetypeManagement.inc b/gosa-plugins/goto/admin/mimetypes/class_mimetypeManagement.inc index debe254dd..c56b3d2b4 100644 --- a/gosa-plugins/goto/admin/mimetypes/class_mimetypeManagement.inc +++ b/gosa-plugins/goto/admin/mimetypes/class_mimetypeManagement.inc @@ -321,26 +321,40 @@ class mimetypeManagement extends plugin $this->dns = array(); if(count($ids)){ + $disallowed = array(); foreach($ids as $id){ - $this->dns[$id] = $this->mimetypes[$id]['dn']; + $dn = $this->mimetypes[$id]['dn']; + $acl = $this->ui->get_permissions($dn, "mimetypes/mimetype"); + 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)){ + + /* Check locks */ + if ($user= get_multiple_locks($this->dns)){ + return(gen_locked_message($user,$this->dns)); + } - add_lock ($this->dns, $this->ui->dn); + $dns_names = array(); + foreach($this->dns as $dn){ + $dns_names[] = @LDAP::fix($dn); + } - /* Lock the current entry, so nobody will edit it during deletion */ - $smarty->assign("info", msgPool::deleteInfo($dns_names,_("Mime type"))); - $smarty->assign("multiple", true); - return($smarty->fetch(get_template_path('remove.tpl', TRUE))); + 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,_("Mime type"))); + $smarty->assign("multiple", true); + return($smarty->fetch(get_template_path('remove.tpl', TRUE))); + } } } @@ -590,16 +604,22 @@ class mimetypeManagement 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->mimetypes[$s_entry]['dn']; - $this->CopyPasteHandler->add_to_queue($dn,$s_action,"mimetabs","MIMETABS","mimetypes"); + if($s_action == "copy" && preg_match("/r/",$ui->has_complete_category_acls($dn,"mimetypes"))){ + $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"))){ + $this->CopyPasteHandler->add_to_queue($dn,$s_action,"mimetabs","MIMETABS","mimetypes"); + } } - /* Add entries to queue */ if($s_action == "copy_multiple" || $s_action == "cut_multiple"){ @@ -610,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"){ + if($s_action == "copy_multiple" && preg_match("/r/",$ui->has_complete_category_acls($dn,"mimetypes"))){ $this->CopyPasteHandler->add_to_queue($dn,"copy","mimetabs","MIMETABS","mimetypes"); } - if($s_action == "cut_multiple"){ + if($s_action == "cut_multiple" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"mimetypes"))){ $this->CopyPasteHandler->add_to_queue($dn,"cut","mimetabs","MIMETABS","mimetypes"); } } -- 2.30.2