Code

Updated FAI variable
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 17 Jul 2008 09:35:47 +0000 (09:35 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 17 Jul 2008 09:35:47 +0000 (09:35 +0000)
- Fixed ACLs and freezed object handling

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11700 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/fai/admin/fai/class_faiVariable.inc
gosa-plugins/fai/admin/fai/class_faiVariableEntry.inc
gosa-plugins/fai/admin/fai/faiVariableEntry.tpl

index 377f3ee385df8dc9ff42d4b31b43c6d99dee637b..22fa65001b429606d7e824f705a9292b3442b9f6 100644 (file)
@@ -40,12 +40,6 @@ class faiVariable 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();
@@ -118,11 +112,12 @@ class faiVariable extends plugin
     $display= "";
 
     /* Add new sub object */
-    if(isset($_POST['AddSubObject'])){
+    if(isset($_POST['AddSubObject']) && !preg_match("/freeze/i",$this->FAIstate)){
       $this->dialog= new $this->subClassName($this->config,"new");
       $this->dialog->set_acl_base($this->acl_base_for_current_object($this->dn));
       $this->dialog->set_acl_category("fai");
       $this->dialog->parent = &$this;
+      $this->dialog->FAIstate = $this->FAIstate;
       $this->is_dialog=true;
     }
 
@@ -139,13 +134,14 @@ class faiVariable extends plugin
       $this->dialog= new $this->subClassName($this->config,$this->dn,$this->SubObjects[$var]);
       $this->dialog->set_acl_category("fai");
       $this->dialog->set_acl_base($c_dn);
+      $this->dialog->FAIstate = $this->FAIstate;
       $this->dialog->parent = &$this;
       session::set('objectinfo',$this->SubObjects[$var]['dn']);
       $this->is_dialog=true;
     }
     
     /* Remove Sub object */
-    if((isset($_POST['DelSubObject']))&&(isset($_POST['SubObject']))){
+    if((isset($_POST['DelSubObject']))&&(isset($_POST['SubObject'])) && !preg_match("/freeze/i",$this->FAIstate)){
       foreach($_POST['SubObject'] as $var){
 
         $c_dn = $this->acl_base_for_current_object($this->SubObjects[$var]['dn']);
@@ -161,7 +157,7 @@ class faiVariable extends plugin
     }
 
     /* Save Dialog */
-    if(isset($_POST['SaveSubObject'])){
+    if(isset($_POST['SaveSubObject']) && !preg_match("/freeze/i",$this->FAIstate)){
       $this->dialog->save_object();
       $msgs = $this->dialog->check();
       if(count($msgs)>0){
@@ -237,12 +233,12 @@ class faiVariable extends plugin
     }
 
     $c_dn = $this->acl_base_for_current_object($this->dn);
-    $smarty->assign("is_createable",     preg_match("/c/",$this->ui->get_permissions($c_dn,"fai/faiVariableEntry")) && !preg_match("/freeze/", $this->FAIstate));
+    $smarty->assign("is_createable", preg_match("/c/",$this->ui->get_permissions($c_dn,"fai/faiVariableEntry")) && !preg_match("/freeze/", $this->FAIstate));
     $smarty->assign("is_removeable",  preg_match("/d/",$this->ui->get_permissions($c_dn,"fai/faiVariableEntry")) && !preg_match("/freeze/", $this->FAIstate));
 
     $tmp = $this->plInfo();
     foreach($tmp['plProvidedAcls'] as $name => $translation) {
-      $smarty->assign($name."ACL",$this->getacl($name));
+      $smarty->assign($name."ACL",$this->getacl($name,preg_match("/freeze/i",$this->FAIstate)));
     }
     
 
index 50e7348203146fb3636108a4863770ad048318d7..a60d10e220307b74d09ca010c786bee93b80d7e1 100644 (file)
@@ -26,11 +26,6 @@ class faiVariableEntry extends plugin
         $oname = $name;
         $this->$oname=addslashes($value);
       }
-
-      if(isset($this->attrs['FAIstate'][0])){
-        $this->FAIstate = $this->attrs['FAIstate'][0];
-      }
-
     }else{
       $this->status = "new";
       $this->orig_cn       = false;
@@ -59,19 +54,16 @@ class faiVariableEntry 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);
     }
 
-
-
+    $smarty->assign("freeze",preg_match("/freeze/",$this->FAIstate));
     $display.= $smarty->fetch(get_template_path('faiVariableEntry.tpl', TRUE));
     return($display);
   }
 
+
   /* Save data to object */
   function save_object()
   {
index f044cc5be28b982f4ca70d9619ddc088e279a108..e69797718916d4cca253a630973c16c266a19e14 100644 (file)
@@ -51,7 +51,9 @@
 <p class="seperator">&nbsp;</p>
 <br>
 <div style="align:right;" align="right">
+{if !$freeze}
        <input type="submit" value="{msgPool type=applyButton}"         name="SaveSubObject" >&nbsp;
+{/if}
        <input type="submit" value="{msgPool type=cancelButton}"        name="CancelSubObject">
 </div>