From d3f3d73f8440e87788b9b8e5bf74c53ff4ace09f Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 5 Oct 2006 04:55:51 +0000 Subject: [PATCH] Added fai priorities Fixed fai script acls git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4854 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/fai/class_faiHook.inc | 18 ++++--- plugins/admin/fai/class_faiHookEntry.inc | 31 +++++++++-- plugins/admin/fai/class_faiPackage.inc | 2 +- plugins/admin/fai/class_faiPartitionTable.inc | 2 +- plugins/admin/fai/class_faiProfile.inc | 2 +- plugins/admin/fai/class_faiScript.inc | 54 +++++++++++++------ plugins/admin/fai/class_faiScriptEntry.inc | 14 ++--- plugins/admin/fai/class_faiTemplate.inc | 2 +- plugins/admin/fai/class_faiVariable.inc | 2 +- plugins/admin/fai/faiHookEntry.tpl | 26 ++++++--- 10 files changed, 109 insertions(+), 44 deletions(-) diff --git a/plugins/admin/fai/class_faiHook.inc b/plugins/admin/fai/class_faiHook.inc index b289e0650..d37c897ba 100644 --- a/plugins/admin/fai/class_faiHook.inc +++ b/plugins/admin/fai/class_faiHook.inc @@ -143,7 +143,7 @@ class faiHook extends plugin $obj = $this->get_object_attributes($obj,$this->sub_Load_Later); } $this->dialog= new $this->subClassName($this->config,$this->dn,$obj); - $this->dialog->set_acl_base($_SESSION['CurrentMainBase']); + $this->dialog->set_acl_base($this->dn); $this->dialog->set_acl_category("fai"); $_SESSION['objectinfo'] = $obj['dn']; @@ -166,8 +166,14 @@ class faiHook extends plugin /* Add new sub object */ if(isset($_POST['AddSubObject'])){ + + $c_dn = $this->dn; + if($c_dn == "new"){ + $c_dn = $_SESSION['CurrentMainBase']; + } + $this->dialog= new $this->subClassName($this->config,"new"); - $this->dialog->set_acl_base($_SESSION['CurrentMainBase']); + $this->dialog->set_acl_base($c_dn); $this->dialog->set_acl_category("fai"); $this->dialog->parent = &$this; $this->is_dialog=true; @@ -488,14 +494,12 @@ class faiHook extends plugin "plDescription" => _("FAI hook"), "plSelfModify" => FALSE, "plDepends" => array(), - "plPriority" => 0, + "plPriority" => 20, "plSection" => array("administration"), "plCategory" => array("fai"), "plProvidedAcls" => array( - "cn" => _("Name"), - "description" => _("Description"), - "FAItast" => _("Task"), - "FAIscript" => _("FAI script")) + "cn" => _("Name")." ("._("Read only").")", + "description" => _("Description")) )); } } diff --git a/plugins/admin/fai/class_faiHookEntry.inc b/plugins/admin/fai/class_faiHookEntry.inc index c73d2e886..b3e222736 100644 --- a/plugins/admin/fai/class_faiHookEntry.inc +++ b/plugins/admin/fai/class_faiHookEntry.inc @@ -107,12 +107,13 @@ class faiHookEntry extends plugin } } - foreach($this->attributes as $attr){ - if(($this->FAIstate == "freeze") || (chkacl($this->acl,$attr)!= "")){ - $smarty->assign($attr."ACL"," disabled "); - }else{ - $smarty->assign($attr."ACL"," "); + $tmp = $this->plInfo(); + foreach($tmp['plProvidedAcls'] as $name => $translated){ + $acl = $this->getacl($name); + if($this->FAIstate == "freezed"){ + $acl = preg_replace("/w/","",$acl); } + $smarty->assign($name."ACL",$acl); } $display.= $smarty->fetch(get_template_path('faiHookEntry.tpl', TRUE)); @@ -169,6 +170,26 @@ class faiHookEntry extends plugin $tmp['status'] = $this->status; return($tmp); } + + /* Return plugin informations for acl handling */ + function plInfo() + { + return (array( + "plShortName" => _("Hook entry"), + "plDescription" => _("FAI hook entry"), + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 21, + "plSection" => array("administration"), + "plCategory" => array("fai"), + "plProvidedAcls" => array( + "cn" => _("Name"), + "description" => _("Description"), + "FAItask" => _("Task"), + "FAIscript" => _("FAI script")) + )); + } + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/plugins/admin/fai/class_faiPackage.inc b/plugins/admin/fai/class_faiPackage.inc index f40c1eaea..989ff1be3 100644 --- a/plugins/admin/fai/class_faiPackage.inc +++ b/plugins/admin/fai/class_faiPackage.inc @@ -548,7 +548,7 @@ class faiPackage extends plugin "plDescription" => _("FAI Package list"), "plSelfModify" => FALSE, "plDepends" => array(), - "plPriority" => 0, + "plPriority" => 30, "plSection" => array("administration"), "plCategory" => array("fai"), "plProvidedAcls" => array( diff --git a/plugins/admin/fai/class_faiPartitionTable.inc b/plugins/admin/fai/class_faiPartitionTable.inc index 0e5e30921..5aecea065 100644 --- a/plugins/admin/fai/class_faiPartitionTable.inc +++ b/plugins/admin/fai/class_faiPartitionTable.inc @@ -491,7 +491,7 @@ class faiPartitionTable extends plugin "plDescription" => _("FAI partition table"), "plSelfModify" => FALSE, "plDepends" => array(), - "plPriority" => 0, + "plPriority" => 26, "plSection" => array("administration"), "plCategory" => array("fai"), "plProvidedAcls" => array( diff --git a/plugins/admin/fai/class_faiProfile.inc b/plugins/admin/fai/class_faiProfile.inc index c1e5c8f0f..2641a0b5f 100644 --- a/plugins/admin/fai/class_faiProfile.inc +++ b/plugins/admin/fai/class_faiProfile.inc @@ -438,7 +438,7 @@ class faiProfile extends plugin "plDescription" => _("FAI profile"), "plSelfModify" => FALSE, "plDepends" => array(), - "plPriority" => 0, + "plPriority" => 28, "plSection" => array("administration"), "plCategory" => array("fai"), "plProvidedAcls" => array( diff --git a/plugins/admin/fai/class_faiScript.inc b/plugins/admin/fai/class_faiScript.inc index 054c3dcb6..1fbd6d64c 100644 --- a/plugins/admin/fai/class_faiScript.inc +++ b/plugins/admin/fai/class_faiScript.inc @@ -120,8 +120,14 @@ class faiScript extends plugin /* Add new sub object */ if(isset($_POST['AddSubObject'])){ + + $c_dn = $this->dn; + if($c_dn == "new"){ + $c_dn = $_SESSION['CurrentMainBase']; + } + $this->dialog= new $this->subClassName($this->config,"new"); - $this->dialog->set_acl_base($_SESSION['CurrentMainBase']); + $this->dialog->set_acl_base($c_dn); $this->dialog->set_acl_category("fai"); $this->is_dialog=true; } @@ -159,10 +165,20 @@ class faiScript extends plugin $entry = preg_replace("/^deletescript_/","",$name); $entry = base64_decode(preg_replace("/_.*/","",$entry)); - if(($this->SubObjects[$entry]['status'] == "edited")||($this->SubObjects[$entry]['status'] == "FreshLoaded")){ - $this->SubObjects[$entry]['status']= "delete"; - }else{ - unset($this->SubObjects[$entry]); + + $dn = $this->SubObjects[$entry]['dn']; + + if($dn == "new"){ + $dn = $_SESSION['CurrentMainBase']; + } + $acl = $this->ui -> get_permissions($dn,"fai/faiScriptEntry") ; + + if(preg_match("/d/",$acl)){ + if(($this->SubObjects[$entry]['status'] == "edited")||($this->SubObjects[$entry]['status'] == "FreshLoaded")){ + $this->SubObjects[$entry]['status']= "delete"; + }else{ + unset($this->SubObjects[$entry]); + } } } } @@ -247,16 +263,24 @@ class faiScript extends plugin */ $divlist = new divSelectBox("FAIscripts"); $divlist->setHeight(400); - if(($this->FAIstate == "freeze")){ - $img_edit = ""; - $img_remo = ""; - }else{ - $img_edit = ""; - $img_remo = ""; - } - foreach($this->getList(true) as $key => $name){ + $dn= $name['dn']; + if($dn == "new"){ + $dn = $_SESSION['CurrentMainBase']; + } + $acl = $this->ui -> get_permissions($dn,"fai/faiScriptEntry") ; + $act = ""; + + if($this->FAIstate == "freeze"){ + $act .= ""; + }else{ + $act .= ""; + if(preg_match("/d/",$acl)){ + $act .=""; + } + } + if(($this->SubObjects[$key]['status'] == "new") || ($this->SubObjects[$key]['dn'] == "new")){ $down = ""; }else{ @@ -267,7 +291,7 @@ class faiScript extends plugin $divlist->AddEntry(array( array("string"=>$name['name']), array("string"=>$down , "attach" => "style='width:20px;'"), - array("string"=>str_replace("%s",base64_encode($key),$img_edit.$img_remo), + array("string"=>str_replace("%s",base64_encode($key),$act), "attach"=>"style='border-right: 0px;width:50px;text-align:right;'"))); } $smarty->assign("Entry_divlist",$divlist->DrawList()); @@ -484,7 +508,7 @@ class faiScript extends plugin "plDescription" => _("FAI script"), "plSelfModify" => FALSE, "plDepends" => array(), - "plPriority" => 0, + "plPriority" => 18, "plSection" => array("administration"), "plCategory" => array("fai"), "plProvidedAcls" => array( diff --git a/plugins/admin/fai/class_faiScriptEntry.inc b/plugins/admin/fai/class_faiScriptEntry.inc index 2c6bcf070..2a56bcb0d 100644 --- a/plugins/admin/fai/class_faiScriptEntry.inc +++ b/plugins/admin/fai/class_faiScriptEntry.inc @@ -63,7 +63,7 @@ class faiScriptEntry extends plugin $smarty = get_smarty(); $display = ""; - if(isset($_POST['ImportUpload'])){ + if(isset($_POST['ImportUpload']) && $this->acl_is_writeable("FAIscript")){ if(($_FILES['ImportFile']['error']!=0)){ print_red(_("Please select a valid file.")); }else @@ -115,10 +115,12 @@ class faiScriptEntry extends plugin { if((isset($_POST['SubObjectFormSubmitted'])) && ($this->FAIstate != "freeze")){ foreach($this->attributes as $attrs){ - if(isset($_POST[$attrs])){ - $this->$attrs = $_POST[$attrs]; - }else{ - $this->$attrs = ""; + if($this->acl_is_writeable($attrs)){ + if(isset($_POST[$attrs])){ + $this->$attrs = $_POST[$attrs]; + }else{ + $this->$attrs = ""; + } } } } @@ -170,7 +172,7 @@ class faiScriptEntry extends plugin "plDescription" => _("FAI script entry"), "plSelfModify" => FALSE, "plDepends" => array(), - "plPriority" => 0, + "plPriority" => 19, "plSection" => array("administration"), "plCategory" => array("fai"), "plProvidedAcls" => array( diff --git a/plugins/admin/fai/class_faiTemplate.inc b/plugins/admin/fai/class_faiTemplate.inc index 161d4fdcb..4255fb71b 100644 --- a/plugins/admin/fai/class_faiTemplate.inc +++ b/plugins/admin/fai/class_faiTemplate.inc @@ -452,7 +452,7 @@ class faiTemplate extends plugin "plDescription" => _("FAI template"), "plSelfModify" => FALSE, "plDepends" => array(), - "plPriority" => 0, + "plPriority" => 24, "plSection" => array("administration"), "plCategory" => array("fai"), "plProvidedAcls" => array( diff --git a/plugins/admin/fai/class_faiVariable.inc b/plugins/admin/fai/class_faiVariable.inc index ccc6170b6..0ab95a14d 100644 --- a/plugins/admin/fai/class_faiVariable.inc +++ b/plugins/admin/fai/class_faiVariable.inc @@ -385,7 +385,7 @@ class faiVariable extends plugin "plDescription" => _("FAI variable"), "plSelfModify" => FALSE, "plDepends" => array(), - "plPriority" => 0, + "plPriority" => 22, "plSection" => array("administration"), "plCategory" => array("fai"), "plProvidedAcls" => array( diff --git a/plugins/admin/fai/faiHookEntry.tpl b/plugins/admin/fai/faiHookEntry.tpl index ad25455ce..2ab571413 100644 --- a/plugins/admin/fai/faiHookEntry.tpl +++ b/plugins/admin/fai/faiHookEntry.tpl @@ -9,7 +9,9 @@ {t}Name{/t}{$must}  - +{render acl=$cnACL} + +{/render} @@ -17,7 +19,9 @@ {t}Description{/t}  - +{render acl=$descriptionACL} + +{/render} @@ -33,9 +37,11 @@ - {html_options values=$tasks output=$tasks selected=$FAItask} +{/render} @@ -53,21 +59,29 @@
+{render acl=$FAIscriptACL} +{/render}

-   - +{render acl=$FAIscriptACL} +   +{/render} +{render acl=$FAIscriptACL} + +{/render} +{render acl=$FAIscriptACL} {$DownMe} +{/render}

 


-   +  
-- 2.30.2