Code

Updated Post check for faiManagement, create branch.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 18 Jul 2007 07:18:59 +0000 (07:18 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 18 Jul 2007 07:18:59 +0000 (07:18 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@6902 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/fai/class_divListFai.inc
plugins/admin/fai/class_faiManagement.inc

index 79b98c166cd2e4e3e4d69cff96756f06fb39fcfa..c474b15e0d9f243fab07ab67e92dd16060587807 100644 (file)
@@ -80,8 +80,11 @@ class divListFai extends MultiSelectWindow
     $str = "";
     if($position  == 2){
 
-      $r = "" != search_config($this->config->data,"faiManagement","POSTREMOVE");
-      $c = "" != search_config($this->config->data,"faiManagement","POSTCREATE");
+      /* Check if there are post commands available for fai management.
+       * If not, grey out freeze/branch and release remove buttons.
+       */
+      $r = ("" != search_config($this->config->data,"faiManagement","POSTREMOVE"));
+      $c = ("" != search_config($this->config->data,"faiManagement","POSTCREATE"));
 
       $smarty = get_smarty();
       $smarty->assign("allow_create", $c);
index dbb18dc453ea74e0dcf24323e2203819415fbb6d..8059276090bae60a7207cf6652b264f5e9e7d027 100644 (file)
@@ -269,16 +269,18 @@ class faiManagement extends plugin
      */
     if($s_action == "remove_branch"){
 
-      $r = "" != search_config($this->config->data,"faiManagement","POSTREMOVE");
-      if($r){
+      /* Check if we have a post remove method configured
+       *  else skip this operation. (Skip:Button in the ui should be disabled in this case)
+       */
+      if("" != search_config($this->config->data,"faiManagement","POSTREMOVE")){
 
-        $base= $this->DivListFai->selectedBranch;
+          $base= $this->DivListFai->selectedBranch;
 
-        /* Load permissions for selected 'dn' and check if
-           we're allowed to remove this 'dn' */
-        $acl= get_permissions ($this->DivListFai->selectedBase, $this->ui->subtreeACL);
-        $this->acl= get_module_permission($acl, "FAIclass", $base);
-        if (chkacl($this->acl, "delete") == ""){
+          /* Load permissions for selected 'dn' and check if
+             we're allowed to remove this 'dn' */
+          $acl= get_permissions ($this->DivListFai->selectedBase, $this->ui->subtreeACL);
+          $this->acl= get_module_permission($acl, "FAIclass", $base);
+          if (chkacl($this->acl, "delete") == ""){
           $smarty->assign("info", sprintf(_("You're about to delete a fai branch / freeze  '%s'."), $this->DivListFai->selectedBranch));
           return($smarty->fetch(get_template_path('remove_branch.tpl',TRUE)));
         } else {
@@ -294,31 +296,34 @@ class faiManagement extends plugin
 
     if(isset($_POST['delete_branch_confirm'])){
 
-      $r = "" != search_config($this->config->data,"faiManagement","POSTREMOVE");
-
-      $bb =  $this->DivListFai->selectedBranch;
-      if(!isset($ldap)){
-        $ldap = $this->config->get_ldap_link();
-      }
-
-      $br = $this->DivListFai->AvailableBranches;
+      /* Check if we have a post remove method configured
+       *  else skip this operation. (Skip:Button in the ui should be disabled in this case)
+       */
+      if("" != search_config($this->config->data,"faiManagement","POSTREMOVE")){
 
-      if(isset($br[$bb])){
-        $name = $br[$bb];
-        $ldap->cd($bb);
-        $ldap->recursive_remove();
-        $ldap->cd(preg_replace('/,ou=fai,ou=configs,ou=systems,/', ',ou=apps,', $bb));
-        $ldap->recursive_remove();
-        $this->DivListFai->selectedBranch = "main";
-        $this->DivListFai->AvailableBranches = $this->getBranches();
+        $bb =  $this->DivListFai->selectedBranch;
+        if(!isset($ldap)){
+          $ldap = $this->config->get_ldap_link();
+        }
 
-        /* Post remove */
-        $this->lock_name   = $name;
-        $this->lock_dn     = $bb;
-        $this->postremove();
+        $br = $this->DivListFai->AvailableBranches;
+
+        if(isset($br[$bb])){
+          $name = $br[$bb];
+          $ldap->cd($bb);
+          $ldap->recursive_remove();
+          $ldap->cd(preg_replace('/,ou=fai,ou=configs,ou=systems,/', ',ou=apps,', $bb));
+          $ldap->recursive_remove();
+          $this->DivListFai->selectedBranch = "main";
+          $this->DivListFai->AvailableBranches = $this->getBranches();
+
+          /* Post remove */
+          $this->lock_name   = $name;
+          $this->lock_dn     = $bb;
+          $this->postremove();
+        }
       }
     }
-  
 
 
     /****************
@@ -458,10 +463,11 @@ class faiManagement extends plugin
     /****************
       Display dialog to enter new Branch name
      ****************/
-
-    $c = "" != search_config($this->config->data,"faiManagement","POSTMODIFY");
-
-    if($c){
+  
+    /* Check if we have a post create method configured 
+     *  else skip this operation. (Skip:Button in the ui should be disabled in this case)
+     */
+    if("" != search_config($this->config->data,"faiManagement","POSTCREATE")){
       $acl= get_permissions ($this->DivListFai->selectedBase, $this->ui->subtreeACL);
       $this->acl= get_module_permission($acl, "FAIclass", $this->DivListFai->selectedBase);
       if((($s_action == "branch_branch")||($this->dispNewBranch)) && chkacl($this->acl,"FAIclass") == ""){
@@ -476,9 +482,10 @@ class faiManagement extends plugin
       Display dialog to enter new Freeze name
      ****************/
 
-    $c = "" != search_config($this->config->data,"faiManagement","POSTMODIFY");
-
-    if($c){
+    /* Check if we have a post create method configured 
+     *  else skip this operation. (Skip:Button in the ui should be disabled in this case)
+     */
+    if("" != search_config($this->config->data,"faiManagement","POSTCREATE")){
       $acl= get_permissions ($this->DivListFai->selectedBase, $this->ui->subtreeACL);
       $this->acl= get_module_permission($acl, "FAIclass", $this->DivListFai->selectedBase);
       if((($s_action == "freeze_branch")||($this->dispNewFreeze)) && chkacl($this->acl,"FAIclass") == ""){