Code

Updated FAI template entry.
[gosa.git] / gosa-plugins / fai / admin / fai / class_faiManagement.inc
index 35d5cb0600f576a3211637452705e787c4e1d787..e5f1bd8c6a3287afc75c055bbf8754e2bed563e2 100644 (file)
@@ -51,6 +51,7 @@ class faiManagement extends plugin
   var $allow_freeze_object_attach = TRUE;
 
   var $no_save;
+  var $acl_base     ="";
   var $fai_base     ="";
   var $fai_release  ="";
 
@@ -82,9 +83,8 @@ class faiManagement extends plugin
     }
 
     /* Set default release 
-       !! If you change the base here you have to update the base in 
-           class_divListFai.inc too, all ACL checks use ($this->config->current['BASE']).
      */
+    $this->acl_base = $this->config->current['BASE'];
     $this->fai_base = get_ou("faiBaseRDN").$this->config->current['BASE'];
 
     if(!session::is_set("fai_filter")){
@@ -451,7 +451,7 @@ class faiManagement extends plugin
       Delete confirmed 
      ****************/
 
-               /* Deltetion was confirmed, so delete this entry
+               /* Deletion was confirmed, so delete this entry
      */
     if (isset($_POST['delete_terminal_confirm'])){
 
@@ -541,7 +541,7 @@ class faiManagement extends plugin
       if("" != $this->config->search("faiManagement", "POSTREMOVE",array('menu','tabs'))){
         /* Load permissions for selected 'dn' and check if
            we're allowed to remove this 'dn' */
-        if($this->acl_is_removeable()){
+        if(preg_match("/d/",$this->ui->get_permissions($this->acl_base,"fai/faiManagement"))){
           $smarty->assign("release_hidden",base64_encode($this->fai_release));
           $smarty->assign("info", msgPool::deleteInfo(LDAP::fix($this->fai_release),_("FAI branch/freeze")));
           return($smarty->fetch(get_template_path('remove_branch.tpl',TRUE)));
@@ -574,7 +574,7 @@ class faiManagement extends plugin
 
           $br = $this->getBranches();
 
-          if(isset($br[$bb]) && $this->acl_is_removeable()){
+          if(isset($br[$bb]) && preg_match("/d/",$this->ui->get_permissions($this->acl_base,"fai/faiManagement"))){
             $name = $br[$bb];
 
             $ldap->cd($bb);
@@ -692,7 +692,7 @@ class faiManagement extends plugin
 
     if(isset($_GET['PerformBranch'])){
     
-      if(!$this->acl_is_createable()){
+      if(!preg_match("/c/",$this->ui->get_permissions($this->acl_base,"fai/faiManagement"))){
         msg_dialog::display(_("Permission error"), msgPool::permCreate(_("Branch")), ERROR_DIALOG);
       }else{
 
@@ -802,6 +802,7 @@ class faiManagement extends plugin
 
         echo "<div style='width:100%;text-align:right;'><form name='form' method='post' action='?plug=".$_GET['plug']."' target='_parent'>
           <br><input type='submit' name='CloseIFrame' value='"._("Continue")."'>
+          <input type='hidden' name='php_c_check' value='1'>
           </form></div>";
 
         echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>" ;
@@ -853,8 +854,8 @@ class faiManagement extends plugin
      */
     if("" != $this->config->search("faiManagement", "POSTCREATE",array('menu','tabs'))){
       if(($s_action == "branch_branch")||($this->dispNewBranch)){
-        if(!$this->acl_is_createable()){
-        msg_dialog::display(_("Permission error"), msgPool::permCreate(_("Branch")), ERROR_DIALOG);
+        if(!preg_match("/c/",$this->ui->get_permissions($this->acl_base,"fai/faiManagement"))){
+          msg_dialog::display(_("Permission error"), msgPool::permCreate(_("Branch")), ERROR_DIALOG);
         }else{
           $this->dispNewBranch=true;
           $smarty->assign("iframe",false);
@@ -874,7 +875,7 @@ class faiManagement extends plugin
      */
     if("" != $this->config->search("faiManagement", "POSTCREATE",array('menu','tabs'))){
       if(($s_action == "freeze_branch")||($this->dispNewFreeze)){
-        if(!$this->acl_is_createable()){
+        if(!preg_match("/c/",$this->ui->get_permissions($this->acl_base,"fai/faiManagement"))){
           msg_dialog::display(_("Permission error"), msgPool::permCreate(_("Branch")), ERROR_DIALOG);
         }else{
           $this->dispNewFreeze = true;
@@ -904,7 +905,7 @@ class faiManagement extends plugin
                     "new_package"       =>  _("package list"));
 
     if(isset($types[$s_action])){
-      $acl = $this->ui->get_permissions($this->fai_base,"fai/".$type_acl_mapping[$types[$s_action]]);
+      $acl = $this->ui->get_permissions($this->acl_base,"fai/".$type_acl_mapping[$types[$s_action]]);
       if(preg_match("/c/",$acl)){
         $this->dialog = new askClassName($this->config,$this->dn,$this->ui,$types[$s_action]);
         $this->dialog->parent = &$this;
@@ -917,7 +918,7 @@ class faiManagement extends plugin
     if($s_action == "new_profile"){
       $this->dn = "new" ;
 
-      $acl = $this->ui->get_permissions($this->fai_base,"fai/faiProfile");
+      $acl = $this->ui->get_permissions($this->acl_base,"fai/faiProfile");
       if(preg_match("/c/",$acl)){
         $a_setup= $this->get_type(array("objectClass"=>array("FAIprofile")));
         $this->dialog = new $a_setup[0]($this->config,$this->config->data['TABS'][$a_setup[2]],$this->dn,"fai");
@@ -1133,7 +1134,7 @@ class faiManagement extends plugin
       }
     }
     $this->base = $base;
-    $this->set_acl_base($this->base);
+    $this->set_acl_base($this->acl_base);
 
     $this->lock_type = FAI::get_release_tag(FAI::get_release_dn($base));