summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2d53536)
raw | patch | inline | side by side (parent: 2d53536)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 6 Jan 2010 09:01:37 +0000 (09:01 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 6 Jan 2010 09:01:37 +0000 (09:01 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15073 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/fai/admin/fai/class_faiManagement.inc | patch | blob | history |
diff --git a/gosa-plugins/fai/admin/fai/class_faiManagement.inc b/gosa-plugins/fai/admin/fai/class_faiManagement.inc
index c918b423594bfdb3743b2a01ab36dd5647b36127..f245e934d934564cae0efd8838ead932f451608f 100644 (file)
protected $aclPlugin = "role";
protected $objectName = "role";
+ // Attributes Managed by this plugin can be used in post events
+ protected $attributes = array("lock_type","lock_name","lock_dn");
var $dispNewBranch=false;
var $dispNewFreeze=false;
$this->registerAction("createBranch","createBranch");
$this->registerAction("createFreeze","createFreeze");
$this->registerAction("removeBranch","removeBranch");
+ $this->registerAction("removeBranchConfirmed","removeBranchConfirmed");
$this->registerAction("saveBranch","saveBranch");
$this->registerAction("PerformBranch","PerformBranch");
parent::__construct($config, $ui, "roles", $headpage);
$action = management::detectPostActions();
if(isset($_POST['faiGroupHandle_cancel'])) $action['action'] = "cancel";
if(isset($_POST['CancelBranchName'])) $action['action'] = "cancel";
+ if(isset($_POST['delete_branch_confirm'])) $action['action'] = "removeBranchConfirmed";
if(isset($_GET['PerformBranch'])) $action['action'] = "PerformBranch";
if(isset($_POST['UseBranchName'])) $action['action'] = "saveBranch";
if(isset($_POST['faiGroupHandle_apply'])) $action['action'] = "editByGroup";
function removeBranch()
{
+ /* Check if we have a post remove method configured
+ * else skip this operation. (Skip:Button in the ui should be disabled in this case too)
+ */
+ 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(preg_match("/d/",$this->ui->get_permissions($this->acl_base,"fai/faiManagement"))){
+ $smarty=get_smarty();
+ $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)));
+ } else {
+ msg_dialog::display(_("Permission error"), _("You have no permission to delete this release!"), ERROR_DIALOG);
+ }
+ }
+ }
+
+
+ function removeBranchConfirmed()
+ {
+ /* Check if we have a post remove method configured
+ * else skip this operation. (Skip:Button in the ui should be disabled in this case too)
+ */
+ if("" != $this->config->search("faiManagement", "POSTREMOVE",array('menu','tabs'))){
+
+ if(!isset($_POST['release_hidden']) || base64_decode($_POST['release_hidden']) != $this->fai_release){
+ msg_dialog::display(_("Warning"),_("Release remove aborted because the release name check failed!"));
+ }else{
+
+ $bb = $this->fai_release;
+ $ldap = $this->config->get_ldap_link();
+
+ $br = $this->getBranches();
+
+ if(isset($br[$bb]) && preg_match("/d/",$this->ui->get_permissions($this->acl_base,"fai/faiManagement"))){
+ $name = $br[$bb];
+
+ $ldap->cd($bb);
+ $ldap->recursive_remove();
+ $ldap->cd(preg_replace('/,'.preg_quote(get_ou('faiBaseRDN'), '/').'/i', ','.get_ou('applicationRDN'), $bb));
+ $ldap->recursive_remove();
+ $ldap->cd(preg_replace('/,'.preg_quote(get_ou('faiBaseRDN'), '/').'/i', ','.get_ou('mimetypeRDN'), $bb));
+ $ldap->recursive_remove();
+
+ /* Search for all groups with configured application menus.
+ - First search all groups, to ensure that we only remove entries form whithin groups.
+ - The search für menu configuration for the specified release and collect all those dns.
+ - Remove entries
+ */
+ $release_ou = preg_replace("/".preg_quote(get_ou("faiBaseRDN"), '/').".*$/i","",$bb);
+ $ldap->cd($this->config->current['BASE']);
+ $ldap->search("(objectClass=posixGroup)",array("dn"));
+
+ /* Collect all group dns
+ */
+ $groups = array();
+ while($attrs = $ldap->fetch()){
+ $groups[] = $attrs['dn'];
+ }
+
+
+ /* Collect all group menu release dns that match the release we have removed
+ */
+ $dns = array();
+ foreach($groups as $dn){
+ $ldap->cd($dn);
+ $ldap->search("(objectClass=FAIbranch)",array("dn"));
+ while($attrs = $ldap->fetch()){
+ if(preg_match("/^".preg_quote($release_ou, '/')."/",$attrs['dn'])){
+ $dns[] = $attrs['dn'];
+ }
+ }
+ }
+
+ /* Finally remove collected release dns
+ */
+ foreach($dns as $dn){
+ $ldap->cd($dn);
+ $ldap->recursive_remove();
+ }
+ /* Post remove */
+ $this->fai_release = $this->fai_base;
+ $this->lock_name = $name;
+ $this->lock_dn = $bb;
+ $this->postremove();
+
+ $fai_filter = session::get("fai_filter");
+ $fai_filter['fai_release'] = $this->fai_release;
+ session::set("fai_filter",$fai_filter);
+
+ new log("remove","fai/".get_class($this),$br[$bb],array(),"Release removed");
+ }
+ }
}
+ }
function createBranch()
{
$smarty = get_smarty();
$this->dispNewBranch=true;
+ $this->dispNewFreeze=false;
$smarty->assign("iframe",false);
if(isset($_POST['BranchName'])){
$smarty->assign("BranchName", $_POST['BranchName']);
{
$smarty = get_smarty();
$this->dispNewFreeze=true;
+ $this->dispNewBranch=false;
$smarty->assign("iframe",false);
if(isset($_POST['BranchName'])){
$smarty->assign("BranchName", $_POST['BranchName']);
-
-
-
-
-
-
-
-
- /****************
- Create a new branch
- ****************/
-
function PerformBranch()
{
if(!preg_match("/c/",$this->ui->get_permissions($this->acl_base,"fai/faiManagement"))){
*/
restore_error_handler();
- /* Create it know */
$this->dispNewBranch = false;
$this->dispNewFreeze = false;
}
- function get_type($array){
+ function get_type($array)
+ {
if(!isset($array['objectClass'])) return(array());
if(in_array("FAIpartitionTable",$array['objectClass'])){
return(array("tabsPartition","faiPartitionTable","FAIPARTITIONTABS"));