From bc145d1c1e9fce5246aecec2e3d5d243b34951ba Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 17 Jul 2008 09:04:51 +0000 Subject: [PATCH] Updated ACL -Updated ACL handling for Hooks && profiles git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11698 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-plugins/fai/admin/fai/class_faiHook.inc | 9 +- .../fai/admin/fai/class_faiHookEntry.inc | 11 +- .../fai/admin/fai/class_faiProfile.inc | 118 +++++++++--------- gosa-plugins/fai/admin/fai/faiHookEntry.tpl | 2 + 4 files changed, 67 insertions(+), 73 deletions(-) diff --git a/gosa-plugins/fai/admin/fai/class_faiHook.inc b/gosa-plugins/fai/admin/fai/class_faiHook.inc index eb9d837fe..6dbbf3ad3 100644 --- a/gosa-plugins/fai/admin/fai/class_faiHook.inc +++ b/gosa-plugins/fai/admin/fai/class_faiHook.inc @@ -44,12 +44,6 @@ class faiHook extends plugin if($dn != "new"){ $this->dn =$dn; - /* Get FAIstate - */ - if(isset($this->attrs['FAIstate'][0])){ - $this->FAIstate = $this->attrs['FAIstate'][0]; - } - /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry) */ $ldap = $this->config->get_ldap_link(); @@ -174,6 +168,7 @@ class faiHook extends plugin } $this->dialog= new $this->subClassName($this->config,$this->dn,$obj); + $this->dialog->FAIstate = $this->FAIstate; $this->dialog->set_acl_base($this->acl_base_for_current_object($obj['dn'])); $this->dialog->set_acl_category("fai"); @@ -218,6 +213,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->FAIstate = $this->FAIstate; $this->dialog->acl = $this->acl; session::set('objectinfo',$obj['dn']); $this->dialog->parent = &$this; @@ -233,6 +229,7 @@ class faiHook extends plugin $c_dn = $this->acl_base_for_current_object($this->dn); $this->dialog= new $this->subClassName($this->config,"new"); $this->dialog->set_acl_base($c_dn); + $this->dialog->FAIstate = $this->FAIstate; $this->dialog->set_acl_category("fai"); $this->dialog->parent = &$this; $this->is_dialog=true; diff --git a/gosa-plugins/fai/admin/fai/class_faiHookEntry.inc b/gosa-plugins/fai/admin/fai/class_faiHookEntry.inc index fd983aeca..2fcff5700 100644 --- a/gosa-plugins/fai/admin/fai/class_faiHookEntry.inc +++ b/gosa-plugins/fai/admin/fai/class_faiHookEntry.inc @@ -31,11 +31,6 @@ class faiHookEntry extends plugin $oname = $name; $this->$oname=$value; } - - if(isset($this->attrs['FAIstate'][0])){ - $this->FAIstate = $this->attrs['FAIstate'][0]; - } - }elseif(is_array($object)){ if(count($object)){ $this->orig_cn= $object['cn']; @@ -110,10 +105,7 @@ class faiHookEntry extends plugin $tmp = $this->plInfo(); foreach($tmp['plProvidedAcls'] as $name => $translated){ - $acl = $this->getacl($name); - if($this->FAIstate == "freezed"){ - $acl = preg_replace("/w/","",$acl); - } + $acl = $this->getacl($name, preg_match("/freeze/",$this->FAIstate)); $smarty->assign($name."ACL",$acl); } @@ -122,6 +114,7 @@ class faiHookEntry extends plugin }else{ $smarty->assign("FAIscript" , htmlentities($this->FAIscript)); } + $smarty->assign("freeze" , preg_match("/freeze/",$this->FAIstate)); $display.= $smarty->fetch(get_template_path('faiHookEntry.tpl', TRUE)); return($display); } diff --git a/gosa-plugins/fai/admin/fai/class_faiProfile.inc b/gosa-plugins/fai/admin/fai/class_faiProfile.inc index b7792ca10..9465d1e4b 100644 --- a/gosa-plugins/fai/admin/fai/class_faiProfile.inc +++ b/gosa-plugins/fai/admin/fai/class_faiProfile.inc @@ -40,10 +40,6 @@ class faiProfile extends plugin } } - if(isset($this->attrs['FAIstate'][0])){ - $this->FAIstate = $this->attrs['FAIstate'][0]; - } - /* Sort assigned classes */ if(is_array($tmp2)){ foreach($tmp2 as $class){ @@ -214,64 +210,66 @@ class faiProfile extends plugin /* Remove class name From list */ $sort_once = false; - foreach($_POST as $name => $post){ - if(preg_match("/DEL_/i",$name) && $this->acl_is_writeable("FAIclass")){ - $s_action = "delete"; - $s_entry = preg_replace("/DEL_/","",$name); - $s_entry = base64_decode(preg_replace("/_.*$/","",$s_entry)); - }elseif(preg_match("/Add_class/i",$name)&& $this->acl_is_writeable("FAIclass")){ - $s_action = "add"; - }elseif(preg_match("/DelClass/i",$name) && $this->acl_is_writeable("FAIclass")){ - $s_action = "delete"; - $s_entry = $_POST['FAIclass']; - }elseif(preg_match("/AddClass/i",$name) && $this->acl_is_writeable("FAIclass")){ - $s_action = "add"; - } + if(!preg_match("/freeze/",$this->FAIstate)){ + foreach($_POST as $name => $post){ + if(preg_match("/DEL_/i",$name) && $this->acl_is_writeable("FAIclass")){ + $s_action = "delete"; + $s_entry = preg_replace("/DEL_/","",$name); + $s_entry = base64_decode(preg_replace("/_.*$/","",$s_entry)); + }elseif(preg_match("/Add_class/i",$name)&& $this->acl_is_writeable("FAIclass")){ + $s_action = "add"; + }elseif(preg_match("/DelClass/i",$name) && $this->acl_is_writeable("FAIclass")){ + $s_action = "delete"; + $s_entry = $_POST['FAIclass']; + }elseif(preg_match("/AddClass/i",$name) && $this->acl_is_writeable("FAIclass")){ + $s_action = "add"; + } - /* Check if a list element should be pushed one position up */ - if((preg_match("/sortup_/",$name))&&(!$sort_once) && $this->acl_is_writeable("FAIclass")){ - $sort_once = true; - $val = preg_replace("/sortup_/","",$name); - $val = preg_replace("/_.*$/","",$val); - $val = base64_decode($val); - $this->catUp($val); - } - - /* Check if a list element should be pushed one position down */ - if((preg_match("/sortdown_/",$name))&&(!$sort_once) && $this->acl_is_writeable("FAIclass")){ - $sort_once = true; - $val = preg_replace("/sortdown_/","",$name); - $val = preg_replace("/_.*$/","",$val); - $val = base64_decode($val); - $this->catDown($val); - } + /* Check if a list element should be pushed one position up */ + if((preg_match("/sortup_/",$name))&&(!$sort_once) && $this->acl_is_writeable("FAIclass")){ + $sort_once = true; + $val = preg_replace("/sortup_/","",$name); + $val = preg_replace("/_.*$/","",$val); + $val = base64_decode($val); + $this->catUp($val); + } - } + /* Check if a list element should be pushed one position down */ + if((preg_match("/sortdown_/",$name))&&(!$sort_once) && $this->acl_is_writeable("FAIclass")){ + $sort_once = true; + $val = preg_replace("/sortdown_/","",$name); + $val = preg_replace("/_.*$/","",$val); + $val = base64_decode($val); + $this->catDown($val); + } - if($s_action == "delete" && $this->acl_is_writeable("FAIclass")){ - unset($this->FAIclasses[$s_entry]); - } + } - if($s_action == "add" && $this->acl_is_writeable("FAIclass")){ - $this->dialog = new faiProfileEntry($this->config,$this->dn,$this->FAIclasses,$this->parent->parent->fai_release); - $this->is_dialog =true; - } + if($s_action == "delete" && $this->acl_is_writeable("FAIclass")){ + unset($this->FAIclasses[$s_entry]); + } - /* Save Dialog */ - if(isset($_POST['SaveSubObject'])){ - $this->dialog->save_object(); - $msgs= $this->dialog->check(); - if(count($msgs)){ - msg_dialog::display(_("Error"), $msgs, ERROR_DIALOG); - }else{ - $ret = $this->dialog->save(); - foreach($ret as $class){ - $this->FAIclasses[$class] =$class; + if($s_action == "add" && $this->acl_is_writeable("FAIclass")){ + $this->dialog = new faiProfileEntry($this->config,$this->dn,$this->FAIclasses,$this->parent->parent->fai_release); + $this->is_dialog =true; + } + + /* Save Dialog */ + if(isset($_POST['SaveSubObject'])){ + $this->dialog->save_object(); + $msgs= $this->dialog->check(); + if(count($msgs)){ + msg_dialog::display(_("Error"), $msgs, ERROR_DIALOG); + }else{ + $ret = $this->dialog->save(); + foreach($ret as $class){ + $this->FAIclasses[$class] =$class; + } + $this->is_dialog=false; + unset($this->dialog); + $this->dialog=FALSE; + //ksort($this->FAIclasses); } - $this->is_dialog=false; - unset($this->dialog); - $this->dialog=FALSE; - //ksort($this->FAIclasses); } } @@ -330,6 +328,8 @@ class faiProfile extends plugin } } + $smarty->assign("freeze", preg_match("/freeze/i",$this->FAIstate)); + $smarty->assign("FAIclasses" ,$this->FAIclasses); $smarty->assign("divlist" ,$divlist->DrawList()); @@ -352,7 +352,7 @@ class faiProfile extends plugin $tmp = $this->plInfo(); foreach($tmp['plProvidedAcls'] as $name => $translated){ - $smarty->assign($name."ACL",$this->getacl($name)); + $smarty->assign($name."ACL",$this->getacl($name, preg_match("/freeze/",$this->FAIstate))); } $display.= $smarty->fetch(get_template_path('faiProfile.tpl', TRUE)); @@ -375,7 +375,9 @@ class faiProfile extends plugin */ function save_object() { - plugin::save_object(); + if(!preg_match("/freeze/",$this->FAIstate)){ + plugin::save_object(); + } } diff --git a/gosa-plugins/fai/admin/fai/faiHookEntry.tpl b/gosa-plugins/fai/admin/fai/faiHookEntry.tpl index e8d2b14db..2040cba68 100644 --- a/gosa-plugins/fai/admin/fai/faiHookEntry.tpl +++ b/gosa-plugins/fai/admin/fai/faiHookEntry.tpl @@ -82,7 +82,9 @@

 


+{if !$freeze}   +{/if}
-- 2.30.2