From d262b341e7b57c22c404e81250d8ce3c38d5dfb1 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 23 Jul 2008 08:04:53 +0000 Subject: [PATCH] Updated repository service -Fixed ACLs for section add/delete. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11761 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../repository/class_servRepository.inc | 21 ++++--- .../repository/class_servRepositorySetup.inc | 57 ++++++++++--------- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/gosa-plugins/fai/admin/systems/services/repository/class_servRepository.inc b/gosa-plugins/fai/admin/systems/services/repository/class_servRepository.inc index 759d45d71..349f28ef3 100644 --- a/gosa-plugins/fai/admin/systems/services/repository/class_servRepository.inc +++ b/gosa-plugins/fai/admin/systems/services/repository/class_servRepository.inc @@ -306,8 +306,6 @@ class servrepository extends goService { $fields = goService::getListEntry(); $fields['Message'] = _("Repository service"); - #$fields['AllowEdit'] = true; - #$fields['AllowStart'] = #$fields['AllowStop'] = #$fields['AllowRestart'] = false; return($fields); } @@ -351,15 +349,16 @@ class servrepository extends goService "plCategory" => array("server"), "plProvidedAcls"=> array( - "cn" => _("Name"), - "start" => _("Start"), - "stop" => _("Stop"), - "restart" => _("Restart"), - "Release" => _("Releases"), - "Section" => _("Sections"), - "ParentServer" => _("Parent server"), - "Url" => _("Url")) - )); +# "start" => _("Service start"), // Remove this to hide the start button at all. +# "stop" => _("Service stop"), // Remove this to hide the stop button at all. +# "restart" => _("Service restart"),// Remove this to hide the restart button at all. + + "cn" => _("Name"), + "Release" => _("Releases"), + "Section" => _("Sections"), + "ParentServer" => _("Parent server"), + "Url" => _("Url")) + )); } } diff --git a/gosa-plugins/fai/admin/systems/services/repository/class_servRepositorySetup.inc b/gosa-plugins/fai/admin/systems/services/repository/class_servRepositorySetup.inc index ac3509a8e..0c4bbd1c9 100644 --- a/gosa-plugins/fai/admin/systems/services/repository/class_servRepositorySetup.inc +++ b/gosa-plugins/fai/admin/systems/services/repository/class_servRepositorySetup.inc @@ -46,7 +46,7 @@ class servRepositorySetup extends plugin return(false); } - + function execute() { @@ -56,51 +56,52 @@ class servRepositorySetup extends plugin /* Fill templating stuff */ $smarty= get_smarty(); - if((isset($_POST['AddSection']))&&(isset($_POST['SectionName']))&&(!empty($_POST['SectionName']))){ + if(preg_match("/w/",$this->parent->getacl("Section"))){ + if((isset($_POST['AddSection']))&&(isset($_POST['SectionName']))&&(!empty($_POST['SectionName']))){ - /* Replace multiple spaces with a single, and cut of white spaces (trim)*/ - $val = preg_replace("/\ \ * /" , " ", trim($_POST['SectionName'])); + /* Replace multiple spaces with a single, and cut of white spaces (trim)*/ + $val = preg_replace("/\ \ * /" , " ", trim($_POST['SectionName'])); - /* check if there are more than one entry given ( "section1 section2 )*/ - if(preg_match("/ /",$val)){ + /* check if there are more than one entry given ( "section1 section2 )*/ + if(preg_match("/ /",$val)){ - /* Generate list of new section names */ - $vals = split(" ",$val); + /* Generate list of new section names */ + $vals = split(" ",$val); - /* Add new entries */ - foreach($vals as $entry){ - $entry = trim($entry); - if(!empty($entry)){ - $this->Sections[$entry]=$entry; + /* Add new entries */ + foreach($vals as $entry){ + $entry = trim($entry); + if(!empty($entry)){ + $this->Sections[$entry]=$entry; + } } + }else{ + $this->Sections[$val]=$val; } - }else{ - $this->Sections[$val]=$val; } - } - - foreach($_POST as $name => $value){ - if(preg_match("/^delete_/",$name)){ - $val = preg_replace("/^delete_/","",$name); - $val = base64_decode(preg_replace("/_.*$/","",$val)); + foreach($_POST as $name => $value){ + if(preg_match("/^delete_/",$name)){ - if(isset($this->Sections[$val])){ - unset($this->Sections[$val]); + $val = preg_replace("/^delete_/","",$name); + $val = base64_decode(preg_replace("/_.*$/","",$val)); + + if(isset($this->Sections[$val])){ + unset($this->Sections[$val]); + } } } } $divlist = new divSelectBox("servRepositorySetup"); $divlist->setHeight("220"); - $dellink = ""; - foreach($this->Sections as $sec){ $divlist->AddEntry(array( - array("string"=>$sec), - array("string"=>sprintf($dellink,base64_encode($sec),$sec),"attach"=>"style='border-right:0px;width:20px;'") - )); + array("string"=>$sec), + array("string"=>sprintf($dellink,base64_encode($sec),$sec), + "attach"=>"style='border-right:0px;width:20px;'") + )); } $smarty->assign("Sections",$divlist->DrawList()); -- 2.30.2