From c68cb076ffbf74c3962ff4f97ce6c671fddeaa74 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 17 Jul 2008 09:18:41 +0000 Subject: [PATCH] FAI template -Updated ACL checks and freezed object handling. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11699 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-plugins/fai/admin/fai/class_faiTemplate.inc | 15 ++++++--------- .../fai/admin/fai/class_faiTemplateEntry.inc | 8 ++------ gosa-plugins/fai/admin/fai/faiTemplateEntry.tpl | 2 ++ 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/gosa-plugins/fai/admin/fai/class_faiTemplate.inc b/gosa-plugins/fai/admin/fai/class_faiTemplate.inc index 76fdcfaec..75ee77434 100644 --- a/gosa-plugins/fai/admin/fai/class_faiTemplate.inc +++ b/gosa-plugins/fai/admin/fai/class_faiTemplate.inc @@ -46,12 +46,6 @@ class faiTemplate 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(); @@ -152,6 +146,7 @@ class faiTemplate extends plugin } $this->dialog= new $this->subClassName($this->config,$this->dn,$obj); $this->dialog->set_acl_base($this->acl_base); + $this->dialog->FAIstate = $this->FAIstate; $this->dialog->set_acl_category("fai"); session::set('objectinfo',$obj['dn']); @@ -159,7 +154,7 @@ class faiTemplate extends plugin $this->is_dialog=true; } } - if(preg_match("/^deletescript_/",$name)&&($once)){ + if(preg_match("/^deletescript_/",$name)&&($once) && !preg_match("/freeze/",$this->FAIstate)){ $once = false; $entry = preg_replace("/^deletescript_/","",$name); $entry = base64_decode(preg_replace("/_.*/","",$entry)); @@ -195,6 +190,7 @@ class faiTemplate 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; @@ -203,13 +199,14 @@ class faiTemplate extends plugin } /* Add new sub object */ - if(isset($_POST['AddSubObject'])){ + if(isset($_POST['AddSubObject']) && !preg_match("/freeze/",$this->FAIstate)){ $acl_dn = "cn=dummy,".$this->acl_base_for_current_object($this->dn); $acl = $this->ui->get_permissions($acl_dn,"fai/faiTemplateEntry"); if(preg_match("/c/",$acl)){ $this->dialog= new $this->subClassName($this->config,"new"); $this->dialog->set_acl_base($this->acl_base); + $this->dialog->FAIstate = $this->FAIstate; $this->dialog->set_acl_category("fai"); $this->dialog->parent = &$this; $this->is_dialog=true; @@ -350,7 +347,7 @@ class faiTemplate extends plugin !preg_match("/freeze/",$this->FAIstate)); foreach($this->attributes as $attr){ - $smarty->assign($attr."ACL",$this->getacl($attr)); + $smarty->assign($attr."ACL",$this->getacl($attr, preg_match("/freeze/",$this->FAIstate))); } $display.= $smarty->fetch(get_template_path('faiTemplate.tpl', TRUE)); diff --git a/gosa-plugins/fai/admin/fai/class_faiTemplateEntry.inc b/gosa-plugins/fai/admin/fai/class_faiTemplateEntry.inc index 0d288b1bc..85f3ea6f8 100644 --- a/gosa-plugins/fai/admin/fai/class_faiTemplateEntry.inc +++ b/gosa-plugins/fai/admin/fai/class_faiTemplateEntry.inc @@ -34,11 +34,6 @@ class faiTemplateEntry extends plugin $oname = $name; $this->$oname=$value; } - - if(isset($this->attrs['FAIstate'][0])){ - $this->FAIstate = $this->attrs['FAIstate'][0]; - } - }else{ $this->status = "new"; $this->orig_cn= false; @@ -140,6 +135,7 @@ class faiTemplateEntry extends plugin /* We now split cn/FAItemplatePath to make things more clear... */ $smarty->assign("cn", basename($this->FAItemplatePath)); $smarty->assign("templatePath", dirname($this->FAItemplatePath)); + $smarty->assign("freeze", preg_match("/freeze/i",$this->FAIstate));; $display.= $smarty->fetch(get_template_path('faiTemplateEntry.tpl', TRUE)); return($display); @@ -201,7 +197,7 @@ class faiTemplateEntry extends plugin } if(!preg_match('/^\//', $this->FAItemplatePath)){ - $message[]= msgPool::invalid(_("Destination path"),$this->FAItemplatePath,'/^\//'); + $message[]= msgPool::invalid(_("Destination path"),"","","/path"); } $b = basename($this->FAItemplatePath); diff --git a/gosa-plugins/fai/admin/fai/faiTemplateEntry.tpl b/gosa-plugins/fai/admin/fai/faiTemplateEntry.tpl index a6a1dd416..e13d95c0a 100644 --- a/gosa-plugins/fai/admin/fai/faiTemplateEntry.tpl +++ b/gosa-plugins/fai/admin/fai/faiTemplateEntry.tpl @@ -185,7 +185,9 @@

 


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