From: hickert Date: Fri, 6 Oct 2006 04:24:45 +0000 (+0000) Subject: Script & Hook acl improvements X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=0adbff1190cf5933e2f48f5c9022496de7bade2e;p=gosa.git Script & Hook acl improvements git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4859 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/fai/class_faiHook.inc b/plugins/admin/fai/class_faiHook.inc index d37c897ba..f86302e93 100644 --- a/plugins/admin/fai/class_faiHook.inc +++ b/plugins/admin/fai/class_faiHook.inc @@ -151,14 +151,23 @@ class faiHook extends plugin $this->is_dialog=true; } if(preg_match("/^deletescript_/",$name)&&($once)){ - $once = false; - $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= $name['dn']; + if($dn == "new"){ + $dn = $_SESSION['CurrentMainBase']; + } + $acl = $this->ui -> get_permissions($dn,"fai/faiScriptEntry") ; + + if(preg_match("/d/",$acl)){ + $once = false; + $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]); + } } } } @@ -256,17 +265,29 @@ class faiHook extends plugin $divlist = new divSelectBox("FAIhooks"); $divlist->setHeight(400); - if($this->FAIstate == "freeze"){ - $img_edit = ""; - $img_remo = ""; - }else{ - $img_edit = ""; - $img_remo = ""; - } foreach($this->getList(true) as $key => $name){ - if(($this->SubObjects[$key]['status'] == "new") || ($this->SubObjects[$key]['dn'] == "new")){ + $dn= $name['dn']; + if($dn == "new"){ + $dn = $_SESSION['CurrentMainBase']; + } + $ui = get_userinfo(); + $acl = $ui->get_permissions($dn,"fai/faiScriptEntry") ; + $act = ""; + + if($this->FAIstate == "freeze"){ + $act .= ""; + }else{ + $act .= ""; + if(preg_match("/d/",$acl)){ + $act .=""; + } + } + + + $s_acl = $ui->get_permissions($dn,"fai/faiScriptEntry","FAIscript") ; + if(($this->SubObjects[$key]['status'] == "new") || ($this->SubObjects[$key]['dn'] == "new") || !preg_match("/r/",$s_acl)){ $down = ""; }else{ $down = " @@ -276,7 +297,7 @@ class faiHook 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()); diff --git a/plugins/admin/fai/class_faiHookEntry.inc b/plugins/admin/fai/class_faiHookEntry.inc index b3e222736..9a9450c77 100644 --- a/plugins/admin/fai/class_faiHookEntry.inc +++ b/plugins/admin/fai/class_faiHookEntry.inc @@ -79,9 +79,9 @@ class faiHookEntry extends plugin } /* Create download button*/ - if($this->dn != "new"){ + if($this->dn != "new" && $this->acl_is_readable("FAIscript")){ $smarty->assign("DownMe"," - + "._("Download")." "); }else{ $smarty->assign("DownMe",""); @@ -125,10 +125,12 @@ class faiHookEntry 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 = ""; + } } } } diff --git a/plugins/admin/fai/class_faiScript.inc b/plugins/admin/fai/class_faiScript.inc index 1fbd6d64c..24d047534 100644 --- a/plugins/admin/fai/class_faiScript.inc +++ b/plugins/admin/fai/class_faiScript.inc @@ -269,7 +269,8 @@ class faiScript extends plugin if($dn == "new"){ $dn = $_SESSION['CurrentMainBase']; } - $acl = $this->ui -> get_permissions($dn,"fai/faiScriptEntry") ; + $ui = get_userinfo(); + $acl = $ui->get_permissions($dn,"fai/faiScriptEntry") ; $act = ""; if($this->FAIstate == "freeze"){ @@ -281,7 +282,8 @@ class faiScript extends plugin } } - if(($this->SubObjects[$key]['status'] == "new") || ($this->SubObjects[$key]['dn'] == "new")){ + $s_acl = $ui->get_permissions($dn,"fai/faiScriptEntry","FAIscript") ; + if(($this->SubObjects[$key]['status'] == "new") || ($this->SubObjects[$key]['dn'] == "new") || !preg_match("/r/",$s_acl)){ $down = ""; }else{ $down = " diff --git a/plugins/admin/fai/class_faiScriptEntry.inc b/plugins/admin/fai/class_faiScriptEntry.inc index 2a56bcb0d..f7473c553 100644 --- a/plugins/admin/fai/class_faiScriptEntry.inc +++ b/plugins/admin/fai/class_faiScriptEntry.inc @@ -84,7 +84,7 @@ class faiScriptEntry extends plugin } /* Create download button*/ - if($this->dn != "new"){ + if($this->dn != "new" && $this->acl_is_readable("FAIscript")){ $smarty->assign("DownMe"," ");