Code

Added category parameter to tabs.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 4 Oct 2006 09:10:38 +0000 (09:10 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 4 Oct 2006 09:10:38 +0000 (09:10 +0000)
Added some basic acls functionality to hook acls

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

plugins/admin/fai/class_faiHook.inc
plugins/admin/fai/faiHook.tpl
plugins/admin/fai/tabsHook.inc
plugins/admin/fai/tabsPackage.inc
plugins/admin/fai/tabsPartition.inc
plugins/admin/fai/tabsProfile.inc
plugins/admin/fai/tabsTemplate.inc
plugins/admin/fai/tabsVariable.inc

index cc94b04f4071943a9524d9954d65d1aaca50b5d9..b289e06501c65ad2979c4d6beb452fd484ccb55e 100644 (file)
@@ -43,21 +43,12 @@ class faiHook extends plugin
     /* Load Attributes */
     plugin::plugin ($config, $dn);
 
-    $this->acl ="#all#";
-
     /* If "dn==new" we try to create a new entry
      * Else we must read all objects from ldap which belong to this entry.
      */
     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])){
@@ -152,7 +143,8 @@ class faiHook extends plugin
           $obj  = $this->get_object_attributes($obj,$this->sub_Load_Later);
         }
         $this->dialog= new $this->subClassName($this->config,$this->dn,$obj);
-
+        $this->dialog->set_acl_base($_SESSION['CurrentMainBase']);
+        $this->dialog->set_acl_category("fai");
 
         $_SESSION['objectinfo'] = $obj['dn'];
         $this->dialog->parent = &$this;
@@ -175,7 +167,8 @@ class faiHook extends plugin
     /* Add new sub object */
     if(isset($_POST['AddSubObject'])){
       $this->dialog= new $this->subClassName($this->config,"new");
-      $this->dialog->acl = $this->acl;
+      $this->dialog->set_acl_base($_SESSION['CurrentMainBase']);
+      $this->dialog->set_acl_category("fai");
       $this->dialog->parent = &$this;
       $this->is_dialog=true;
     }
@@ -257,7 +250,7 @@ class faiHook extends plugin
 
     $divlist = new divSelectBox("FAIhooks");
     $divlist->setHeight(400);
-    if((chkacl($this->acl,"cn")!="") || ($this->FAIstate == "freeze")){
+    if($this->FAIstate == "freeze"){
       $img_edit = "<input type='image' src='images/edit.png'      name='editscript_%s'    title='"._("edit")."' alt='"._("edit")."'>";
       $img_remo = ""; 
     }else{
@@ -297,8 +290,17 @@ class faiHook extends plugin
       }
     }
 
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr."ACL",chkacl($this->acl,$attr));
+    $tmp = $this->plInfo();
+    $this->ui = get_userinfo();
+      
+    $c_dn = $this->dn;
+    if($c_dn == "new"){
+      $c_dn = $_SESSION['CurrentMainBase'];
+    }
+
+    $smarty->assign("sub_object_is_addable", preg_match("/c/",$this->ui->get_permissions($c_dn,"fai/faiScriptEntry")) && $this->FAIstate!="freeze");
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
     }
 
     $display.= $smarty->fetch(get_template_path('faiHook.tpl', TRUE));
index 03e62c361b4f484d4ef8b5b2c6834c8821d5559a..df968b1cf3e7b27cf541cdfb1689d2ab09622c25 100644 (file)
@@ -10,7 +10,9 @@
                                                        </LABEL>
                                                </td>
                                                <td>
-                                                       <input value="{$cn}" size="45" maxlength="80" disabled id="cn" {$cnACL}>
+{render acl=$cnACL}
+                                                       <input value="{$cn}" size="45" maxlength="80" disabled id="cn">
+{/render}
                                                </td>
                                        </tr>
                                        <tr>
@@ -20,7 +22,9 @@
                                                        </LABEL>
                                                </td>
                                                <td>
-                                                       <input value="{$description}" size="45" maxlength="80" {$descriptionACL} name="description" id="description">
+{render acl=$descriptionACL}
+                                                       <input value="{$description}" size="45" maxlength="80" name="description" id="description">
+{/render}
                                                </td>
                                        </tr>
                                </table>
                                <tr>
                                        <td>
                                                {$Entry_divlist}
-                                               <input type="submit" name="AddSubObject"     value="{t}Add{/t}"         title="{t}Add{/t}" {$cnACL}>
+{if $sub_object_is_addable}
+                                               <input type="submit" name="AddSubObject"     value="{t}Add{/t}" title="{t}Add{/t}">
+{else}
+                                               <input type="submit" name="AddSubObject"     value="{t}Add{/t}" title="{t}Add{/t}" disabled>
+{/if}
                                        </td>
                                </tr>
                                </table>
index 0a2a6b772b81997dc2e7363e2d143232603bbc8c..1523398cd15e26f00a8e6664dff4baa5a8e700de 100644 (file)
@@ -4,9 +4,9 @@ class tabsHook extends tabs
 {
   var $base= "";
 
-  function tabsHook($config, $data, $dn)
+  function tabsHook($config, $data, $dn,$category)
   {
-       tabs::tabs($config, $data, $dn);
+       tabs::tabs($config, $data, $dn,$category);
        /* Add references/acls/snapshots */
        $this->addSpecialTabs();
   }
index 57a5c6e96ddc67db5d2ce550f69680e6881e0931..a7e542c4872dbbbb43f543b36e78e657734b70f8 100644 (file)
@@ -4,9 +4,9 @@ class tabsPackage extends tabs
 {
   var $base= "";
 
-  function tabsPackage($config, $data, $dn)
+  function tabsPackage($config, $data, $dn,$category)
   {
-       tabs::tabs($config, $data, $dn);
+       tabs::tabs($config, $data, $dn,$category);
 
        /* Add references/acls/snapshots */
        $this->addSpecialTabs();
index a6243aca193c8319d75ff57d6897eb3f9deac30d..50b6394d719f1e9a4ecd8c2c293b01a7553e6e14 100644 (file)
@@ -4,9 +4,9 @@ class tabsPartition extends tabs
 {
   var $base= "";
 
-  function tabsPartition($config, $data, $dn)
+  function tabsPartition($config, $data, $dn,$category)
   {
-       tabs::tabs($config, $data, $dn);
+       tabs::tabs($config, $data, $dn,$category);
 
        /* Add references/acls/snapshots */
        $this->addSpecialTabs();
index a51653b2d466a9af88ae06f0397f83819af5c1ba..5828f7b6e2d9c1dcc757ed2c31b99b2f259199dc 100644 (file)
@@ -4,9 +4,9 @@ class tabsProfile extends tabs
 {
   var $base= "";
 
-  function tabsProfile($config, $data, $dn)
+  function tabsProfile($config, $data, $dn,$category)
   {
-       tabs::tabs($config, $data, $dn);
+       tabs::tabs($config, $data, $dn,$category);
 
        /* Add references/acls/snapshots */
        $this->addSpecialTabs();
index 2b765e05d07a5d0dcc3580b63182ebb844435ad0..ba5e71956b220f909cadb51bdc3a58eae7d8d3d3 100644 (file)
@@ -4,9 +4,9 @@ class tabsTemplate extends tabs
 {
   var $base= "";
 
-  function tabsTemplate($config, $data, $dn)
+  function tabsTemplate($config, $data, $dn,$category)
   {
-       tabs::tabs($config, $data, $dn);
+       tabs::tabs($config, $data, $dn, $category);
 
        /* Add references/acls/snapshots */
        $this->addSpecialTabs();
index aca820a3e7d780d55668c923e6647e3ac8173ba6..ab6707ae68c63c2e8103d243b3648f80ee4854f4 100644 (file)
@@ -4,9 +4,9 @@ class tabsVariable extends tabs
 {
   var $base= "";
 
-  function tabsVariable($config, $data, $dn)
+  function tabsVariable($config, $data, $dn,$category)
   {
-       tabs::tabs($config, $data, $dn);
+       tabs::tabs($config, $data, $dn, $category);
 
        /* Add references/acls/snapshots */
        $this->addSpecialTabs();