Code

Tolle Änderungen für ein tolles Projekt
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 6 Oct 2006 06:22:23 +0000 (06:22 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 6 Oct 2006 06:22:23 +0000 (06:22 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4860 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/fai/class_faiVariable.inc
plugins/admin/fai/class_faiVariableEntry.inc
plugins/admin/fai/faiVariable.tpl

index 0ab95a14d19261e834ff35214e7db8c17ca2f2f1..45244b5c2db2cd1890d5b43c947ec5bda11171b6 100644 (file)
@@ -41,23 +41,9 @@ class faiVariable 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.
-     * First read SubObjects from ldap ... and then the partition definitions for the SubObjects.
-     */
-
     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])){
@@ -113,7 +99,8 @@ class faiVariable 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->sel_acl_base($_SESSION['CurrentMainBase']);
+      $this->dialog->set_acl_category("fai");
       $this->is_dialog=true;
     }
 
@@ -126,8 +113,13 @@ class faiVariable extends plugin
     if((isset($_POST['EditSubObject']))&&(isset($_POST['SubObject']))){
 
       $var = $_POST['SubObject'][0];
+      $c_dn = $this->SubObjects[$var]['dn'];
+      if($c_dn=="new"){
+        $c_dn = $_SESSION['CurrentMainBase'];
+      }
       $this->dialog= new $this->subClassName($this->config,$this->dn,$this->SubObjects[$var]);
-      $this->dialog->acl = $this->acl;
+      $this->dialog->set_acl_category("fai");
+      $this->dialog->set_acl_base($c_dn);
       $_SESSION['objectinfo'] = $this->SubObjects[$var]['dn'];
       $this->is_dialog=true;
     }
@@ -135,10 +127,19 @@ class faiVariable extends plugin
     /* Remove Sub object */
     if((isset($_POST['DelSubObject']))&&(isset($_POST['SubObject']))){
       foreach($_POST['SubObject'] as $var){
-        if($this->SubObjects[$var]['status'] == "edited"){
-          $this->SubObjects[$var]['status']= "delete";
-        }else{
-          unset($this->SubObjects[$var]);
+
+        $c_dn = $this->SubObjects[$var]['dn'];
+        if($c_dn=="new"){
+          $c_dn = $_SESSION['CurrentMainBase'];
+        }
+        $ui = get_userinfo();
+        $acl = $ui->get_permissions($c_dn,"fai/faiVariable");
+        if(preg_match("/d/",$acl)){
+          if($this->SubObjects[$var]['status'] == "edited"){
+            $this->SubObjects[$var]['status']= "delete";
+          }else{
+            unset($this->SubObjects[$var]);
+          }
         }
       }
     }
@@ -210,11 +211,21 @@ class faiVariable extends plugin
       }
     }
 
-      foreach($this->attributes as $attr){
-      $smarty->assign($attr."ACL",chkacl($this->acl,$attr));
+    $this->ui = get_userinfo();
+    $c_dn = $this->dn;
+    if($c_dn == "new"){
+      $c_dn = $_SESSION['CurrentMainBase'];
     }
+    $smarty->assign("is_createable",     preg_match("/c/",$this->ui->get_permissions($c_dn,"fai/faiVariableEntry")) && $this->FAIstate!="freeze");
+    $smarty->assign("is_removeable",  preg_match("/d/",$this->ui->get_permissions($c_dn,"fai/faiVariableEntry")) && $this->FAIstate!="freeze");
 
 
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation) {
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+    
+
     $display.= $smarty->fetch(get_template_path('faiVariable.tpl', TRUE));
     return($display);
   }
@@ -389,9 +400,8 @@ class faiVariable extends plugin
           "plSection"     => array("administration"),
           "plCategory"    => array("fai"),
           "plProvidedAcls" => array(
-            "cn"                => _("Name"),
-            "description"       => _("Description"),
-            "FAIvariableContent"=> _("Variable content"))
+            "cn"                => _("Name")." ("._("Read only").")",
+            "description"       => _("Description"))
           ));
   }
 }
index 5a0e04f2ef08421922c5758b78baef2087fbfcf2..aed508d30d69bb4f6850939b92a21adb16011880 100644 (file)
@@ -121,6 +121,26 @@ class faiVariableEntry extends plugin
     $tmp['status']  = $this->status;  
     return($tmp);
   }
+
+  /* Return plugin informations for acl handling */
+  function plInfo()
+  {
+    return (array(
+          "plShortName" => _("Variable entry"),
+          "plDescription" => _("FAI variable entry "),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 23,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("fai"),
+          "plProvidedAcls" => array(
+            "cn"                => _("Name"),
+            "description"       => _("Description"),
+            "FAIvariableContent"=> _("Variable content") )
+          ));
+  }
+
+
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
index 3eff2719e672d8d2b1e98c0f0bd750b9daf37876..10b09f67cdbcfa59601969038232e6379cd815cd 100644 (file)
@@ -10,7 +10,9 @@
                                                        </LABEL>
                                                </td>
                                                <td>
+{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 size="45" maxlength="80" value="{$description}" name="description" id="description" {$descriptionACL}>
+{render acl=$descriptionACL}
+                                                       <input size="45" maxlength="80" value="{$description}" name="description" id="description">
+{/render}
                                                </td>
                                        </tr>
                                </table>
                                                        style="width:100%;" size="20" id="SubObject">
                                                        {html_options options=$SubObjects}
                                                </select><br>
-                                               <input type="submit" name="AddSubObject"     value="{t}Add{/t}"         title="{t}Add{/t}" {$cnACL}>
-                                               <input type="submit" name="EditSubObject"    value="{t}Edit{/t}"    title="{t}Edit{/t}" >
-                                               <input type="submit" name="DelSubObject"     value="{t}Delete{/t}"  title="{t}Delete{/t}" {$cnACL}>
+{if $is_createable}
+                                       <input type="submit" name="AddSubObject"     value="{t}Add{/t}"         title="{t}Add{/t}" {$cnACL}>
+{else}
+                                       <input disabled type="submit" name="AddSubObject"     value="{t}Add{/t}"                title="{t}Add{/t}" {$cnACL}>
+{/if}
+                                       <input type="submit" name="EditSubObject"    value="{t}Edit{/t}"    title="{t}Edit{/t}" >
+{if $is_removeable}
+                                       <input type="submit" name="DelSubObject"     value="{t}Delete{/t}"  title="{t}Delete{/t}" {$cnACL}>
+{else}
+                                       <input disabled type="submit" name="DelSubObject"     value="{t}Delete{/t}"  title="{t}Delete{/t}" {$cnACL}>
+{/if}
                                        </td>
                                </tr>
                                </table>