Code

Removed samba properties
[gosa.git] / plugins / admin / fai / class_faiScript.inc
index 8807a6119e68bbda7828de8068c83bbf3cc92434..054c3dcb628980867480066f060554e938093f16 100644 (file)
@@ -43,21 +43,12 @@ class faiScript 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"){
 
-      /* Set acls
-       */
-      $ui   = get_userinfo();
-      $acl  = get_permissions ($this->dn, $ui->subtreeACL);
-      $acli = get_module_permission($acl, "FAIclass", $this->dn);
-      $this->acl=$acli;
-
       $this->dn =$dn;
 
       /* Get FAIstate
@@ -130,7 +121,8 @@ class faiScript 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->is_dialog=true;
     }
 
@@ -154,6 +146,8 @@ class faiScript 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($this->dn);
+        $this->dialog->set_acl_category("fai");
 
 
         $_SESSION['objectinfo'] = $obj['dn'];
@@ -179,7 +173,8 @@ class faiScript extends plugin
     if((isset($_POST['EditSubObject']))&&(isset($_POST['SubObject']))){
       $script = $_POST['SubObject'][0];
       $this->dialog= new $this->subClassName($this->config,$this->dn,$this->SubObjects[$script]);
-      $this->dialog->acl = $this->acl;
+      $this->dialog->set_acl_base($_SESSION['CurrentMainBase']);
+      $this->dialog->set_acl_category("fai");
       $_SESSION['objectinfo'] = $this->SubObjects[$script]['dn'];
       $this->is_dialog=true;
     }
@@ -252,7 +247,7 @@ class faiScript extends plugin
      */
     $divlist = new divSelectBox("FAIscripts");
     $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{
@@ -288,8 +283,16 @@ class faiScript 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 => $translated){
+      $smarty->assign($name."ACL",$this->getacl($name));
     }
 
     $display.= $smarty->fetch(get_template_path('faiScript.tpl', TRUE));
@@ -328,7 +331,8 @@ class faiScript extends plugin
     $ldap = $this->config->get_ldap_link();
     $ldap->cd ($this->dn);
 
-    $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $this->dn);
+#    $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $this->dn);
+    $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $this->dn);
     if($_SESSION['faifilter']['branch'] == "main"){
       $use_dn = $this->dn;
     }
@@ -336,7 +340,8 @@ class faiScript extends plugin
     prepare_to_save_FAI_object($use_dn,array(),true);
     
     foreach($this->SubObjects as $name => $obj){
-      $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $obj['dn']);
+#      $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $obj['dn']);
+      $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $obj['dn']);
       if($_SESSION['faifilter']['branch'] == "main"){
         $use_dn = $obj['dn'];
       }
@@ -483,10 +488,8 @@ class faiScript extends plugin
           "plSection"     => array("administration"),
           "plCategory"    => array("fai"),
           "plProvidedAcls" => array(
-            "cn"                => _("Name"),
-            "description"       => _("Description"),
-            "FAIpriority"       => _("Script priority"),
-            "FAIscript"         => _("FAI script"))
+            "cn"                => _("Name")." ("._("Readonly").")",
+            "description"       => _("Description"))
           ));
   }
 }