Code

FAI template
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 17 Jul 2008 09:18:41 +0000 (09:18 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 17 Jul 2008 09:18:41 +0000 (09:18 +0000)
-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
gosa-plugins/fai/admin/fai/class_faiTemplateEntry.inc
gosa-plugins/fai/admin/fai/faiTemplateEntry.tpl

index 76fdcfaec749128fc9f4c3b0b8e39600c4baac65..75ee77434948fb8f7fcae7108fac6ade8be0e479 100644 (file)
@@ -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));
index 0d288b1bc1107623e4f77b45fc1b6e99da0bb410..85f3ea6f818af26621377961690a58dabae6e966 100644 (file)
@@ -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); 
index a6a1dd4165d261a01ca8f19cbb73cce5e0670702..e13d95c0a886a60546da02b075b4bf8d54771ad7 100644 (file)
 <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>
 </td>