Code

Some fai partition acls
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 23 Oct 2006 03:51:47 +0000 (03:51 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 23 Oct 2006 03:51:47 +0000 (03:51 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4913 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/fai/class_faiPartitionTable.inc
plugins/admin/fai/class_faiPartitionTableEntry.inc
plugins/admin/fai/class_faiTemplateEntry.inc

index 5aecea0650639d962e4f3bcab7baab549dede221..5ace0cba5429e5f82528e969096116d8f6fbeec7 100644 (file)
@@ -20,6 +20,7 @@ class faiPartitionTable extends plugin
   var $dialog           = NULL;     // a dialog, e.g. new disk dialog
 
   var $FAIstate         = "";
+  var $ui;
 
   function faiPartitionTable ($config, $dn= NULL)
   {
@@ -28,6 +29,8 @@ class faiPartitionTable extends plugin
 
     $this->acl ="#all#";
 
+    $this->ui = get_userinfo();    
+
     /* If "dn==new" we try to create a new entry
      * Else we must read all objects from ldap which belong to this entry.
      * First read disks from ldap ... and then the partition definitions for the disks.
@@ -35,13 +38,6 @@ class faiPartitionTable extends plugin
     if($dn != "new"){
       $this->dn =$dn;
 
-      /* Set acls
-       */
-      $ui   = get_userinfo();
-      $acl  = get_permissions ($this->dn, $ui->subtreeACL);
-      $acli = get_module_permission($acl, "FAIclass", $this->dn);
-      $this->acl=$acli;
-
       /* Get FAIstate
        */
       if(isset($this->attrs['FAIstate'][0])){
@@ -107,6 +103,20 @@ class faiPartitionTable extends plugin
     ksort($this->disks);
   }
 
+
+  function acl_base_for_current_object($dn)
+  {
+    if($dn == "new"){
+      if($this->dn == "new"){
+        $dn= $_SESSION['CurrentMainBase'];
+      }else{
+        $dn = $this->dn;
+      }
+    }
+    return($dn);
+  }
+
+
   function execute()
   {
        /* Call parent execute */
@@ -126,7 +136,8 @@ class faiPartitionTable extends plugin
         $usedDiskNames[]= $key;
       }
       $this->dialog = new faiPartitionTableEntry($this->config,$this->dn,$usedDiskNames); 
-      $this->dialog->acl = $this->acl;
+      $this->dialog->set_acl_base($this->acl_base_for_current_object($obj['dn']));
+      $this->dialog->set_acl_category("fai");
       $this->dialog->FAIstate = $this->FAIstate;
       $this->is_dialog = true;
     }
@@ -150,7 +161,8 @@ class faiPartitionTable extends plugin
         }
       }
       $this->dialog = new faiPartitionTableEntry($this->config,$this->dn,$usedDiskNames,$this->disks[$Udisk]); 
-      $this->dialog->acl = $this->acl;
+      $this->dialog->set_acl_base($this->acl_base_for_current_object($obj['dn']));
+      $this->dialog->set_acl_category("fai");
       $this->dialog->FAIstate = $this->FAIstate;
      
       /* Set object info string, which will be displayed in plugin info line */ 
@@ -256,8 +268,14 @@ class faiPartitionTable extends plugin
       }
     }
    
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr."ACL",chkacl($this->acl,$attr));
+    $dn = $this->acl_base_for_current_object($this->dn);
+    $smarty->assign("sub_object_is_addable",
+        preg_match("/c/",$this->ui->get_permissions($dn,"fai/faiScriptEntry")) &&
+        !preg_match("/freeze/",$this->FAIstate));
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translated){
+      $smarty->assign($name."ACL",$this->getacl($name));
     }
 
     $disks = $this->getDisks();
@@ -495,15 +513,8 @@ class faiPartitionTable extends plugin
           "plSection"     => array("administration"),
           "plCategory"    => array("fai"),
           "plProvidedAcls" => array(
-            "cn"                => _("Name"),
-            "FAIpartitionType"  => _("Partition type"),
-            "FAIpartitionNr"    => _("Partition no."),
-            "FAIfsType"         => _("File system type"),
-            "FAImountPoint"     => _("Mount point"),
-            "FAIpartitionSize"  => _("Partition size"),
-            "FAImountOptions"   => _("Mount options"),
-            "FAIfsOptions"      => _("File system options"),
-            "FAIpartitionFlags" => _("Partition flags"))
+            "cn"                => _("Name")."&nbsp;("._("Read only").")",
+            "description"       => _("Description"))
           ));
   }
 }
index cc2c0619c966a059d67f13eb06aaa35dfa0fda1a..9a3804a7e5b3a42d0204bb13b0492e547223a729 100644 (file)
@@ -410,6 +410,34 @@ class faiPartitionTableEntry extends plugin
 
     return ($message);
   }
+
+  
+
+  /* Return plugin informations for acl handling */
+  function plInfo()
+  {
+    return (array(
+          "plShortName" => _("Partition table entry"),
+          "plDescription" => _("FAI partition table entry"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 27,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("fai"),
+          "plProvidedAcls" => array(
+            "cn"                => _("Name"),
+            "description"       => _("Description"),
+            "FAIpartitionType"  => _("Partition type"),
+            "FAIpartitionNr"    => _("Partition no."),
+            "FAIfsType"         => _("File system type"),
+            "FAImountPoint"     => _("Mount point"),
+            "FAIpartitionSize"  => _("Partition size"),
+            "FAImountOptions"   => _("Mount options"),
+            "FAIfsOptions"      => _("File system options"),
+            "FAIpartitionFlags" => _("Partition flags"))
+          ));
+  }
+
  
 }
 
index 24bab5d1311f3d4239325e13b4e5de9c06ffd68d..b2a70eec483c172d8a1b654bd46c8c7644446a19 100644 (file)
@@ -137,7 +137,7 @@ class faiTemplateEntry extends plugin
       $smarty->assign($attr."ACL",$this->getacl($attr,preg_match("/freeze/",$this->FAIstate)));
     }
 
-    $display.= "<h2><font color='red'>Fix / problen and ensure that size and content are correct if you download this template. Revision > 4582 (gosa-2.5 is already patched)</font></h2>".$smarty->fetch(get_template_path('faiTemplateEntry.tpl', TRUE));
+    $display.=  $smarty->fetch(get_template_path('faiTemplateEntry.tpl', TRUE));
     return($display);
   }