From bb0467f48474482220fb363d1f8fef181395b7d7 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 20 Aug 2007 13:11:55 +0000 Subject: [PATCH] Added Acls to gotomasses git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7078 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../addons/gotomasses/class_gotomasses.inc | 61 ++++++++++++------- 1 file changed, 40 insertions(+), 21 deletions(-) diff --git a/plugins/addons/gotomasses/class_gotomasses.inc b/plugins/addons/gotomasses/class_gotomasses.inc index 9af6b1777..cda521c68 100644 --- a/plugins/addons/gotomasses/class_gotomasses.inc +++ b/plugins/addons/gotomasses/class_gotomasses.inc @@ -56,9 +56,14 @@ class gotomasses extends plugin /* Remove entry from list */ if($s_action == "remove" && isset($this->tasks[$s_entry])){ - $smarty->assign("info",_("Your are about to delete a gotomasses task.")); - $this->current = $s_entry; - return($smarty->fetch(get_template_path('remove.tpl', TRUE))); + + if(!$this->acl_is_removeable()){ + print_red(_("You are not allowed to remove a task.")); + }else{ + $smarty->assign("info",_("Your are about to delete a gotomasses task.")); + $this->current = $s_entry; + return($smarty->fetch(get_template_path('remove.tpl', TRUE))); + } } /* Remove entry, remove is confirmed */ @@ -76,7 +81,7 @@ class gotomasses extends plugin } /* New entry */ - if($s_action== "new_task"){ + if($s_action== "new_task" && $this->acl_is_createable()){ $this->dialog = new goto_task($this->config,$this); $this->current = -1; } @@ -127,11 +132,24 @@ class gotomasses extends plugin $divlist->EnableCloseButton(FALSE); $divlist->EnableSaveButton(FALSE); $divlist->SetInformation(_("This menu allows you to add, remove and change the properties of gotomasses tasks.")); - - $header = "
- -
"; - + + /* Display add button if allowed */ + if($this->acl_is_createable()){ + $header = "
+ +
"; + }else{ + $header = ""; + } + + /* Get Permissions */ + $ui = get_userinfo(); + $acls = $this->getacl(""); + foreach($ui->get_module_departments("gotomasses") as $dep){ + $acls .= $ui->get_category_permissions($dep,"gotomasses"); + } + + /* Create divlist */ $divlist->SetListHeader($header); $divlist->AddHeader(array("string"=>""._("Target")."")); $divlist->AddHeader(array("string"=>""._("Schedule")."", @@ -140,18 +158,19 @@ class gotomasses extends plugin "attach"=>"style='width:60px;'")); $divlist->AddHeader(array("string"=>_("Action"), "attach"=>"style='border-right:0px;width:40px;'")); - foreach($this->tasks as $key => $task){ - - $action = ""; - $action.= ""; - - $field1 = array("string" => "
".$this->target_to_string($task)."
"); - $field2 = array("string" => $this->time_to_string($task),"attach" => "style='width:100px;'"); - $field3 = array("string" => $this->action_to_string($task),"attach" => "style='width:60px;'"); - $field4 = array("string" => $action,"attach" => "style='width:40px;border-right:0px;'"); - - - $divlist->AddElement(array($field1,$field2,$field3,$field4)); + + if(!empty($acls)){ + foreach($this->tasks as $key => $task){ + $action = ""; + if($this->acl_is_removeable()){ + $action.= ""; + } + $field1 = array("string" => "
".$this->target_to_string($task)."
"); + $field2 = array("string" => $this->time_to_string($task),"attach" => "style='width:100px;'"); + $field3 = array("string" => $this->action_to_string($task),"attach" => "style='width:60px;'"); + $field4 = array("string" => $action,"attach" => "style='text-align:right;width:40px;border-right:0px;'"); + $divlist->AddElement(array($field1,$field2,$field3,$field4)); + } } return($divlist->Draw()); -- 2.30.2