From: hickert Date: Mon, 9 Jul 2007 12:55:58 +0000 (+0000) Subject: Updated branch handling. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2ca8acedda8943b05b4d31741c3082f38ad5505b;p=gosa.git Updated branch handling. Hide release options when post methods are missing git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@6776 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/fai/branch_selector.tpl b/plugins/admin/fai/branch_selector.tpl index d76abb358..03fd36442 100644 --- a/plugins/admin/fai/branch_selector.tpl +++ b/plugins/admin/fai/branch_selector.tpl @@ -16,16 +16,18 @@
- -   - {t}Create new branch{/t} -
- -   - {t}Create new locked branch{/t} - {if $selectedBranch != "main"} + {if $allow_remove} + +   + {t}Create new branch{/t} +
+ +   + {t}Create new locked branch{/t} + {/if} + {if $selectedBranch != "main" && $allow_remove}
- +   {t}Delete current release{/t} {/if} diff --git a/plugins/admin/fai/class_divListFai.inc b/plugins/admin/fai/class_divListFai.inc index 41dd8dcdf..79b98c166 100644 --- a/plugins/admin/fai/class_divListFai.inc +++ b/plugins/admin/fai/class_divListFai.inc @@ -75,10 +75,17 @@ class divListFai extends MultiSelectWindow $this->AddRegex ("Regex", _("Display users matching"),"*" , true); } - function AddUserBoxToFilter($position){ + function AddUserBoxToFilter($position) + { $str = ""; if($position == 2){ + + $r = "" != search_config($this->config->data,"faiManagement","POSTREMOVE"); + $c = "" != search_config($this->config->data,"faiManagement","POSTCREATE"); + $smarty = get_smarty(); + $smarty->assign("allow_create", $c); + $smarty->assign("allow_remove", $r); $smarty->assign("selectedBranch",$this->selectedBranch); $smarty->assign("branchimage","images/branch.png"); $smarty->assign("branches",$this->AvailableBranches); diff --git a/plugins/admin/fai/class_faiManagement.inc b/plugins/admin/fai/class_faiManagement.inc index 77ebbda94..1b199d8b9 100644 --- a/plugins/admin/fai/class_faiManagement.inc +++ b/plugins/admin/fai/class_faiManagement.inc @@ -268,17 +268,22 @@ class faiManagement extends plugin /* Remove branch */ if($s_action == "remove_branch"){ - $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") == ""){ - $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 { - print_red (_("You are not allowed to delete this release!")); + $r = "" != search_config($this->config->data,"faiManagement","POSTREMOVE"); + if($r){ + + $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") == ""){ + $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 { + print_red (_("You are not allowed to delete this release!")); + } } } @@ -288,6 +293,9 @@ 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(); @@ -310,6 +318,7 @@ class faiManagement extends plugin $this->postremove(); } } + } /**************** @@ -450,27 +459,34 @@ class faiManagement extends plugin Display dialog to enter new Branch name ****************/ - $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") == ""){ - $this->dispNewBranch=true; - $smarty->assign("iframe",false); - $display .= $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__))); - return($display); + $c = "" != search_config($this->config->data,"faiManagement","POSTCREATE"); + + if($c){ + $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") == ""){ + $this->dispNewBranch=true; + $smarty->assign("iframe",false); + $display .= $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__))); + return($display); + } } - - + /**************** Display dialog to enter new Freeze name ****************/ - $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") == ""){ - $this->dispNewFreeze = true; - $smarty->assign("iframe",false); - $display .= $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__))); - return($display); + $c = "" != search_config($this->config->data,"faiManagement","POSTCREATE"); + + if($c){ + $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") == ""){ + $this->dispNewFreeze = true; + $smarty->assign("iframe",false); + $display .= $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__))); + return($display); + } }