8345f9028571d5eecec46d39e18a61e1c73fdac9
1 <?php
2 /*
3 This code is part of GOsa (https://gosa.gonicus.de)
4 Copyright (C) 2003 Cajus Pollmeier
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
22 class faiManagement extends plugin
23 {
24 /* Definitions */
25 var $plHeadline = "Software deployment";
26 var $plDescription = "Manage software packages and deployment reciepes";
27 var $plIcon = "plugins/fai/images/plugin.png";
29 /* Headpage attributes */
30 var $lock_type = ""; // should be branch/freeze
31 var $lock_name = "";
32 var $lock_dn = "";
34 /* attribute list for save action */
35 var $attributes = array("lock_type","lock_name","lock_dn"); // Attributes Managed by this plugin
36 var $objectclasses= array(); // ObjectClasses which the attributes are related to
37 var $dialog = array(); // This object contains every dialog we have currently opened
39 var $objects = array(); // This array contains all available objects shown in divlist
40 var $is_dialog = false;
42 var $dispNewBranch= false;
43 var $dispNewFreeze= false;
45 var $DivListFai;
46 var $start_pasting_copied_objects = FALSE;
47 var $CopyPasteHandler = FALSE;
49 /* Allow inserting of new elements if freezed releases
50 */
51 var $allow_freeze_object_attach = TRUE;
53 var $no_save;
54 var $fai_base ="";
55 var $fai_release ="";
57 var $acl_module = array("fai");
59 var $opsi = NULL;
61 /* construction/reconstruction
62 */
63 function faiManagement (&$config, $ui)
64 {
65 /* Set defaults */
66 $this->dn = "";
67 $this->config = $config;
68 $this->ui = $ui;
70 /* Check if the opsi plugin is installed.
71 */
72 if(class_available("opsi")){
73 $this->opsi = new opsi($this->config);;
74 }
76 /* Creat dialog object */
77 $this->DivListFai = new divListFai($this->config,$this);
79 /* Copy & Paste handler */
80 if ($this->config->boolValueIsTrue("main", "enableCopyPaste")){
81 $this->CopyPasteHandler= new CopyPasteHandler($this->config);
82 }
84 /* Set default release */
85 $this->fai_base = get_ou("faiou").$this->config->current['BASE'];
87 if(!session::is_set("fai_filter")){
89 /* Set intial release */
90 $rel = $config->search("faiManagement","DEFAULT_RELEASE",array("menu"));
91 $rels = array_flip($this->getBranches());
92 if(isset($rels[$rel])){
93 $rel = $rels[$rel];
94 }else{
95 $rel = $this->fai_base;
96 }
98 session::set("fai_filter",array("fai_release" => $rel));
99 }
101 $fai_filter = session::get("fai_filter");
102 $this->fai_release = $fai_filter['fai_release'];
103 }
105 function execute()
106 {
107 /* Call parent execute */
108 plugin::execute();
111 /* Initialise vars and smarty */
112 $smarty = get_smarty();
113 $smarty->assign("BranchName","");
115 $display = "";
116 $s_action = "";
117 $s_entry = "";
118 $no_save = FALSE; // hide Apply / Save buttons
120 /* If an entry was locked, these vars will be stored in a session to allow direct edit */
121 session::set('LOCK_VARS_TO_USE',array("/^edit_freeze_entry$/","/^edit_entry$/","/^id$/","/^entry_edit_/","/^entry_delete_/","/^item_selected/","/^remove_multiple_fai_objects/","/^menu_action/"));
124 /****************
125 Handle posts
126 ****************/
128 /* Check ImageButton posts
129 * Create new tab ich new_xx is posted
130 */
131 $posts = array( "/remove_branch/"=>"remove_branch", "/branch_branch/"=>"branch_branch",
132 "/freeze_branch/"=>"freeze_branch", "/create_partition/i"=>"new_partition",
133 "/create_script/i"=>"new_script", "/create_hook/i"=>"new_hook",
134 "/create_variable/i"=>"new_variable", "/create_template/i"=>"new_template",
135 "/create_package/i"=>"new_package", "/create_profile/i"=>"new_profile",
136 "/edit_continue/"=>"select_class_name_finished",
137 "/^multiple_copy_fai/" => "copy_multiple",
138 "/^multiple_cut_fai/" => "cut_multiple",
139 "/^copy/" => "copy",
140 "/^remove_multiple_fai_objects/" => "del_multiple");
142 foreach($_POST as $name => $value){
143 foreach($posts as $reg => $act ){
144 if(preg_match($reg,$name)){
145 $s_action = $act;
146 $s_entry = ltrim(preg_replace($reg,"",$name),"_");
147 $s_entry = preg_replace("/_.*$/","",$s_entry);
148 break;
149 }
150 }
151 if(preg_match("/^entry_edit_.*/",$name)){
152 $s_entry = preg_replace("/^entry_edit_/","",$name);
153 $s_entry = preg_replace("/_.*$/","",$s_entry);
154 $s_action = "edit";
155 break;
156 }elseif(preg_match("/^entry_freeze_edit_.*/",$name)){
157 $s_entry = preg_replace("/^entry_freeze_edit_/","",$name);
158 $s_entry = preg_replace("/_.*$/","",$s_entry);
159 $s_action = "edit";
160 $no_save = TRUE;
161 break;
162 }elseif(preg_match("/^entry_delete_.*/",$name)){
163 $s_entry = preg_replace("/^entry_delete_/","",$name);
164 $s_entry = preg_replace("/_.*$/","",$s_entry);
165 $s_action = "delete";
166 break;
167 }
169 /* Get posts from opsi onjects
170 */
171 if($this->opsi instanceof opsi && $this->opsi->enabled()){
172 if(preg_match("/^entry_opsi_edit_/",$name)){
173 $s_entry = preg_replace("/^entry_opsi_edit_([0-9]*).*$/","\\1",$name);
174 $s_action = "opsi_edit";
175 break;
176 }
177 }
178 }
180 /* Get posts from opsi objects
181 */
182 if($this->opsi instanceof opsi && $this->opsi->enabled() && isset($_GET['edit_opsi_entry'])){
183 $s_entry = $_GET['edit_opsi_entry'];
184 $s_action = "opsi_edit";
185 }
187 if(isset($_GET['edit_entry'])){
188 $s_entry = $_GET['edit_entry'];
189 $s_action = "edit";
190 }
192 if(isset($_GET['edit_freeze_entry'])){
193 $s_entry = $_GET['edit_freeze_entry'];
194 $s_action = "edit";
195 $no_save = TRUE;
196 }
198 if(isset($_GET['act']) && $_GET['act'] == "freeze_branch"){
199 $s_action = "freeze_branch";
200 }
201 if(isset($_GET['act']) && $_GET['act'] == "branch_branch"){
202 $s_action = "branch_branch";
203 }
204 if(isset($_GET['act']) && $_GET['act'] == "remove_branch"){
205 $s_action = "remove_branch";
206 }
208 if((isset($_POST['CancelBranchName'])) || (isset($_POST['CloseIFrame']))){
209 $this->dispNewBranch = false;
210 $this->dispNewFreeze = false;
211 }
214 $type_acl_mapping = array(
215 "FAIpartitionTable" => "faiPartitionTable",
216 "FAIpackageList" => "faiPackage",
217 "FAIscript" => "faiScript",
218 "FAIvariable" => "faiVariable",
219 "FAIhook" => "faiHook",
220 "FAIprofile" => "faiProfile",
221 "FAItemplate" => "faiTemplate");
224 /* handle C&P from layers menu */
225 if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
226 $s_action = "copy_multiple";
227 }
228 if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
229 $s_action = "cut_multiple";
230 }
231 if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
232 $s_action = "editPaste";
233 }
235 /* Create options */
236 if(isset($_POST['menu_action']) && preg_match("/^Create_/",$_POST['menu_action'])){
237 $s_action = "new_".preg_replace("/^Create_/","",$_POST['menu_action']);;
238 $s_entry = preg_replace("/^Create_/","",$_POST['menu_action']);
239 }
241 /* handle remove from layers menu */
242 if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
243 $s_action = "del_multiple";
244 }
247 if(!empty($s_action)){
248 $this->no_save = $no_save;
249 }
251 /********************
252 Copy & Paste
253 ********************/
255 /* Display the copy & paste dialog, if it is currently open */
256 $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
257 if($ret){
258 return($ret);
259 }
262 /*******************
263 Opsi extension
264 *******************/
266 if($this->opsi instanceof opsi && $this->opsi->enabled()){
267 if($s_action == "opsi_edit"){
268 $name = $this->objects[$s_entry]['cn'];
269 $cfg = $this->opsi->get_product_properties($name);
270 $this->dialog = new tabs_opsiProdConfig($this->config, $this->config->data['TABS']['OPSIPRODCONFIG'], $cfg);
271 }
272 if($this->dialog instanceof tabs_opsiProdConfig && isset($_POST['cancel_properties'])){
273 $this->dialog = NULL;
274 }
275 if($this->dialog instanceof tabs_opsiProdConfig && isset($_POST['save_properties'])){
276 $this->dialog->save_object();
277 $name = $this->dialog->get_product();
278 $cfg = $this->dialog->get_cfg();
279 $this->opsi->set_product_properties($name,$cfg);
280 if($this->opsi->is_error()){
281 msg_dialog::display(_("Error"),msgPool::siError($this->opsi->get_error()),ERROR_DIALOG);
282 }else{
283 $this->dialog = NULL;
284 }
285 }
286 if($this->dialog instanceof tabs_opsiProdConfig){
287 $this->dialog->save_object();
288 return($this->dialog->execute());
289 }
290 }
293 /****************
294 Delete confirme dialog
295 ****************/
297 if ($s_action=="delete"){
299 /* Get 'dn' from posted termlinst */
300 $this->dn= $this->objects[$s_entry]['dn'];
302 /* Load permissions for selected 'dn' and check if
303 we're allowed to remove this 'dn' */
304 $acl = $this->ui->get_permissions($this->dn,"fai/".$type_acl_mapping[$this->objects[$s_entry]['type']]);
305 if(preg_match("/d/",$acl)){
307 /* Check locking, save current plugin in 'back_plugin', so the dialog knows where to return. */
308 if (($user= get_lock($this->dn)) != ""){
309 return(gen_locked_message ($user, $this->dn));
310 }
312 /* Lock the current entry, so nobody will edit it during deletion */
313 add_lock ($this->dn, $this->ui->dn);
314 $smarty->assign("warning",msgPool::deleteInfo(@LDAP::fix($this->dn),_("FAI object")));
315 $smarty->assign("multiple", false);
316 return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
317 } else {
319 /* Obviously the user isn't allowed to delete. Show message and clean session. */
320 msg_dialog::display(_("Permission error"), msgPool::permDelete(),ERROR_DIALOG);
321 }
322 }
325 /********************
326 Delete MULTIPLE entries requested, display confirm dialog
327 ********************/
329 if ($s_action=="del_multiple"){
330 $this->dns = array();
331 $ids = $this->list_get_selected_items();
333 if(count($ids)){
335 $errors = "";
336 foreach($ids as $id){
337 $dn = $this->objects[$id]['dn'];
338 $cn = $this->objects[$id]['cn'];
339 if(!preg_match('/^freeze/', $this->objects[$id]['FAIstate'])){
340 $this->dns[$id] = $dn;
341 }else{
342 $errors .= $cn.", ";
343 }
344 }
345 if ($user= get_multiple_locks($this->dns)){
346 return(gen_locked_message($user,$this->dns));
347 }
349 if($errors != ""){
350 msg_dialog::display(_("Branch locked"),sprintf(_("The following entries are locked, you can't remove them %s."),
351 "<br><br>".trim($errors,", ")),INFO_DIALOG);
352 }
354 if(count($this->dns)){
356 $dns_names = array();
357 foreach($this->dns as $dn){
358 add_lock ($dn, $this->ui->dn);
359 $dns_names[] = @LDAP::fix($dn);
360 }
362 /* Lock the current entry, so nobody will edit it during deletion */
363 $smarty->assign("warning",msgPool::deleteInfo($dns_names,_("FAI object")));
364 $smarty->assign("multiple", true);
365 return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
366 }
367 }
368 }
371 /********************
372 Delete MULTIPLE entries confirmed
373 ********************/
375 /* Confirmation for deletion has been passed. Users should be deleted. */
376 if (isset($_POST['delete_multiple_fai_object_confirm'])){
378 /* Find out more about the object type */
379 $ldap = $this->config->get_ldap_link();
381 /* Remove user by user and check acls before removeing them */
382 foreach($this->dns as $key => $dn){
384 $ldap->cat($dn, array('objectClass'));
385 $attrs = $ldap->fetch();
386 $type = $this->get_type($attrs);
388 $acl = $this->ui->get_permissions($dn,"fai/".$type[1]);
389 if(preg_match("/d/",$acl)){
391 $this->dialog = new $type[0]($this->config, $this->config->data['TABS'][$type[2]], $dn,"fai");
392 $this->dialog->parent = &$this;
393 $this->dialog->set_acl_base($dn);
394 $this->dialog->by_object[$type[1]]->remove_from_parent ();
395 unset ($this->dialog);
396 $this->dialog= FALSE;
397 $to_del = FAI::clean_up_releases($dn);
398 FAI::save_release_changes_now();
400 foreach($to_del as $dn){
401 $ldap->rmdir_recursive($dn);
402 }
404 } else {
406 /* Normally this shouldn't be reached, send some extra
407 logs to notify the administrator */
408 msg_dialog::display(_("Permission error"), msgPool::permDelete(), ERROR_DIALOG);
409 new log("security","fai/".get_class($this),$dn,array(),"Tried to trick deletion.");
410 }
411 }
413 /* Remove lock file after successfull deletion */
414 $this->remove_lock();
415 $this->dns = array();
416 }
419 /********************
420 Delete MULTIPLE entries Canceled
421 ********************/
423 /* Remove lock */
424 if(isset($_POST['delete_multiple_fai_object_cancel'])){
425 $this->dns = array();
426 $this->remove_lock();
427 }
430 /****************
431 Delete aborted
432 ****************/
434 /* Delete canceled? */
435 if (isset($_POST['delete_cancel'])){
436 $this->remove_lock();
437 }
440 /****************
441 Delete confirmed
442 ****************/
444 /* Deltetion was confirmed, so delete this entry
445 */
446 if (isset($_POST['delete_terminal_confirm'])){
448 /* Some nice guy may send this as POST, so we've to check
449 for the permissions again. */
451 /* Find out more about the object type */
452 $ldap = $this->config->get_ldap_link();
453 $ldap->cat($this->dn, array('objectClass'));
454 if($ldap->count()){
455 $attrs = $ldap->fetch();
456 $type = $this->get_type($attrs);
458 $acl = $this->ui->get_permissions($this->dn,"fai/".$type[1]);
459 if(preg_match("/d/",$acl)){
461 $this->dialog = new $type[0]($this->config, $this->config->data['TABS'][$type[2]], $this->dn,"fai");
462 $this->dialog->set_acl_base($this->dn);
463 $this->dialog->parent = &$this;
464 $this->dialog->by_object[$type[1]]->remove_from_parent ();
465 unset ($this->dialog);
466 $this->dialog= FALSE;
467 $to_del = FAI::clean_up_releases($this->dn);
468 FAI::save_release_changes_now();
470 foreach($to_del as $dn){
471 $ldap->rmdir_recursive($dn);
472 }
474 } else {
476 /* Normally this shouldn't be reached, send some extra
477 logs to notify the administrator */
478 msg_dialog::display(_("Permission error"), msgPool::permDelete(), ERROR_DIALOG);
479 new log("security","fai/".get_class($this),$dn,array(),"Tried to trick deletion.");
480 }
482 }else{
483 msg_dialog::display(_("Error"), sprintf(_("Cannot delete '%s': object does not exist!"), $this->dn) , ERROR_DIALOG);
484 }
486 /* Remove lock file after successfull deletion */
487 $this->remove_lock();
488 }
491 /****************
492 Edit entry
493 ****************/
495 if(($s_action == "edit") && (!isset($this->dialog->config))){
496 $entry = $this->objects[$s_entry];
497 $a_setup = $this->get_type($entry);
498 $this->dn = $entry['dn'];
500 /* Check locking, save current plugin in 'back_plugin', so the dialog knows where to return. */
501 if (($user= get_lock($this->dn)) != ""){
502 return(gen_locked_message ($user, $this->dn));
503 }
504 add_lock ($this->dn, $this->ui->dn);
506 $this->dialog = new $a_setup[0]($this->config,$this->config->data['TABS'][$a_setup[2]],$this->dn,"fai");
507 $this->dialog->parent = &$this;
508 $this->dialog->by_object[$a_setup[1]]->FAIstate = $entry['FAIstate'];
509 $this->dialog->set_acl_base($this->dn);
510 $this->is_dialog = true;
511 session::set('objectinfo',$this->dn);
512 }
515 /* Branch handling
516 09.01.2006
517 */
519 /****************
520 Remove branch
521 ****************/
523 /* Remove branch
524 */
525 if($s_action == "remove_branch"){
526 $base= $this->fai_release;
528 /* Check if we have a post remove method configured
529 * else skip this operation. (Skip:Button in the ui should be disabled in this case too)
530 */
531 if("" != $this->config->search("faiManagement", "POSTREMOVE",array('menu','tabs'))){
532 /* Load permissions for selected 'dn' and check if
533 we're allowed to remove this 'dn' */
534 if($this->acl_is_removeable()){
535 $smarty->assign("release_hidden",base64_encode($this->fai_release));
536 $smarty->assign("info", msgPool::deleteInfo(@LDAP::fix($this->fai_release),_("FAI branch/freeze")));
537 return($smarty->fetch(get_template_path('remove_branch.tpl',TRUE)));
538 } else {
539 msg_dialog::display(_("Permission error"), _("You have no permission to delete this release!"), ERROR_DIALOG);
540 }
541 }
542 }
545 /****************
546 Remove branch confirmed
547 ****************/
549 if(isset($_POST['delete_branch_confirm'])){
551 /* Check if we have a post remove method configured
552 * else skip this operation. (Skip:Button in the ui should be disabled in this case too)
553 */
554 if("" != $this->config->search("faiManagement", "POSTREMOVE",array('menu','tabs'))){
556 if(!isset($_POST['release_hidden']) || base64_decode($_POST['release_hidden']) != $this->fai_release){
557 msg_dialog::display(_("Warning"),_("Release remove aborted because the release name check failed!"));
558 }else{
560 $bb = $this->fai_release;
561 if(!isset($ldap)){
562 $ldap = $this->config->get_ldap_link();
563 }
565 $br = $this->getBranches();
567 if(isset($br[$bb]) && $this->acl_is_removeable()){
568 $name = $br[$bb];
570 $ldap->cd($bb);
571 $ldap->recursive_remove();
572 $ldap->cd(preg_replace('/,'.normalizePreg(get_ou('faiou')).'/', ','.get_ou('applicationou'), $bb));
573 $ldap->recursive_remove();
574 $ldap->cd(preg_replace('/,'.normalizePreg(get_ou('faiou')).'/', ','.get_ou('mimetypeou'), $bb));
575 $ldap->recursive_remove();
577 /* Search for all groups with configured application menus.
578 - First search all groups, to ensure that we only remove entries form whithin groups.
579 - The search für menu configuration for the specified release and collect all those dns.
580 - Remove entries
581 */
582 $release_ou = preg_replace("/".normalizePreg(get_ou("faiou")).".*$/","",$bb);
583 $ldap->cd($this->config->current['BASE']);
584 $ldap->search("(objectClass=posixGroup)",array("dn"));
586 /* Collect all group dns
587 */
588 $groups = array();
589 while($attrs = $ldap->fetch()){
590 $groups[] = $attrs['dn'];
591 }
593 /* Collect all group menu release dns that match the release we have removed
594 */
595 $dns = array();
596 foreach($groups as $dn){
597 $ldap->cd($dn);
598 $ldap->search("(objectClass=FAIbranch)",array("dn"));
599 while($attrs = $ldap->fetch()){
600 if(preg_match("/^".normalizePreg($release_ou)."/",$attrs['dn'])){
601 $dns[] = $attrs['dn'];
602 }
603 }
604 }
606 /* Finally remove collected release dns
607 */
608 foreach($dns as $dn){
609 $ldap->cd($dn);
610 $ldap->recursive_remove();
611 }
613 /* Post remove */
614 $this->fai_release = $this->fai_base;
615 $this->lock_name = $name;
616 $this->lock_dn = $bb;
617 $this->postremove();
619 $fai_filter = session::get("fai_filter");
620 $fai_filter['fai_release'] = $this->fai_release;
621 session::set("fai_filter",$fai_filter);
623 new log("remove","fai/".get_class($this),$br[$bb],array(),"Release removed");
624 }
625 }
626 }
627 }
630 /****************
631 Create a new branch "insert Name"
632 ****************/
634 if((isset($_POST['UseBranchName']))&&(($this->dispNewBranch)||($this->dispNewFreeze))){
635 session::set('LASTPOST',$_POST);
637 if($this->dispNewBranch){
638 $type = "branch";
639 }else{
640 $type = "freeze";
641 }
643 /* Check branch name */
644 $name = $_POST['BranchName'];
645 $is_ok = true;
646 $smarty->assign("BranchName",$name);
647 $base= $this->fai_base;
649 /* Check used characters */
650 if(!preg_match("/^[0-9a-z\.]*$/",$name)){
651 msg_dialog::display(_("Error"), msgPool::invalid(_("Name"),$name,"/[0-9a-z\.]/"), ERROR_DIALOG);
652 $is_ok = false;
653 }
655 /* Check if this name is already in use */
656 if(!$this->CheckNewBranchName($_POST['BranchName'],$this->fai_release)){
657 msg_dialog::display(_("Error"), msgPool::duplicated(_("Name")), ERROR_DIALOG);
658 $is_ok = false;
659 }
661 if($is_ok){
663 if(session::is_set('LASTPOST')){
664 $LASTPOST = session::get('LASTPOST');
665 }else{
666 $LASTPOST = array();
667 }
668 $LASTPOST['base'] = $base;
669 $LASTPOST['type'] = $type;
670 session::set('LASTPOST',$LASTPOST);
671 $smarty->assign("iframe", true);
672 $smarty->assign("plugID", $_GET['plug']);
673 $display = $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__)));
674 return($display);
675 }
676 }
679 /****************
680 Create a new branch
681 ****************/
683 if(isset($_GET['PerformBranch'])){
685 if(!$this->acl_is_createable()){
686 msg_dialog::display(_("Permission error"), msgPool::permCreate(_("Branch")), ERROR_DIALOG);
687 }else{
689 /* In order to see error messages we have to reset the error handler.
690 Due to the exit();
691 */
692 restore_error_handler();
694 /* Create it know */
695 $this->dispNewBranch = false;
696 $this->dispNewFreeze = false;
698 $LASTPOST = session::get('LASTPOST');
699 $base = $LASTPOST['base'];
700 $_POST = session::get('LASTPOST');
701 $name = $_POST['BranchName'];
703 $type = $LASTPOST['type'];
704 $ldap = $this->config->get_ldap_link();
706 $baseToUse = $base;
707 if($this->fai_release != $this->fai_base){
708 $baseToUse = $this->fai_release;
709 }
711 /* Create new Release name to be able to set faidebianRelease for FAIpackageList */
713 $CurrentReleases = $this->getBranches();
714 $NewReleaseName = $name;
715 if(isset($CurrentReleases[$this->fai_release])) {
716 if($this->fai_release != $this->fai_base){
717 $NewReleaseName = $CurrentReleases[$this->fai_release]."/".$name;
718 $NewReleaseName = preg_replace("#\/#","/",$NewReleaseName);
719 }else{
720 $NewReleaseName = $name;
721 }
722 }
724 $appsrc = preg_replace("/".normalizePreg(get_ou('faiou'))."/",get_ou('applicationou'),$baseToUse);
725 $appdst = preg_replace("/".normalizePreg(get_ou('faiou'))."/",get_ou('applicationou'),"ou=".$name.",".$baseToUse) ;
727 $mimesrc = preg_replace("/".normalizePreg(get_ou('faiou'))."/",get_ou('mimetypeou'),$baseToUse);
728 $mimedst = preg_replace("/".normalizePreg(get_ou('faiou'))."/",get_ou('mimetypeou'),"ou=".$name.",".$baseToUse) ;
730 /* Check if source depeartments exist */
731 foreach(array($baseToUse,$appsrc,$mimesrc) as $dep){
732 $ldap->cd($this->config->current['BASE']);
733 $ldap->cat($dep);
734 if(!$ldap->count()){
735 $ldap->create_missing_trees($dep);
736 }
737 }
739 /* Print header to have styles included */
740 echo ' <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
741 <html>
742 <head>
743 <title></title>
744 <style type="text/css">@import url("themes/default/style.css");</style>
745 <script language="javascript" src="include/focus.js" type="text/javascript"></script>
746 </head>
747 <body style="background: none;margin:3px;color:black">
748 ';
750 new log("create","fai/".get_class($this),$NewReleaseName,array(),"New $type created");
752 /* Duplicate group application releases
753 */
754 FAI::copy_FAI_group_releases($CurrentReleases[$this->fai_release],$name,$type);
756 /* Duplicate applications
757 */
758 $ldap->cat($appsrc,array("dn")) ;
759 if($ldap->count()){
760 $ldap->cd ($appdst);
761 $ldap->recursive_remove();
762 FAI::copy_FAI_resource_recursive($appsrc,$appdst,$NewReleaseName,$type,true);
763 }
765 /* Duplicate mime types
766 */
767 $ldap->cat($mimesrc,array("dn")) ;
768 if($ldap->count()){
769 $ldap->cd ($mimedst);
770 $ldap->recursive_remove();
771 FAI::copy_FAI_resource_recursive($mimesrc,$mimedst,$NewReleaseName,$type,true);
772 }
774 $attr = array();
775 $attr['objectClass'] = array("organizationalUnit","FAIbranch");
776 $attr['ou'] = $name;
777 $attr['FAIstate'] = $type;
778 $ldap->cd($this->config->current['BASE']);
779 $ldap->cd("ou=".$name.",".$baseToUse);
780 $ldap->cat("ou=".$name.",".$baseToUse);
781 if($ldap->count()){
782 $ldap->modify($attr);
783 }else{
784 $ldap->add($attr);
785 }
787 /* Duplicate fai objects
788 */
789 // $ldap->cd ("ou=".$name.",".$baseToUse);
790 // $ldap->recursive_remove();
791 // FAI::copy_FAI_resource_recursive($baseToUse,"ou=".$name.",".$baseToUse,$NewReleaseName,$type,true);
793 echo "<div style='width:100%;text-align:right;'><form name='form' method='post' action='?plug=".$_GET['plug']."' target='_parent'>
794 <br><input type='submit' name='CloseIFrame' value='"._("Continue")."'>
795 </form></div>";
797 echo "<script language=\"javascript\" type=\"text/javascript\">scrollDown2();</script>" ;
799 /* Print footer to have valid html */
800 echo "</body></html>";
802 $this->dispNewFreeze = false;
804 /* Postcreate */
806 /* Assign possible attributes */
807 $this->lock_type = $type;
808 $this->lock_name = $name;
809 $this->lock_dn = $baseToUse;
810 $this->postcreate();
813 /* Send daemon event to reload the fai release database
814 */
815 if(class_available("DaemonEvent") && class_available("gosaSupportDaemon")){
816 $events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);
817 if(isset($events['TRIGGERED']['DaemonEvent_recreate_fai_release_db'])){
818 $evt = $events['TRIGGERED']['DaemonEvent_recreate_fai_release_db'];
819 $tmp = new $evt['CLASS_NAME']($this->config);
820 $tmp->set_type(TRIGGERED_EVENT);
821 $tmp->add_targets(array("GOsa"));
822 $o_queue = new gosaSupportDaemon();
823 if(!$o_queue->append($tmp)){
824 msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
825 }
826 }
827 }else{
828 trigger_error("Unknown class DaemonEvent / gosaSupportDaemon");
829 msg_dialog::display(_("Fatal error"),
830 "Daemon events called but classes where not accessible, DaemonEvent gosaSupportDaemon",
831 FATAL_ERROR_DIALOG);
832 }
833 exit();
834 }
835 }
837 /****************
838 Display dialog to enter new Branch name
839 ****************/
841 /* Check if we have a post create method configured
842 * else skip this operation. (Skip:Button in the ui should be disabled in this case too)
843 */
844 if("" != $this->config->search("faiManagement", "POSTCREATE",array('menu','tabs'))){
845 if(($s_action == "branch_branch")||($this->dispNewBranch)){
846 if(!$this->acl_is_createable()){
847 msg_dialog::display(_("Permission error"), msgPool::permCreate(_("Branch")), ERROR_DIALOG);
848 }else{
849 $this->dispNewBranch=true;
850 $smarty->assign("iframe",false);
851 $display .= $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__)));
852 return($display);
853 }
854 }
855 }
858 /****************
859 Display dialog to enter new Freeze name
860 ****************/
862 /* Check if we have a post create method configured
863 * else skip this operation. (Skip:Button in the ui should be disabled in this case too)
864 */
865 if("" != $this->config->search("faiManagement", "POSTCREATE",array('menu','tabs'))){
866 if(($s_action == "freeze_branch")||($this->dispNewFreeze)){
867 if(!$this->acl_is_createable()){
868 msg_dialog::display(_("Permission error"), msgPool::permCreate(_("Branch")), ERROR_DIALOG);
869 }else{
870 $this->dispNewFreeze = true;
871 $smarty->assign("iframe",false);
872 $display .= $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__)));
873 return($display);
874 }
875 }
876 }
879 /****************
880 Create a new object
881 ****************/
883 $types = array( "new_partition" => "FAIpartitionTable",
884 "new_script" => "FAIscript",
885 "new_hook" => "FAIhook",
886 "new_variable" => "FAIvariable",
887 "new_template" => "FAItemplate",
888 "new_package" => "FAIpackageList");
889 $types_i18n = array( "new_partition" => _("partition table"),
890 "new_script" => _("script"),
891 "new_hook" => _("hook"),
892 "new_variable" => _("variable"),
893 "new_template" => _("template"),
894 "new_package" => _("package list"));
896 if(isset($types[$s_action])){
897 $acl = $this->ui->get_permissions($this->fai_base,"fai/".$type_acl_mapping[$types[$s_action]]);
898 if(preg_match("/c/",$acl)){
899 $this->dialog = new askClassName($this->config,$this->dn,$this->ui,$types[$s_action]);
900 $this->dialog->parent = &$this;
901 }else{
902 msg_dialog::display(_("Permission error"), sprintf(_("You have no permission to create a new %s!"), $types_i18n[$s_action]), ERROR_DIALOG);
903 }
904 }
906 /* New Profile */
907 if($s_action == "new_profile"){
908 $this->dn = "new" ;
910 $acl = $this->ui->get_permissions($this->fai_base,"fai/faiProfile");
911 if(preg_match("/c/",$acl)){
912 $a_setup= $this->get_type(array("objectClass"=>array("FAIprofile")));
913 $this->dialog = new $a_setup[0]($this->config,$this->config->data['TABS'][$a_setup[2]],$this->dn,"fai");
914 $this->dialog->set_acl_base($this->base);
915 $this->dialog->parent = &$this;
917 $this->is_dialog = false;
918 }else{
919 msg_dialog::display(_("Permission error"), sprintf(_("You have no permission to create a new %s!"), _("profile")), ERROR_DIALOG);
920 }
921 }
924 /****************
925 Get from ask class name dialog
926 ****************/
928 if($s_action == "select_class_name_finished"){
929 $this->dialog->save_object();
930 if(count($this->dialog->check())!=0){
931 foreach($this->dialog->check() as $msg){
932 msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
933 }
934 }elseif(isset($this->dialog->objectClass)){
935 $this->dn = "new" ;
936 $a_setup= $this->get_type(array("objectClass"=>array($this->dialog->objectClass)));
937 $name = $this->dialog->save();
939 if(class_exists($a_setup[0])){
940 $this->dialog = new $a_setup[0]($this->config,$this->config->data['TABS'][$a_setup[2]],$this->dn,"fai");
941 $this->dialog->set_acl_base($this->base);
942 $this->dialog->by_object[$a_setup[1]]->cn = $name;
943 $this->dialog->parent = &$this;
944 $this->is_dialog = true;
945 }
946 }
947 }
950 /****************
951 Cancel dialogs
952 ****************/
954 if(isset($_POST['edit_cancel'])){
955 $this->dialog=FALSE;
956 $this->is_dialog = false;
957 session::un_set('objectinfo');
958 $this->remove_lock();
959 }
962 /****************
963 Save sub dialogs
964 ****************/
966 /* This check if the given tab could be saved
967 * If it was possible to save it, remove dialog object.
968 * If it wasn't possible, show errors and keep dialog.
969 */
970 if((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->dialog->config))){
971 $this->dialog->save_object();
972 $msgs= $this->dialog->check();
973 if(count($msgs)!=0){
974 foreach($msgs as $msg){
975 msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
976 }
977 }else{
978 $this->dialog->save();
979 FAI::save_release_changes_now();
980 if (!isset($_POST['edit_apply'])){
981 $this->remove_lock();
982 $this->dialog=FALSE;
983 $this->is_dialog=false;
984 session::un_set('objectinfo');
985 }else{
987 /* Reinitialize tab */
988 if($this->dialog instanceof tabs){
989 $this->dialog->re_init();
990 }
991 }
992 }
993 }
996 /****************
997 Display currently open dialog
998 ****************/
1000 /* If dialog is set, but $this->is_dialog==false, then
1001 * only the "abort" button is shown, this are dialogs that must not be saved.
1002 * If is_dialog == true, we are currently editing tab objects.
1003 * Here we need both, save and cancel
1004 */
1006 if(is_object($this->dialog)){
1007 $display .= $this->dialog->execute();
1008 /* Don't show buttons if tab dialog requests this */
1010 if(isset($this->dialog->current)){
1012 $obj = $this->dialog->by_object[$this->dialog->current];
1014 if((isset($obj->is_dialog) && (!$obj->is_dialog)) || (isset($obj->dialog) && (!$obj->dialog))){
1016 $display.= "<p style=\"text-align:right\">\n";
1017 if(!$this->no_save){
1018 $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\"".msgPool::okButton()."\">\n";
1019 $display.= " \n";
1020 if ($this->dn != "new"){
1021 $display.= "<input type=submit name=\"edit_apply\" value=\"".msgPool::applyButton()."\">\n";
1022 $display.= " \n";
1023 }
1024 }
1025 $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">\n";
1026 $display.= "</p>";
1027 }elseif(!isset($this->dialog->current)){
1028 $display.= "<p style=\"text-align:right\">\n";
1029 $display.= "<input type=\"submit\" name=\"edit_continue\" value=\""._("Continue")."\"> ";
1030 $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">\n";
1031 $display.= "</p>";
1032 }
1033 }else{
1034 $display.= "<p style=\"text-align:right\">\n";
1035 $display.= "<input type=\"submit\" name=\"edit_continue\" value=\""._("Continue")."\"> ";
1036 $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">\n";
1037 $display.= "</p>";
1039 }
1040 return($display);
1041 }
1044 /****************
1045 Dialog display
1046 ****************/
1048 /* Check if there is a snapshot dialog open */
1049 $base = $this->fai_base;
1050 if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases(),$this)){
1051 return($str);
1052 }
1054 /* Display dialog with system list */
1055 $this->reload();
1056 $this->DivListFai->parent = &$this;
1057 $this->DivListFai->execute();
1058 $this->DivListFai->setEntries($this->objects);
1059 return($this->DivListFai->Draw());
1060 }
1063 /* Return departments, that will be included within snapshot detection */
1064 function get_used_snapshot_bases()
1065 {
1066 $tmp = array();
1067 $types = array("faipartitionou","faiscriptou","faitemplateou","faihookou","faiprofileou","faivariableou","faipackageou");
1068 foreach($types as $type){
1069 $tmp[] = get_ou($type).$this->fai_release;
1070 }
1071 return($tmp);
1072 }
1075 /* Get available branches for current base */
1076 function getBranches($base = false,$prefix = "")
1077 {
1078 $ret = array("/"=>$this->fai_base);
1079 $ldap = $this->config->get_ldap_link();
1080 if(!$base){
1081 $base = $this->fai_base;
1082 }
1083 $tmp = FAI::get_all_releases_from_base($base,true);
1084 foreach($tmp as $dn => $name){
1085 $ret[$name]=$dn;
1086 }
1087 ksort($ret);
1088 $ret = array_flip($ret);
1090 return ($ret);
1091 }
1094 function list_get_selected_items()
1095 {
1096 $ids = array();
1097 foreach($_POST as $name => $value){
1098 if(preg_match("/^item_selected_[0-9]*$/",$name)){
1099 $id = preg_replace("/^item_selected_/","",$name);
1100 $ids[$id] = $id;
1101 }
1102 }
1103 return($ids);
1104 }
1107 /* reload list of objects */
1108 function reload()
1109 {
1110 /* Variable initialisation */
1111 $str = "";
1112 $Regex = $this->DivListFai->Regex;
1113 $this->objects = array();
1115 /* Get base */
1116 $base = $this->fai_base;
1117 if($this->fai_release != $this->fai_base){
1118 $br = $this->getBranches();
1119 if(isset($br[$this->fai_release])){
1120 $base = $this->fai_release;
1121 }else{
1122 $base = $this->fai_base;
1123 }
1124 }
1125 $this->base = $base;
1126 $this->set_acl_base($this->base);
1128 $this->lock_type = FAI::get_release_tag(FAI::get_release_dn($base));
1130 /* Create a new list of FAI object
1131 * Generate List of Partitions,Hooks,Scripts,Templates,Profiles ...
1132 */
1133 $ObjectTypes = array(
1134 "FAIpartitionTable" => array("OU"=> get_ou('faipartitionou') , "CHKBOX"=>"ShowPartitions" ,"ACL" => "faiPartitionTable"),
1135 "FAIpackageList" => array("OU"=> get_ou('faipackageou') , "CHKBOX"=>"ShowPackages" ,"ACL" => "faiPackage"),
1136 "FAIscript" => array("OU"=> get_ou('faiscriptou') , "CHKBOX"=>"ShowScripts" ,"ACL" => "faiScript"),
1137 "FAIvariable" => array("OU"=> get_ou('faivariableou') , "CHKBOX"=>"ShowVariables" ,"ACL" => "faiVariable"),
1138 "FAIhook" => array("OU"=> get_ou('faihookou') , "CHKBOX"=>"ShowHooks" ,"ACL" => "faiHook"),
1139 "FAIprofile" => array("OU"=> get_ou('faiprofileou') , "CHKBOX"=>"ShowProfiles" ,"ACL" => "faiProfile"),
1140 "FAItemplate" => array("OU"=> get_ou('faitemplateou') , "CHKBOX"=>"ShowTemplates" ,"ACL" => "faiTemplate"));
1142 $filter = "";
1143 foreach($ObjectTypes as $key => $data){
1144 if($this->DivListFai->$data['CHKBOX']){
1145 $filter.= "(objectClass=".$key.")";
1146 }
1147 }
1148 $filter = "(&(|".$filter.")(cn=$Regex))";
1150 /* Get resolved release dependencies */
1151 $tmp = FAI::get_all_objects_for_given_base($base,$filter);
1153 /* Ge listed ldap objects */
1154 $ldap = $this->config->get_ldap_link();
1155 $ldap->cd($this->config->current['BASE']);
1157 foreach($tmp as $entry){
1159 /* Get some more informations about the object */
1160 $ldap->cat($entry['dn'], array("cn","description","objectClass","FAIclass","FAIstate","objectClass"));
1161 $object = $ldap->fetch();
1163 /* Walk through possible types */
1164 foreach($ObjectTypes as $type => $rest){
1166 $acl = $this->ui->get_permissions($object['dn'],"fai/".$rest ['ACL']);
1168 if(in_array($type,$object['objectClass']) && preg_match("/r/",$acl)){
1170 /* Prepare object */
1171 unset($object['objectClass']['count']);
1172 if(!isset($object['description'][0])){
1173 $object['description'][0]="";
1174 }
1176 /* Clean up object informations */
1177 $obj = array();
1178 $obj['cn'] = $object['cn'][0];
1179 $obj['dn'] = $object['dn'];
1180 $obj['acl'] = $acl;
1181 $obj['class'] = $rest ['ACL'];
1182 $obj['FAIstate'] = $entry['FAIstate'];
1183 $obj['description'] = $object['description'][0];
1184 $obj['objectClass'] = $object['objectClass'];
1186 $this->objects[strtolower($obj['cn']).$obj['cn'].$type] = $obj;
1187 $this->objects[strtolower($obj['cn']).$obj['cn'].$type]['type']=$type;
1188 }
1189 }
1190 }
1192 /* Append opsi objects, if opsi is available and if we are on the fai_base
1193 */
1194 if($this->opsi instanceof opsi && $this->opsi->enabled()){
1196 $err = FALSE;
1197 if(!$err && $this->DivListFai->ShowOpsiNetboot){
1198 $n_pro = $this->opsi->get_netboot_products();
1199 $err |= $this->opsi->is_error();
1200 foreach($n_pro as $name => $data){
1201 $entry = array("cn" => $name,
1202 "description" => $data['DESC'],
1203 "type" => "opsi_netboot");
1204 $this->objects[$name."_opsi_netboot"] = $entry;
1205 }
1206 }
1207 if(!$err && $this->DivListFai->ShowOpsiLocal){
1208 $l_pro = $this->opsi->get_local_products();
1209 $err |= $this->opsi->is_error();
1210 foreach($l_pro as $name => $data){
1211 $entry = array("cn" => $name,
1212 "description" => $data['DESC'],
1213 "type" => "opsi_local");
1214 $this->objects[$name."_opsi_local"] = $entry;
1215 }
1216 }
1217 if($err){
1218 msg_dialog::display(_("Error"),msgPool::siError($this->opsi->get_error()),ERROR_DIALOG);
1219 }
1220 }
1222 ksort($this->objects);
1223 reset ($this->objects);
1225 /* use numeric index, thats a bit more secure */
1226 $tmp0 = array();
1227 foreach($this->objects as $obj){
1228 $tmp0[]= $obj;
1229 }
1230 $this->objects = array();
1231 $this->objects = $tmp0;
1232 }
1234 function remove_lock()
1235 {
1236 if (isset($this->dn)){
1237 del_lock ($this->dn);
1238 }
1239 if(isset($this->dns) && is_array($this->dns) && count($this->dns)){
1240 del_lock ($this->dns);
1241 }
1242 }
1244 function get_type($array){
1245 if(in_array("FAIpartitionTable",$array['objectClass'])){
1246 return(array("tabsPartition","faiPartitionTable","FAIPARTITIONTABS"));
1247 }
1248 if(in_array("FAIscript",$array['objectClass'])){
1249 return(array("tabsScript","faiScript","FAISCRIPTTABS"));
1250 }
1251 if(in_array("FAItemplate",$array['objectClass'])){
1252 return(array("tabsTemplate","faiTemplate","FAITEMPLATETABS"));
1253 }
1254 if(in_array("FAIhook",$array['objectClass'])){
1255 return(array("tabsHook","faiHook","FAIHOOKTABS"));
1256 }
1257 if(in_array("FAIvariable",$array['objectClass'])){
1258 return(array("tabsVariable","faiVariable","FAIVARIABLETABS"));
1259 }
1260 if(in_array("FAIprofile",$array['objectClass'])){
1261 return(array("tabsProfile","faiProfile","FAIPROFILETABS"));
1262 }
1264 if(in_array("FAIpackageList",$array['objectClass'])){
1265 return(array("tabsPackage","faiPackage","FAIPACKAGETABS"));
1266 }
1267 }
1269 function CheckNewBranchName($name,$base)
1270 {
1271 $f = $this->fai_release;
1272 if($name == ""){
1273 return(false);
1274 }elseif(in_array($name,$this->getBranches($f))) {
1275 return(false);
1276 }elseif(tests::is_department_name_reserved($name,$base)){
1277 return(false);
1278 }
1279 return(true);
1280 }
1282 function save_object()
1283 {
1284 $this->DivListFai->save_object();
1286 /* Get posted release */
1287 $r_releases = array_flip($this->getBranches());
1288 if(isset($_POST['fai_release']) && isset($r_releases[get_post('fai_release')])){
1290 /* Ensure that we have a valid release selected */
1291 if(!isset($r_releases[get_post('fai_release')])){
1292 msg_dialog::display(_("Warning"),_("The selected release is not available anymore. All triggered actions are skipped."));
1293 $_POST = array();
1294 $plug =$_GET['plug'];
1295 $_GET = array("plug" => $plug);
1296 $this->fai_release = $this->fai_base;
1297 }else{
1298 $this->fai_release = $r_releases[get_post('fai_release')];
1299 }
1301 $fai_filter = session::get("fai_filter");
1302 $fai_filter['fai_release'] = $this->fai_release;
1303 session::set("fai_filter",$fai_filter);
1304 }
1306 if(is_object($this->CopyPasteHandler)){
1307 $this->CopyPasteHandler->save_object();
1308 }
1309 }
1312 function copyPasteHandling_from_queue($s_action,$s_entry)
1313 {
1314 /* Check if Copy & Paste is disabled */
1315 if(!is_object($this->CopyPasteHandler)){
1316 return("");
1317 }
1319 $ui = get_userinfo();
1321 /* Add a single entry to queue */
1322 if($s_action == "copy"){
1324 /* Cleanup object queue */
1325 $this->CopyPasteHandler->cleanup_queue();
1326 $entry = $this->objects[$s_entry];
1327 $a_setup = $this->get_type($entry);
1328 $dn = $entry['dn'];
1330 if($ui->is_copyable($dn,"fai",$a_setup[1])){
1331 $this->CopyPasteHandler->add_to_queue($dn,$s_action,$a_setup[0],$a_setup[2],"fai");//$a_setup[1]);
1332 }
1333 }
1335 /* Add entries to queue */
1336 if($s_action == "copy_multiple"){
1338 /* Cleanup object queue */
1339 $this->CopyPasteHandler->cleanup_queue();
1341 /* Add new entries to CP queue */
1342 foreach($this->list_get_selected_items() as $id){
1344 /* Cleanup object queue */
1345 $entry = $this->objects[$id];
1346 $a_setup = $this->get_type($entry);
1347 $dn = $entry['dn'];
1349 if($s_action == "copy_multiple" && $ui->is_copyable($dn,"fai",$a_setup[1])){
1350 $this->CopyPasteHandler->add_to_queue($dn,"copy",$a_setup[0],$a_setup[2],"fai");//$a_setup[1]);
1351 }
1352 }
1353 }
1355 /* Start pasting entries */
1356 if($s_action == "editPaste" && !($this->lock_type == "freeze" && !$this->allow_freeze_object_attach)){
1357 $this->start_pasting_copied_objects = TRUE;
1358 }
1360 /* Return C&P dialog */
1361 if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
1363 /* Get dialog */
1364 $this->CopyPasteHandler->SetVar("parent",$this);
1365 $data = $this->CopyPasteHandler->execute();
1367 FAI::save_release_changes_now();
1369 /* Return dialog data */
1370 if(!empty($data)){
1371 return($data);
1372 }
1373 }
1375 /* Automatically disable status for pasting */
1376 if(!$this->CopyPasteHandler->entries_queued()){
1377 $this->start_pasting_copied_objects = FALSE;
1378 }
1379 return("");
1380 }
1383 /* Check if the given FAI class is used in this release
1384 */
1385 static function check_class_name($oc,$name,$dn)
1386 {
1387 $base = FAI::get_release_dn($dn);
1388 $res = FAI::get_all_objects_for_given_base($base,"(objectClass=".$oc.")",TRUE);
1389 $delete = array();
1390 $used = array();
1391 foreach($res as $object){
1392 $used[$object['cn'][0]]= $object['cn'][0];
1393 }
1394 return($used);
1395 }
1398 /* Return plugin informations for acl handling */
1399 static function plInfo()
1400 {
1401 return (array(
1402 "plShortName" => _("FAI releases"),
1403 "plDescription" => _("FAI release management"),
1404 "plSelfModify" => FALSE,
1405 "plDepends" => array(),
1406 "plPriority" => 0,
1407 "plSection" => array("administration"),
1408 "plCategory" => array("fai"=> array("description" => _("FAI"),
1409 "objectClass" => "FAIclass")),
1410 "plProvidedAcls"=> array()));
1411 }
1412 }
1413 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
1414 ?>