From 797169dc1dc028a77206ac144e455c1498048f8b Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 17 Jul 2008 10:05:50 +0000 Subject: [PATCH] Updated FAI partition tables. -Fixed ACLs && freeze checks git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11702 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../fai/admin/fai/class_faiPartitionTable.inc | 17 +++++++---------- .../admin/fai/class_faiPartitionTableEntry.inc | 15 +++++---------- .../fai/admin/fai/faiPartitionTable.tpl | 7 ++++++- .../fai/admin/fai/faiPartitionTableEntry.tpl | 16 +++++++++------- 4 files changed, 27 insertions(+), 28 deletions(-) diff --git a/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc b/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc index b1d6dffde..20f408279 100644 --- a/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc +++ b/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc @@ -34,12 +34,6 @@ class faiPartitionTable extends plugin if($dn != "new"){ $this->dn =$dn; - /* Get FAIstate - */ - if(isset($this->attrs['FAIstate'][0])){ - $this->FAIstate = $this->attrs['FAIstate'][0]; - } - /* Read all disks from ldap taht are defined fot this partition table */ $ldap = $this->config->get_ldap_link(); @@ -135,7 +129,7 @@ class faiPartitionTable extends plugin * This code adds a new HDD to the disks * A new Dialog will be opened */ - if(isset($_POST['AddDisk'])){ + if(isset($_POST['AddDisk']) && !preg_match("/freeze/i",$this->FAIstate)){ $usedDiskNames =array(); foreach($this->disks as $key=>$disk){ $usedDiskNames[]= $key; @@ -197,7 +191,7 @@ class faiPartitionTable extends plugin */ if(isset($_POST['SaveDisk'])){ - if (!preg_match("/freeze/", $this->FAIstate)){ + if (!preg_match("/freeze/i", $this->FAIstate)){ $this->dialog->save_object(); if(count($this->dialog->check())){ foreach($this->dialog->check() as $msg){ @@ -238,7 +232,7 @@ class faiPartitionTable extends plugin * Assign delete status for all its partitions */ if((isset($_POST['DelDisk']))&&(!empty($_POST['disks']))){ - if (!preg_match("/freeze/", $this->FAIstate)){ + if (!preg_match("/freeze/i", $this->FAIstate)){ foreach($_POST['disks'] as $disk) { if(isset($this->disks[$disk])){ @@ -284,10 +278,13 @@ class faiPartitionTable extends plugin $smarty->assign("sub_object_is_addable", preg_match("/c/",$this->ui->get_permissions($dn,"fai/faiPartitionTableEntry")) && !preg_match("/freeze/",$this->FAIstate)); + $smarty->assign("sub_object_is_removeable", + preg_match("/d/",$this->ui->get_permissions($dn,"fai/faiPartitionTableEntry")) && + !preg_match("/freeze/",$this->FAIstate)); $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/i",$this->FAIstate))); } $disks = $this->getDisks(); $smarty->assign("disks" ,$disks); diff --git a/gosa-plugins/fai/admin/fai/class_faiPartitionTableEntry.inc b/gosa-plugins/fai/admin/fai/class_faiPartitionTableEntry.inc index ee62ddd09..82be75525 100644 --- a/gosa-plugins/fai/admin/fai/class_faiPartitionTableEntry.inc +++ b/gosa-plugins/fai/admin/fai/class_faiPartitionTableEntry.inc @@ -109,7 +109,7 @@ class faiPartitionTableEntry extends plugin * The number specifies the index we want to delete */ foreach($_POST as $name => $value){ - if((preg_match("/Delete_.*/",$name)) && $this->acl_is_removeable()){ + if((preg_match("/Delete_.*/",$name)) && $this->acl_is_removeable() && !preg_match("/freeze/i",$this->FAIstate)){ $tmp = split("_",$name); $s_action = "remove"; $s_entry = $tmp[1]; @@ -120,7 +120,7 @@ class faiPartitionTableEntry extends plugin * We must sort the index again, else we possibly got problems * with partitions order. */ - if($s_action == "remove" && $this->acl_is_removeable()){ + if($s_action == "remove" && $this->acl_is_removeable() && !preg_match("/freeze/i",$this->FAIstate)){ if($this->partitions[$s_entry]['status'] == "edited"){ $this->deletePartitions[$s_entry]= $this->partitions[$s_entry]; $this->deletePartitions[$s_entry]['FAIpartitionNr']=$s_entry; @@ -138,7 +138,7 @@ class faiPartitionTableEntry extends plugin /* To add a partitions we only append an empty * array to the already defined partitions. */ - if(isset($_POST['AddPartition']) && $this->acl_is_createable()){ + if(isset($_POST['AddPartition']) && $this->acl_is_createable() && !preg_match("/freeze/i",$this->FAIstate)){ foreach($this->UsedAttrs as $attr){ $tmp[$attr] = ""; } @@ -157,17 +157,12 @@ class faiPartitionTableEntry extends plugin $tmp = $this->plInfo(); $sacl = ""; foreach($tmp['plProvidedAcls'] as $name => $translated){ - - $acl = $this->getacl($name); - $sacl .= $acl; - if($this->FAIstate == "freezed"){ - $acl = preg_replace("/w/","",$acl); - } + $acl = $this->getacl($name, preg_match("/freeze/i",$this->FAIstate)); $smarty->assign($name."ACL",$acl); } - $smarty->assign("allowSave",$sacl); $smarty->assign("sub_object_is_createable",$this->acl_is_createable()); + $smarty->assign("freeze",preg_match("/freeze/i",$this->FAIstate)); /* Fetch template and show the result */ diff --git a/gosa-plugins/fai/admin/fai/faiPartitionTable.tpl b/gosa-plugins/fai/admin/fai/faiPartitionTable.tpl index 537d06a4b..b5f1e2eae 100644 --- a/gosa-plugins/fai/admin/fai/faiPartitionTable.tpl +++ b/gosa-plugins/fai/admin/fai/faiPartitionTable.tpl @@ -48,11 +48,16 @@ {if $sub_object_is_addable} {else} - + {/if} + +{if $sub_object_is_removeable} +{else} + +{/if} diff --git a/gosa-plugins/fai/admin/fai/faiPartitionTableEntry.tpl b/gosa-plugins/fai/admin/fai/faiPartitionTableEntry.tpl index 4b920ed0a..d535b3e17 100644 --- a/gosa-plugins/fai/admin/fai/faiPartitionTableEntry.tpl +++ b/gosa-plugins/fai/admin/fai/faiPartitionTableEntry.tpl @@ -24,19 +24,21 @@

 {t}Partition entries{/t}

{$setup}
-{if $sub_object_is_createable} - -{else} - +{if !$freeze} + {if $sub_object_is_createable} + + {else} + + {/if} {/if}

 


-{render acl=$allowSave} - -{/render} +{if !$freeze} + +{/if}
-- 2.30.2