From: hickert Date: Mon, 14 Apr 2008 13:31:39 +0000 (+0000) Subject: Mo-Mo-Mo-Monster Diff - Removed Department selection from managment list and all... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=aa01ea38f1fceba6725fed12214bf94b1197fd7c;p=gosa.git Mo-Mo-Mo-Monster Diff - Removed Department selection from managment list and all dependencies. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10424 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/fai/admin/fai/branch_selector.tpl b/gosa-plugins/fai/admin/fai/branch_selector.tpl index 67d4d0b4f..b5bac4656 100644 --- a/gosa-plugins/fai/admin/fai/branch_selector.tpl +++ b/gosa-plugins/fai/admin/fai/branch_selector.tpl @@ -6,8 +6,8 @@ {t}Current release{/t}  - + {html_options output=$fai_releases values=$fai_releases selected=$fai_release} @@ -29,14 +29,14 @@ {t}Create new locked branch{/t} {/if} - {if $selectedBranch != "main" && $allow_remove} + {if $fai_release != $fai_base && $allow_remove}
{t}Delete current release{/t} {/if} - +
diff --git a/gosa-plugins/fai/admin/fai/class_askClassName.inc b/gosa-plugins/fai/admin/fai/class_askClassName.inc index cde5eb966..e409a868f 100644 --- a/gosa-plugins/fai/admin/fai/class_askClassName.inc +++ b/gosa-plugins/fai/admin/fai/class_askClassName.inc @@ -11,15 +11,13 @@ class askClassName extends plugin var $forbidden = array(); var $ClassName = ""; var $ClassAlreadyExists = false; + var $parent; function askClassName (&$config,$dn,$ui,$objectClass) { $this->ui = $ui; $this->objectClass = $objectClass; plugin::plugin ($config, $dn); - if(!session::is_set('CurrentMainBase')){ - session::set('CurrentMainBase',$this->config->current['BASE']); - } } function execute() @@ -31,25 +29,16 @@ class askClassName extends plugin $smarty = get_smarty(); $display= ""; - /* The faifilter contais - * The base for all fai objects - */ - $faifilter = session::get('faifilter'); - /* First search for every ou, in given fai base * With a second search detect all object that belong to the different ous. */ - $base = get_ou('faiou').session::get('CurrentMainBase'); - if($faifilter['branch'] != "main"){ - $base = $faifilter['branch']; - } + $base = $this->parent->fai_release; $ldap = $this->config->get_ldap_link(); - $type_acl_mapping = array( "FAIpartitionTable" => "faiPartitionTable", - "FAIpackageList" => "faiPackage", + "FAIpackageList" => "faiPackageList", "FAIscript" => "faiScript", "FAIvariable" => "faiVariable", "FAIhook" => "faiHook", diff --git a/gosa-plugins/fai/admin/fai/class_divListFai.inc b/gosa-plugins/fai/admin/fai/class_divListFai.inc index 2252fd92e..780092044 100644 --- a/gosa-plugins/fai/admin/fai/class_divListFai.inc +++ b/gosa-plugins/fai/admin/fai/class_divListFai.inc @@ -2,12 +2,6 @@ class divListFai extends MultiSelectWindow { - /* Current base */ - var $selectedBase = ""; - var $selectedBranch = "main"; - var $AvailableBranches = array(); - var $departments = array(); - /* Regex */ var $Regex = "*"; var $ShowProfiles; @@ -24,8 +18,6 @@ class divListFai extends MultiSelectWindow var $parent ; var $ui ; - var $SaveAdditionalVars = array("selectedBranch"); - function divListFai (&$config,$parent) { MultiSelectWindow::MultiSelectWindow($config, "Fai", "fai"); @@ -33,14 +25,8 @@ class divListFai extends MultiSelectWindow $this->parent = $parent; $this->ui = get_userinfo(); - /* Set default base */ - if(!session::is_set('CurrentMainBase')){ - session::set('CurrentMainBase',$this->config->current['BASE']); - } - $this->selectedBase = session::get('CurrentMainBase'); - /* Set list strings */ - $this->SetTitle(_("List of classes")); + $this->SetTitle( _("List of classes")); $this->SetSummary(_("List of deployment classes and packages")); /* Result page will look like a headpage */ @@ -54,9 +40,6 @@ class divListFai extends MultiSelectWindow /* Dynamic action col, depending on snapshot icons */ $action_col_size = 120; -# if($this->parent->snapshotEnabled()){ -# $action_col_size += 32; -# } /* Toggle all selected / deselected */ $chk = "config->search("faiManagement", "POSTCREATE",array('menu','tabs')); $smarty = get_smarty(); + $releases = $this->parent->getBranches(); $smarty->assign("allow_create", $c); $smarty->assign("allow_remove", $r); - $smarty->assign("selectedBranch",$this->selectedBranch); + $smarty->assign("fai_release" , $releases[$this->parent->fai_release]); + $smarty->assign("fai_base" , $releases[$this->parent->fai_base]); $smarty->assign("branchimage","images/branch.png"); - $smarty->assign("branches",$this->AvailableBranches); + $smarty->assign("fai_releases", $releases); $plug_id = 0; if(isset($_GET['plug'])){ $plug_id = $_GET['plug']; @@ -114,66 +99,17 @@ class divListFai extends MultiSelectWindow function GenHeader() { - /* Prepare departments, - which are shown in the listbox on top of the listbox - */ - $options= ""; - /* Get all departments within this subtree */ $ui= get_userinfo(); $first = ""; $found = FALSE; $base = $this->config->current['BASE']; - /* Add base */ - $tmp = array(); - $tmp[] = array("dn"=>$this->config->current['BASE']); - $tmp= array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base, - array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH)); - - $deps = array(); - foreach($tmp as $tm){ - $deps[$tm['dn']] = $tm['dn']; - } - - /* Load possible departments */ - $ui= get_userinfo(); - $tdeps= $ui->get_module_departments("fai"); - $ids = $this->config->idepartments; - $first = ""; - $found = FALSE; - foreach($ids as $dep => $name){ - if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){ - - /* Keep first base dn in mind, we could need this - * info if no valid base was found - */ - if(empty($first)) { - $first = $dep['dn']; - } - - $value = $ids[$dep]; - if ($this->selectedBase == $dep){ - $found = TRUE; - $options.= ""; - } else { - $options.= ""; - } - } - } - - /* The currently used base is not visible with your acl setup. - * Set base to first useable base. - */ - if(!$found){ - $this->selectedBase = $first; - } - /* Add seperator */ $add_sep = false; /* Get complete fai acls, to be able to check if we must show or hide the snapshot abilities */ - $acl_all = $ui->has_complete_category_acls($this->selectedBase,$this->module); + $acl_all = $ui->has_complete_category_acls($this->parent->fai_base,$this->module); /* Add default header */ $listhead = MultiSelectWindow::get_default_header(); @@ -183,16 +119,11 @@ class divListFai extends MultiSelectWindow $listhead .="  "; } - $listhead .= _("Base")." ". - "  "; - - $s = ".|"._("Actions")."|\n"; $s .= "..|". " "._("Create")."|\n"; - $acl = $ui->get_permissions($this->selectedBase,"fai/faiProfile"); + $acl = $ui->get_permissions($this->parent->fai_base,"fai/faiProfile"); if(preg_match("/c/",$acl)){ $s.= "...|". " "._("Profile")."|Create_profile|\n"; @@ -208,7 +139,7 @@ class divListFai extends MultiSelectWindow array("images/fai_new_packages.png" , _("Package list") ,"Create_package" , _("PK") , "faiPackage")); foreach($arr as $ar){ - $acl = $ui->get_permissions($this->selectedBase,"fai/".$ar[4]); + $acl = $ui->get_permissions($this->parent->fai_base,"fai/".$ar[4]); if(preg_match("/c/",$acl)){ $s.= "...|". " ".$ar[1]."|".$ar[2]."|\n"; @@ -319,7 +250,7 @@ class divListFai extends MultiSelectWindow /* Add copy & cut icons */ $ui = get_userinfo(); $action =""; - $acl_all = $ui->has_complete_category_acls($this->selectedBase,$this->module); + $acl_all = $ui->has_complete_category_acls($this->parent->fai_base,$this->module); if(preg_match("/(c.*w|w.*c)/",$acl_all) && $this->parent->CopyPasteHandler){ $action .= " "; @@ -408,9 +339,6 @@ class divListFai extends MultiSelectWindow { /* Save automatic created POSTs like regex, checkboxes */ MultiSelectWindow::save_object(); - $faifilter = session::get('faifilter'); - $faifilter['branch'] = $this->selectedBranch; - session::set('faifilter',$faifilter); } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: diff --git a/gosa-plugins/fai/admin/fai/class_faiHook.inc b/gosa-plugins/fai/admin/fai/class_faiHook.inc index b385e490d..92b43193c 100644 --- a/gosa-plugins/fai/admin/fai/class_faiHook.inc +++ b/gosa-plugins/fai/admin/fai/class_faiHook.inc @@ -412,27 +412,20 @@ class faiHook extends plugin */ function remove_from_parent() { - $ldap = $this->config->get_ldap_link(); - $ldap->cd ($this->dn); - - $faifilter = session::get('faifilter'); - $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $this->dn); - if($faifilter['branch'] == "main"){ - $use_dn = $this->dn; - } - - FAI::prepare_to_save_FAI_object($use_dn,array(),true); - - new log("remove","fai/".get_class($this),$use_dn,$this->attributes); + if($this->acl_is_removeable()){ + $ldap = $this->config->get_ldap_link(); + $ldap->cd ($this->dn); + $release = $this->parent->parent->fai_release; + $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $this->dn); + new log("remove","fai/".get_class($this),$use_dn,$this->attributes); + FAI::prepare_to_save_FAI_object($use_dn,array(),true); - foreach($this->SubObjects as $name => $obj){ - $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $obj['dn']); - if($faifilter['branch'] == "main"){ - $use_dn = $obj['dn']; + foreach($this->SubObjects as $name => $obj){ + $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $obj['dn']); + FAI::prepare_to_save_FAI_object($use_dn,array(),true); } - FAI::prepare_to_save_FAI_object($use_dn,array(),true); + $this->handle_post_events("remove"); } - $this->handle_post_events("remove"); } @@ -460,12 +453,8 @@ class faiHook extends plugin /* Ensure that we do not overwrite an allready existing entry */ if($this->is_new){ - $new_dn= 'cn='.$this->cn.",".get_ou('faihookou').get_ou('faiou').session::get('CurrentMainBase'); - $faifilter = session::get('faifilter'); - if($faifilter['branch']!="main"){ - $new_dn ='cn='.$this->cn.",".get_ou('faihookou').$faifilter['branch']; - } - + $release = $this->parent->parent->fai_release; + $new_dn= 'cn='.$this->cn.",".get_ou('faihookou').get_ou('faiou').$release; $res = faiManagement::check_class_name("FAIhook",$this->cn,$new_dn); if(isset($res[$this->cn])){ $message[] = msgPool::duplicated(_("Name")); diff --git a/gosa-plugins/fai/admin/fai/class_faiManagement.inc b/gosa-plugins/fai/admin/fai/class_faiManagement.inc index 34144831e..28c5a8337 100644 --- a/gosa-plugins/fai/admin/fai/class_faiManagement.inc +++ b/gosa-plugins/fai/admin/fai/class_faiManagement.inc @@ -44,13 +44,14 @@ class faiManagement extends plugin var $DivListFai; var $start_pasting_copied_objects = FALSE; var $CopyPasteHandler = FALSE; - var $base = ""; /* Allow inserting of new elements if freezed releases */ var $allow_freeze_object_attach = FALSE; var $no_save; + var $fai_base =""; + var $fai_release =""; /* construction/reconstruction */ @@ -65,9 +66,18 @@ class faiManagement extends plugin $this->DivListFai = new divListFai($this->config,$this); /* Copy & Paste handler */ - if ($this->config->boolValueIsTrue("main", "enableCopyPaste")){ + if ($this->config->boolValueIsTrue($this->fai_base, "enableCopyPaste")){ $this->CopyPasteHandler= new CopyPasteHandler($this->config); } + + /* Set default release */ + $this->fai_base = get_ou("faiou")."ou=Direktorium,".$this->config->current['BASE']; + if(!session::is_set("fai_filter")){ + session::set("fai_filter",array("fai_release" => $this->fai_base)); + } + + $fai_filter = session::get("fai_filter"); + $this->fai_release = $fai_filter['fai_release']; } function execute() @@ -75,6 +85,8 @@ class faiManagement extends plugin /* Call parent execute */ plugin::execute(); + print_a(array($this->fai_base,$this->fai_release)); + /* Initialise vars and smarty */ $smarty = get_smarty(); $smarty->assign("BranchName",""); @@ -305,6 +317,7 @@ class faiManagement extends plugin if(preg_match("/d/",$acl)){ $this->dialog = new $type[0]($this->config, $this->config->data['TABS'][$type[2]], $dn,"fai"); + $this->dialog->parent = &$this; $this->dialog->set_acl_base($dn); $this->dialog->by_object[$type[1]]->remove_from_parent (); unset ($this->dialog); @@ -377,6 +390,7 @@ class faiManagement extends plugin $this->dialog = new $type[0]($this->config, $this->config->data['TABS'][$type[2]], $this->dn,"fai"); $this->dialog->set_acl_base($this->dn); + $this->dialog->parent = &$this; $this->dialog->by_object[$type[1]]->remove_from_parent (); unset ($this->dialog); $this->dialog= FALSE; @@ -419,7 +433,7 @@ class faiManagement extends plugin add_lock ($this->dn, $this->ui->dn); $this->dialog = new $a_setup[0]($this->config,$this->config->data['TABS'][$a_setup[2]],$this->dn,"fai"); - + $this->dialog->parent = &$this; $this->dialog->set_acl_base($this->dn); $this->is_dialog = true; @@ -441,7 +455,7 @@ class faiManagement extends plugin /* Remove branch */ if($s_action == "remove_branch"){ - $base= $this->DivListFai->selectedBranch; + $base= $this->fai_release; /* 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) @@ -451,7 +465,7 @@ class faiManagement extends plugin we're allowed to remove this 'dn' */ if($this->acl_is_removeable()){ - $smarty->assign("info", msgPool::deleteInfo(@LDAP::fix($this->DivListFai->selectedBranch),_("FAI branch/freeze"))); + $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); @@ -471,7 +485,7 @@ class faiManagement extends plugin */ if("" != $this->config->search("faiManagement", "POSTREMOVE",array('menu','tabs'))){ - $bb = $this->DivListFai->selectedBranch; + $bb = $this->fai_release; if(!isset($ldap)){ $ldap = $this->config->get_ldap_link(); } @@ -484,7 +498,7 @@ class faiManagement extends plugin $ldap->recursive_remove(); $ldap->cd(preg_replace('/,'.normalizePreg(get_ou('faiou')).'/', ','.get_ou('applicationou'), $bb)); $ldap->recursive_remove(); - $this->DivListFai->selectedBranch = "main"; + $this->fai_release = $this->fai_base; /* Post remove */ $this->lock_name = $name; @@ -514,7 +528,7 @@ class faiManagement extends plugin $name = $_POST['BranchName']; $is_ok = true; $smarty->assign("BranchName",$name); - $base= get_ou('faiou').$this->DivListFai->selectedBase; + $base= $this->fai_base; /* Check used characters */ if(preg_match("/[^0-9a-z \ö\ä\ü\.-_:,]/i",$name)){ @@ -523,7 +537,7 @@ class faiManagement extends plugin } /* Check if this name is already in use */ - if(!$this->CheckNewBranchName($_POST['BranchName'],$this->DivListFai->selectedBranch)){ + if(!$this->CheckNewBranchName($_POST['BranchName'],$this->fai_release)){ msg_dialog::display(_("Error"), msgPool::duplicated(_("Name")), ERROR_DIALOG); $is_ok = false; } @@ -569,17 +583,17 @@ class faiManagement extends plugin $ldap = $this->config->get_ldap_link(); $baseToUse = $base; - if($this->DivListFai->selectedBranch != "main" ){ - $baseToUse = $this->DivListFai->selectedBranch; + if($this->fai_release != $this->fai_base){ + $baseToUse = $this->fai_release; } /* Create new Release name to be able to set faidebianRelease for FAIpackageList */ $CurrentReleases = $this->getBranches(); $NewReleaseName = $name; - if(isset($CurrentReleases[$this->DivListFai->selectedBranch])) { - if($this->DivListFai->selectedBranch != "main"){ - $NewReleaseName = $CurrentReleases[$this->DivListFai->selectedBranch]."/".$name; + if(isset($CurrentReleases[$this->fai_release])) { + if($this->fai_release != $this->fai_base){ + $NewReleaseName = $CurrentReleases[$this->fai_release]."/".$name; $NewReleaseName = preg_replace("#\/#","/",$NewReleaseName); }else{ $NewReleaseName = $name; @@ -616,7 +630,7 @@ class faiManagement extends plugin /* Duplicate group application releases */ - FAI::copy_FAI_group_releases($CurrentReleases[$this->DivListFai->selectedBranch],$name,$type); + FAI::copy_FAI_group_releases($CurrentReleases[$this->fai_release],$name,$type); /* Duplicate applications */ @@ -737,9 +751,10 @@ class faiManagement extends plugin "new_package" => _("package list")); if(isset($types[$s_action])){ - $acl = $this->ui->get_permissions($this->DivListFai->selectedBase,"fai/".$type_acl_mapping[$types[$s_action]]); + $acl = $this->ui->get_permissions($this->fai_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; }else{ msg_dialog::display(_("Permission error"), sprintf(_("You have no permission to create a new %s!"), $types_i18n[$s_action]), ERROR_DIALOG); } @@ -749,11 +764,12 @@ class faiManagement extends plugin if($s_action == "new_profile"){ $this->dn = "new" ; - $acl = $this->ui->get_permissions($this->DivListFai->selectedBase,"fai/faiProfile"); + $acl = $this->ui->get_permissions($this->fai_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"); $this->dialog->set_acl_base($this->base); + $this->dialog->parent = &$this; $this->is_dialog = false; }else{ @@ -781,6 +797,7 @@ class faiManagement extends plugin $this->dialog = new $a_setup[0]($this->config,$this->config->data['TABS'][$a_setup[2]],$this->dn,"fai"); $this->dialog->set_acl_base($this->base); $this->dialog->by_object[$a_setup[1]]->cn = $name; + $this->dialog->parent = &$this; $this->is_dialog = true; } } @@ -882,7 +899,7 @@ class faiManagement extends plugin ****************/ /* Check if there is a snapshot dialog open */ - $base = $this->DivListFai->selectedBase; + $base = $this->fai_base; if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){ return($str); } @@ -891,7 +908,6 @@ class faiManagement extends plugin $this->reload(); $this->DivListFai->parent = $this; $this->DivListFai->execute(); - $this->DivListFai->AddDepartments($this->DivListFai->selectedBase,4,1); $this->DivListFai->setEntries($this->objects); return($this->DivListFai->Draw()); } @@ -903,11 +919,7 @@ class faiManagement extends plugin $tmp = array(); $types = array("faipartitionou","faiscriptou","faitemplateou","faihookou","faiprofileou","faivariableou","faipackageou"); foreach($types as $type){ - if($this->DivListFai->selectedBranch == "main"){ - $tmp[] = get_ou($type).get_ou('faiou').$this->DivListFai->selectedBase; - }else{ - $tmp[] = get_ou($type).$this->DivListFai->selectedBranch; - } + $tmp[] = get_ou($type).$this->fai_release; } return($tmp); } @@ -916,10 +928,10 @@ class faiManagement extends plugin /* Get available branches for current base */ function getBranches($base = false,$prefix = "") { - $ret = array("/"=>"main"); + $ret = array("/"=>$this->fai_base); $ldap = $this->config->get_ldap_link(); if(!$base){ - $base = session::get('CurrentMainBase'); + $base = $this->fai_base; } $tmp = FAI::get_all_releases_from_base($base,true); foreach($tmp as $dn => $name){ @@ -954,13 +966,13 @@ class faiManagement extends plugin $this->objects = array(); /* Get base */ - $base = get_ou('faiou').$this->DivListFai->selectedBase; - if($this->DivListFai->selectedBranch != "main"){ + $base = $this->fai_base; + if($this->fai_release != $this->fai_base){ $br = $this->getBranches(); - if(isset($br[$this->DivListFai->selectedBranch])){ - $base = $this->DivListFai->selectedBranch; + if(isset($br[$this->fai_release])){ + $base = $this->fai_release; }else{ - $base = get_ou('faiou').$this->DivListFai->selectedBase; + $base = $this->fai_base; } } $this->base = $base; @@ -1097,7 +1109,7 @@ class faiManagement extends plugin function CheckNewBranchName($name,$base) { - $f = $this->DivListFai->selectedBranch; + $f = $this->fai_release; if($name == ""){ return(false); }elseif(in_array($name,$this->getBranches($f))) { @@ -1112,6 +1124,16 @@ class faiManagement extends plugin { $this->DivListFai->save_object(); + /* Get posted release */ + $r_releases = array_flip($this->getBranches()); + if(isset($_POST['fai_release']) && isset($r_releases[get_post('fai_release')])){ + $this->fai_release = $r_releases[get_post('fai_release')]; + + $fai_filter = session::get("fai_filter"); + $fai_filter['fai_release'] = $this->fai_release; + session::set("fai_filter",$fai_filter); + } + if(is_object($this->CopyPasteHandler)){ $this->CopyPasteHandler->save_object(); } @@ -1125,10 +1147,6 @@ class faiManagement extends plugin return(""); } - $base = $this->DivListFai->selectedBranch; - if($base == "main"){ - $base = $this->DivListFai->selectedBase; - } /* Add a single entry to queue */ if($s_action == "cut" || $s_action == "copy"){ @@ -1175,7 +1193,6 @@ class faiManagement extends plugin /* Get dialog */ $data = $this->CopyPasteHandler->execute(); - $this->CopyPasteHandler->SetVar("base",$base); FAI::save_release_changes_now(); diff --git a/gosa-plugins/fai/admin/fai/class_faiPackage.inc b/gosa-plugins/fai/admin/fai/class_faiPackage.inc index 1814daf6f..f7a8e9277 100644 --- a/gosa-plugins/fai/admin/fai/class_faiPackage.inc +++ b/gosa-plugins/fai/admin/fai/class_faiPackage.inc @@ -176,8 +176,8 @@ class faiPackage extends plugin if(!$this->is_account){ /* Assemble release name */ - $faifilter = session::get('faifilter'); - $tmp= preg_replace('/,'.normalizePreg(get_ou('faiou')).'.*$/', '', $faifilter['branch']); + $release = $this->parent->parent->fai_release; + $tmp= preg_replace('/,'.normalizePreg(get_ou('faiou')).'.*$/', '', $release); $tmp= preg_replace('/ou=/', '', $tmp); $rev= array_reverse(split(',', $tmp)); $this->FAIdebianRelease= ""; @@ -345,24 +345,14 @@ class faiPackage extends plugin { $ldap = $this->config->get_ldap_link(); $ldap->cd ($this->dn); - - $faifilter = session::get('faifilter'); - $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $this->dn); - if($faifilter['branch'] == "main"){ - $use_dn = $this->dn; - } - + $release = $this->parent->parent->fai_release; + $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $this->dn); FAI::prepare_to_save_FAI_object($use_dn,array(),true); - new log("remove","fai/".get_class($this),$use_dn,$this->attributes); - foreach($this->ConfiguredPackages as $pkgname => $attrs){ foreach($attrs as $name => $attr){ $pkgdn = "FAIvariable=".$name.",".$this->dn; - $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $pkgdn); - if($faifilter['branch'] == "main"){ - $use_dn = $obj['dn']; - } + $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $pkgdn); FAI::prepare_to_save_FAI_object($use_dn,array(),true); } } @@ -398,12 +388,8 @@ class faiPackage extends plugin /* Ensure that we do not overwrite an allready existing entry */ if($this->is_new){ - $new_dn= 'cn='.$this->cn.",".get_ou('faipackageou').get_ou('faiou').session::get('CurrentMainBase'); - $faifilter = session::get('faifilter'); - if($faifilter['branch']!="main"){ - $new_dn ='cn='.$this->cn.",".get_ou('faipackageou').$faifilter['branch']; - } - + $release = $this->parent->parent->fai_filter; + $new_dn= 'cn='.$this->cn.",".get_ou('faipackageou').get_ou('faiou').$release; $res = faiManagement::check_class_name("FAIpackageList",$this->cn,$new_dn); if(isset($res[$this->cn])){ $message[] = msgPool::duplicated(_("Name")); @@ -476,8 +462,9 @@ class faiPackage extends plugin /* Assemble release name */ if($this->FAIdebianRelease == "ClearFromCopyPaste"){ - $faifilter = session::get('faifilter'); - $tmp= preg_replace('/,'.normalizePreg(get_ou('faiou')).'.*$/', '', $faifilter['branch']); + + $current_release = $this->parent->parent->fai_release; + $tmp= preg_replace('/,'.normalizePreg(get_ou('faiou')).'.*$/', '', $current_release); $tmp= preg_replace('/ou=/', '', $tmp); $rev= array_reverse(split(',', $tmp)); $this->FAIdebianRelease= ""; diff --git a/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc b/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc index c721a8ed7..8d848e77b 100644 --- a/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc +++ b/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc @@ -344,32 +344,18 @@ class faiPartitionTable extends plugin $ldap = $this->config->get_ldap_link(); $ldap->cd ($this->dn); - $faifilter = session::get('faifilter'); - $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $this->dn); - if($faifilter['branch'] == "main"){ - $use_dn = $this->dn; - } + $release = $this->parent->parent->fai_release; + $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $this->dn); FAI::prepare_to_save_FAI_object($use_dn,array(),true); - new log("remove","fai/".get_class($this),$use_dn,$this->attributes); - foreach($this->disks as $disk){ - $disk_dn = "cn=".$disk['cn'].",".$this->dn; - $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $disk_dn); - if($faifilter['branch'] == "main"){ - $use_dn = $disk_dn; - } + $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i",$release, $disk_dn); FAI::prepare_to_save_FAI_object($use_dn,array(),true); - foreach($disk['partitions'] as $key => $partition){ - $partition_dn= "FAIpartitionNr=".$partition['FAIpartitionNr'].",".$disk_dn; - $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $partition_dn); - if($faifilter['branch'] == "main"){ - $use_dn = $disk_dn; - } + $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $partition_dn); FAI::prepare_to_save_FAI_object($use_dn,array(),true); } } @@ -399,12 +385,8 @@ class faiPartitionTable extends plugin /* Ensure that we do not overwrite an allready existing entry */ if($this->is_new){ - $new_dn= 'cn='.$this->cn.",".get_ou('faipartitionou').get_ou('faiou').session::get('CurrentMainBase'); - $faifilter = session::get('faifilter'); - if($faifilter['branch']!="main"){ - $new_dn ='cn='.$this->cn.",".get_ou('faipartitionou').$faifilter['branch']; - } - + $release = $this->parent->parent->fai_filter; + $new_dn= 'cn='.$this->cn.",".get_ou('faipartitionou').get_ou('faiou').$release; $res = faiManagement::check_class_name("FAIpartitionTable",$this->cn,$new_dn); if(isset($res[$this->cn])){ $message[] = msgPool::duplicated(_("Name")); diff --git a/gosa-plugins/fai/admin/fai/class_faiProfile.inc b/gosa-plugins/fai/admin/fai/class_faiProfile.inc index 83a57eddb..cb71d0d06 100644 --- a/gosa-plugins/fai/admin/fai/class_faiProfile.inc +++ b/gosa-plugins/fai/admin/fai/class_faiProfile.inc @@ -363,13 +363,8 @@ class faiProfile extends plugin { $ldap = $this->config->get_ldap_link(); $ldap->cd ($this->dn); - - $faifilter = session::get('faifilter'); - $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $this->dn); - if($faifilter['branch'] == "main"){ - $use_dn = $this->dn; - } - + $release = $this->parent->parent->fai_release; + $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $this->dn); new log("remove","fai/".get_class($this),$use_dn,$this->attributes); FAI::prepare_to_save_FAI_object($use_dn,array(),true); $this->handle_post_events("remove"); @@ -401,11 +396,8 @@ class faiProfile extends plugin /* Ensure that we do not overwrite an allready existing entry */ if($this->dn == "new" || $this->cn != $this->old_cn){ - $new_dn= 'cn='.$this->cn.",".get_ou('faiprofileou').get_ou('faiou').session::get('CurrentMainBase'); - $faifilter = session::get('faifilter'); - if($faifilter['branch']!="main"){ - $new_dn ='cn='.$this->cn.",".get_ou('faiprofileou').$faifilter['branch']; - } + $release = $this->parent->parent->fai_filter; + $new_dn= 'cn='.$this->cn.",".get_ou('faiprofileou').get_ou('faiou').$release; $res = faiManagement::check_class_name("FAIprofile",$this->cn,$new_dn); if(isset($res[$this->cn])){ $message[] = msgPool::duplicated(_("Name")); diff --git a/gosa-plugins/fai/admin/fai/class_faiProfileEntry.inc b/gosa-plugins/fai/admin/fai/class_faiProfileEntry.inc index d15526631..86ca1c6b2 100644 --- a/gosa-plugins/fai/admin/fai/class_faiProfileEntry.inc +++ b/gosa-plugins/fai/admin/fai/class_faiProfileEntry.inc @@ -16,12 +16,8 @@ class faiProfileEntry extends plugin plugin::plugin ($config, $dn); /* Search only in fai tree */ - $base = get_ou('faiou').session::get('CurrentMainBase'); - $faifilter = session::get('faifilter'); - if($faifilter['branch']!="main"){ - $base = $faifilter['branch']; - } - + + $base = $this->parent->parent->fai_release; $this->ui = get_userinfo(); $filter = "(|(objectClass=FAIscript)(objectClass=FAItemplate)(objectClass=FAIhook)". diff --git a/gosa-plugins/fai/admin/fai/class_faiScript.inc b/gosa-plugins/fai/admin/fai/class_faiScript.inc index 500dddb0a..e15c840a4 100644 --- a/gosa-plugins/fai/admin/fai/class_faiScript.inc +++ b/gosa-plugins/fai/admin/fai/class_faiScript.inc @@ -451,21 +451,13 @@ class faiScript extends plugin if($this->acl_is_removeable()){ $ldap = $this->config->get_ldap_link(); $ldap->cd ($this->dn); - $faifilter = session::get('faifilter'); - $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $this->dn); - if($faifilter['branch'] == "main"){ - $use_dn = $this->dn; - } - + $release = $this->parent->parent->fai_release; + $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $this->dn); new log("remove","fai/".get_class($this),$use_dn,$this->attributes); - FAI::prepare_to_save_FAI_object($use_dn,array(),true); - + foreach($this->SubObjects as $name => $obj){ - $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $obj['dn']); - if($faifilter['branch'] == "main"){ - $use_dn = $obj['dn']; - } + $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $obj['dn']); FAI::prepare_to_save_FAI_object($use_dn,array(),true); } $this->handle_post_events("remove"); @@ -509,12 +501,8 @@ class faiScript extends plugin /* Ensure that we do not overwrite an allready existing entry */ if($this->is_new){ - $new_dn= 'cn='.$this->cn.",".get_ou('faiscriptou').get_ou('faiou').session::get('CurrentMainBase'); - $faifilter = session::get('faifilter'); - if($faifilter['branch']!="main"){ - $new_dn ='cn='.$this->cn.",".get_ou('faiscriptou').$faifilter['branch']; - } - + $release = $this->parent->parent->fai_release; + $new_dn= 'cn='.$this->cn.",".get_ou('faiscriptou').get_ou('faiou').$release; $res = faiManagement::check_class_name("FAIscript",$this->cn,$new_dn); if(isset($res[$this->cn])){ $message[] = msgPool::duplicated(_("Name")); diff --git a/gosa-plugins/fai/admin/fai/class_faiTemplate.inc b/gosa-plugins/fai/admin/fai/class_faiTemplate.inc index 7ea9a836b..d0cc63c2b 100644 --- a/gosa-plugins/fai/admin/fai/class_faiTemplate.inc +++ b/gosa-plugins/fai/admin/fai/class_faiTemplate.inc @@ -395,26 +395,20 @@ class faiTemplate extends plugin */ function remove_from_parent() { - $ldap = $this->config->get_ldap_link(); - $ldap->cd ($this->dn); - - $faifilter = session::get('faifilter'); - $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $this->dn); - if($faifilter['branch'] == "main"){ - $use_dn = $this->dn; - } - - FAI::prepare_to_save_FAI_object($use_dn,array(),true); - new log("remove","fai/".get_class($this),$use_dn,$this->attributes); + if($this->acl_is_removeable()){ + $ldap = $this->config->get_ldap_link(); + $ldap->cd ($this->dn); + $release = $this->parent->parent->fai_release; + $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $this->dn); + new log("remove","fai/".get_class($this),$use_dn,$this->attributes); + FAI::prepare_to_save_FAI_object($use_dn,array(),true); - foreach($this->SubObjects as $name => $obj){ - $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $obj['dn']); - if($faifilter['branch'] == "main"){ - $use_dn = $obj['dn']; + foreach($this->SubObjects as $name => $obj){ + $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $obj['dn']); + FAI::prepare_to_save_FAI_object($use_dn,array(),true); } - FAI::prepare_to_save_FAI_object($use_dn,array(),true); + $this->handle_post_events("remove"); } - $this->handle_post_events("remove"); } @@ -437,12 +431,8 @@ class faiTemplate extends plugin /* Ensure that we do not overwrite an allready existing entry */ if($this->is_new){ - $new_dn= 'cn='.$this->cn.",".get_ou('faitemplateou').get_ou('faiou').session::get('CurrentMainBase'); - $faifilter = session::get('faifilter'); - if($faifilter['branch']!="main"){ - $new_dn ='cn='.$this->cn.",".get_ou('faitemplateou').$faifilter['branch']; - } - + $release = $this->parent->parent->fai_release; + $new_dn= 'cn='.$this->cn.",".get_ou('faitemplateou').get_ou('faiou').$release; $res = faiManagement::check_class_name("FAItemplate",$this->cn,$new_dn); if(isset($res[$this->cn])){ $message[] = msgPool::duplicated(_("Name")); diff --git a/gosa-plugins/fai/admin/fai/class_faiVariable.inc b/gosa-plugins/fai/admin/fai/class_faiVariable.inc index af021e7df..3e026af04 100644 --- a/gosa-plugins/fai/admin/fai/class_faiVariable.inc +++ b/gosa-plugins/fai/admin/fai/class_faiVariable.inc @@ -282,21 +282,13 @@ class faiVariable extends plugin if($this->acl_is_removeable()){ $ldap = $this->config->get_ldap_link(); $ldap->cd ($this->dn); - - $faifilter = session::get('faifilter'); - $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $this->dn); - if($faifilter['branch'] == "main"){ - $use_dn = $this->dn; - } - - FAI::prepare_to_save_FAI_object($use_dn,array(),true); + $release = $this->parent->parent->fai_release; + $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $this->dn); new log("remove","fai/".get_class($this),$use_dn,$this->attributes); + FAI::prepare_to_save_FAI_object($use_dn,array(),true); foreach($this->SubObjects as $name => $obj){ - $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $obj['dn']); - if($faifilter['branch'] == "main"){ - $use_dn = $obj['dn']; - } + $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $obj['dn']); FAI::prepare_to_save_FAI_object($use_dn,array(),true); } $this->handle_post_events("remove"); @@ -328,12 +320,8 @@ class faiVariable extends plugin /* Ensure that we do not overwrite an allready existing entry */ if($this->is_new){ - $new_dn= 'cn='.$this->cn.",".get_ou('faivariableou').get_ou('faiou').session::get('CurrentMainBase'); - $faifilter = session::get('faifilter'); - if($faifilter['branch']!="main"){ - $new_dn ='cn='.$this->cn.",".get_ou('faivariableou').$faifilter['branch']; - } - + $release = $this->parent->parent->fai_filter; + $new_dn= 'cn='.$this->cn.",".get_ou('faivariableou').get_ou('faiou').$release; $res = faiManagement::check_class_name("FAIvariable",$this->cn,$new_dn); if(isset($res[$this->cn])){ $message[] = msgPool::duplicated(_("Name")); diff --git a/gosa-plugins/fai/admin/fai/tabsHook.inc b/gosa-plugins/fai/admin/fai/tabsHook.inc index ad41dbdf8..7b0859fb6 100644 --- a/gosa-plugins/fai/admin/fai/tabsHook.inc +++ b/gosa-plugins/fai/admin/fai/tabsHook.inc @@ -3,6 +3,7 @@ class tabsHook extends tabs { var $base= ""; + var $parent; function tabsHook($config, $data, $dn,$category) { @@ -20,12 +21,7 @@ class tabsHook extends tabs function save($ignore_account= FALSE) { $baseobject= $this->by_object['faiHook']; - - $new_dn= 'cn='.$baseobject->cn.",".get_ou('faihookou').get_ou('faiou').session::get('CurrentMainBase'); - $faifilter = session::get('faifilter'); - if($faifilter['branch']!="main"){ - $new_dn ='cn='.$baseobject->cn.",".get_ou('faihookou').$faifilter['branch']; - } + $new_dn ='cn='.$baseobject->cn.",".get_ou('faihookou').$this->parent->fai_release; if ($this->dn != $new_dn && $this->dn != "new"){ diff --git a/gosa-plugins/fai/admin/fai/tabsPackage.inc b/gosa-plugins/fai/admin/fai/tabsPackage.inc index 197f86370..e3101d4f4 100644 --- a/gosa-plugins/fai/admin/fai/tabsPackage.inc +++ b/gosa-plugins/fai/admin/fai/tabsPackage.inc @@ -3,6 +3,7 @@ class tabsPackage extends tabs { var $base= ""; + var $parent; function tabsPackage($config, $data, $dn,$category) { @@ -21,14 +22,7 @@ class tabsPackage extends tabs function save($ignore_account= FALSE) { $baseobject= $this->by_object['faiPackage']; - - $new_dn= 'cn='.$baseobject->cn.",".get_ou('faipackageou').get_ou('faiou').session::get('CurrentMainBase'); - - $faifilter = session::get('faifilter'); - - if($faifilter['branch']!="main"){ - $new_dn ='cn='.$baseobject->cn.",".get_ou('faipackageou').$faifilter['branch']; - } + $new_dn ='cn='.$baseobject->cn.",".get_ou('faipackageou').$this->parent->fai_release; if ($this->dn != $new_dn && $this->dn != "new"){ diff --git a/gosa-plugins/fai/admin/fai/tabsPartition.inc b/gosa-plugins/fai/admin/fai/tabsPartition.inc index b1aab1e09..33cb80ba8 100644 --- a/gosa-plugins/fai/admin/fai/tabsPartition.inc +++ b/gosa-plugins/fai/admin/fai/tabsPartition.inc @@ -3,6 +3,7 @@ class tabsPartition extends tabs { var $base= ""; + var $parent; function tabsPartition($config, $data, $dn,$category) { @@ -22,12 +23,7 @@ class tabsPartition extends tabs { $baseobject= $this->by_object['faiPartitionTable']; - $new_dn= 'cn='.$baseobject->cn.",".get_ou('faipartitionou').get_ou('faiou').session::get('CurrentMainBase'); - - $faifilter = session::get('faifilter'); - if($faifilter['branch']!="main"){ - $new_dn ='cn='.$baseobject->cn.",".get_ou('faipartitionou').$faifilter['branch']; - } + $new_dn ='cn='.$baseobject->cn.",".get_ou('faipartitionou').$this->parent->fai_release; if ($this->dn != $new_dn && $this->dn != "new"){ diff --git a/gosa-plugins/fai/admin/fai/tabsProfile.inc b/gosa-plugins/fai/admin/fai/tabsProfile.inc index 64fc7025c..6dea9226d 100644 --- a/gosa-plugins/fai/admin/fai/tabsProfile.inc +++ b/gosa-plugins/fai/admin/fai/tabsProfile.inc @@ -3,6 +3,7 @@ class tabsProfile extends tabs { var $base= ""; + var $parent; function tabsProfile($config, $data, $dn,$category) { @@ -21,13 +22,7 @@ class tabsProfile extends tabs function save($ignore_account= FALSE) { $baseobject= $this->by_object['faiProfile']; - - $new_dn= 'cn='.$baseobject->cn.",".get_ou('faiprofileou').get_ou('faiou').session::get('CurrentMainBase'); - - $faifilter = session::get('faifilter'); - if($faifilter['branch']!="main"){ - $new_dn ='cn='.$baseobject->cn.",".get_ou('faiprofileou').$faifilter['branch']; - } + $new_dn ='cn='.$baseobject->cn.",".get_ou('faiprofileou').$this->parent->fai_release; if ($this->dn != $new_dn && $this->dn != "new"){ diff --git a/gosa-plugins/fai/admin/fai/tabsScript.inc b/gosa-plugins/fai/admin/fai/tabsScript.inc index 01cafc149..3c5059b90 100644 --- a/gosa-plugins/fai/admin/fai/tabsScript.inc +++ b/gosa-plugins/fai/admin/fai/tabsScript.inc @@ -3,6 +3,7 @@ class tabsScript extends tabs { var $base= ""; + var $parent; function tabsScript($config, $data, $dn,$category) { @@ -21,14 +22,7 @@ class tabsScript extends tabs function save($ignore_account= FALSE) { $baseobject= $this->by_object['faiScript']; - - $new_dn= 'cn='.$baseobject->cn.",".get_ou('faiscriptou').get_ou('faiou').session::get('CurrentMainBase'); - - $faifilter = session::get('faifilter'); - - if($faifilter['branch']!="main"){ - $new_dn ='cn='.$baseobject->cn.",".get_ou('faiscriptou').$faifilter['branch']; - } + $new_dn ='cn='.$baseobject->cn.",".get_ou('faiscriptou').$this->parent->fai_release; if ($this->dn != $new_dn && $this->dn != "new"){ diff --git a/gosa-plugins/fai/admin/fai/tabsTemplate.inc b/gosa-plugins/fai/admin/fai/tabsTemplate.inc index 3c8576e3c..6e9150812 100644 --- a/gosa-plugins/fai/admin/fai/tabsTemplate.inc +++ b/gosa-plugins/fai/admin/fai/tabsTemplate.inc @@ -3,6 +3,7 @@ class tabsTemplate extends tabs { var $base= ""; + var $parent; function tabsTemplate($config, $data, $dn,$category) { @@ -21,13 +22,7 @@ class tabsTemplate extends tabs function save($ignore_account= FALSE) { $baseobject= $this->by_object['faiTemplate']; - - $new_dn= 'cn='.$baseobject->cn.",".get_ou('faitemplateou').get_ou('faiou').session::get('CurrentMainBase'); - - $faifilter = session::get('faifilter'); - if($faifilter['branch']!="main"){ - $new_dn ='cn='.$baseobject->cn.",".get_ou('faitemplateou').$faifilter['branch']; - } + $new_dn ='cn='.$baseobject->cn.",".get_ou('faitemplateou').$this->parent->fai_release; if ($this->dn != $new_dn && $this->dn != "new"){ diff --git a/gosa-plugins/fai/admin/fai/tabsVariable.inc b/gosa-plugins/fai/admin/fai/tabsVariable.inc index 0a4dcfbc6..1e05c8732 100644 --- a/gosa-plugins/fai/admin/fai/tabsVariable.inc +++ b/gosa-plugins/fai/admin/fai/tabsVariable.inc @@ -3,6 +3,7 @@ class tabsVariable extends tabs { var $base= ""; + var $parent; function tabsVariable($config, $data, $dn,$category) { @@ -21,14 +22,7 @@ class tabsVariable extends tabs function save($ignore_account= FALSE) { $baseobject= $this->by_object['faiVariable']; - - $new_dn= 'cn='.$baseobject->cn.",".get_ou('faivariableou').get_ou('faiou').session::get('CurrentMainBase'); - - $faifilter = session::get('faifilter'); - - if($faifilter['branch']!="main"){ - $new_dn ='cn='.$baseobject->cn.",".get_ou('faivariableou').$faifilter['branch']; - } + $new_dn ='cn='.$baseobject->cn.",".get_ou('faivariableou').$this->parent->fai_release; if ($this->dn != $new_dn && $this->dn != "new"){