2e928eb717c9ac8ecb8ad8924c2f20be183f1779
1 <?php
2 /*
3 * This code is part of GOsa (http://www.gosa-project.org)
4 * Copyright (C) 2003-2008 GONICUS GmbH
5 *
6 * ID: $$Id$$
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
23 class groupManagement extends plugin
24 {
25 /* Definitions */
26 var $plHeadline= "Groups";
27 var $plDescription= "Manage POSIX groups";
29 /* Dialog attributes */
30 var $grouptab = NULL;
31 var $grouplist = array();
32 var $ui = NULL;
33 var $CopyPasteHandler = NULL;
34 var $DivListGroup = NULL;
35 var $ShowPrimaryCheckBox= false;
36 var $start_pasting_copied_objects = FALSE;
38 function groupManagement (&$config, &$ui)
39 {
40 /* Save configuration for internal use */
41 $this->config = &$config;
42 $this->ui = &$ui;
44 /* Copy & Paste enabled ?*/
45 if((isset($this->config->data['MAIN']['ENABLECOPYPASTE']))&&(preg_match("/true/i",$this->config->data['MAIN']['ENABLECOPYPASTE']))){
46 $this->CopyPasteHandler = new CopyPasteHandler($this->config);
47 }
49 /* Detect if we have to display the primary group checkbox */
50 $tmp = "";
51 if (isset($this->config->data['MAIN']['NOPRIMARYGROUP'])){
52 $tmp = $this->config->data['MAIN']['NOPRIMARYGROUP'];
53 }
54 if(preg_match("/true/i",$tmp)|| (preg_match("/yes/",$tmp))){
55 $this->ShowPrimaryCheckBox = false;
56 } else {
57 $this->ShowPrimaryCheckBox = true;
58 }
60 /* Create dialog object */
61 $this->DivListGroup = new divListGroup($this->config,$this);
62 $this->DivListGroup->DisableCheckBox("ShowPrimaryGroups",$this->ShowPrimaryCheckBox);
63 }
66 function execute()
67 {
68 /* Call parent execute */
69 plugin::execute();
71 /* Store these posts if the current object is locked (used by somebody else)*/
72 session::set('LOCK_VARS_TO_USE',array("/^act$/","/^id$/","/^group_edit_/","/^group_del_/","/^item_selected/","/^remove_multiple_groups/","/^multiple_edit/","/menu_action/"));
74 /* Save data */
75 $s_action = "";
76 $s_entry = "";
78 /* Test Posts */
79 foreach($_POST as $key => $val){
80 // Post for delete
81 if(preg_match("/^group_del.*/",$key)){
82 $s_action = "del";
83 $s_entry = preg_replace("/group_".$s_action."_/i","",$key);
84 // Post for edit
85 }elseif(preg_match("/^group_edit_.*/",$key)){
86 $s_action="edit";
87 $s_entry = preg_replace("/group_".$s_action."_/i","",$key);
88 // Post for new
89 }elseif(preg_match("/^group_new.*/",$key)){
90 $s_action="new";
91 }elseif(preg_match("/^dep_home.*/i",$key)){
92 $s_action="home";
93 }elseif(preg_match("/^group_tplnew.*/i",$key)){
94 $s_action="new_tpl";
95 }elseif(preg_match("/^group_chgpw.*/i",$key)){
96 $s_action="change_pw";
97 $s_entry = preg_replace("/group_chgpw_/i","",$key);
98 }elseif(preg_match("/_group_edit_/",$key)){
99 $type = preg_replace("/_group_edit_.*$/","",$key);
100 $s_action="edit";
101 $s_entry = preg_replace("/".$type."_group_edit_/i","",$key);
102 $_POST['arg'] = $type;
103 }elseif(preg_match("/^editPaste.*/i",$key)){
104 $s_action="editPaste";
105 }elseif(preg_match("/^copy_.*/",$key)){
106 $s_action="copy";
107 $s_entry = preg_replace("/^copy_/i","",$key);
108 }elseif(preg_match("/^cut_.*/",$key)){
109 $s_action="cut";
110 $s_entry = preg_replace("/^cut_/i","",$key);
111 }elseif(preg_match("/^remove_multiple_groups/",$key)){
112 $s_action="del_multiple";
113 }elseif(preg_match("/^multiple_copy_groups/",$key)){
114 $s_action = "copy_multiple";
115 }elseif(preg_match("/^multiple_cut_groups/",$key)){
116 $s_action = "cut_multiple";
117 }
118 }
119 $s_entry = preg_replace("/_.$/","",$s_entry);
121 /* Check for posted gets */
122 if((isset($_GET['act'])) && ($_GET['act'] == "edit_entry")){
123 $s_entry = $_GET['id'];
124 $s_action = "edit";
125 }
127 /* handle C&P from layers menu */
128 if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
129 $s_action = "copy_multiple";
130 }
131 if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
132 $s_action = "cut_multiple";
133 }
134 if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
135 $s_action = "editPaste";
136 }
138 /* Create options */
139 if(isset($_POST['menu_action']) && $_POST['menu_action'] == "group_new"){
140 $s_action = "new";
141 }
143 /* handle remove from layers menu */
144 if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
145 $s_action = "del_multiple";
146 }
147 if(isset($_POST['menu_action']) && $_POST['menu_action'] == "multiple_edit"){
148 $s_action = "multiple_edit";
149 }
151 if(isset($_POST['menu_action']) && preg_match("/^event/",$_POST['menu_action'])){
152 $s_action = $_POST['menu_action'];
153 }
155 $smarty= get_smarty();
159 /********************
160 Create notification event
161 ********************/
163 if(preg_match("/^event_/",$s_action) && class_available("DaemonEvent")){
164 $ids = $this->list_get_selected_items();
165 $uids = array();
166 foreach($ids as $id){
167 $uids[] = $this->grouplist[$id]['cn'][0];
168 }
169 if(count($uids)){
170 $events = DaemonEvent::get_event_types(USER_EVENT);
171 $event = preg_replace("/^event_/","",$s_action);
172 if(isset($events['BY_CLASS'][$event])){
173 $type = $events['BY_CLASS'][$event];
174 $this->grouptab = new $type['CLASS_NAME']($this->config);
175 $this->grouptab->add_targets($uids);
176 $this->grouptab->set_type(TRIGGERED_EVENT);
177 }
178 }
179 }
181 /* Abort event dialog */
182 if(isset($_POST['abort_event_dialog'])){
183 $this->grouptab = FALSE;
184 }
186 /* Save event */
187 if(isset($_POST['save_event_dialog'])){
188 $o_queue = new gosaSupportDaemon();
189 $o_queue->append($this->grouptab);
190 if($o_queue->is_error()){
191 msg_dialog::display(_("Daemon"),sprintf(_("Something went wrong while talking to the daemon: %s."),
192 $o_queue->get_error()),ERROR_DIALOG);
193 }else{
194 $this->grouptab = FALSE;
195 }
196 }
198 /* Display event */
199 if($this->grouptab instanceof DaemonEvent){
200 $this->grouptab->save_object();
201 return($this->grouptab->execute());
202 }
206 /********************
207 Copy & Paste Handling ...
208 ********************/
210 /* Display the copy & paste dialog, if it is currently open */
211 $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
212 if($ret){
213 return($ret);
214 }
217 /********************
218 Create a new group ...
219 ********************/
221 /* New group? */
222 if ($s_action=="new"){
224 /* Check create permissions */
225 $acl = $this->ui->get_permissions($this->DivListGroup->selectedBase,"groups/group");
226 if(preg_match("/c/",$acl)){
228 /* By default we set 'dn' to 'new', all relevant plugins will
229 react on this. */
230 $this->dn= "new";
232 /* Create new grouptab object */
233 $this->grouptab= new grouptabs($this->config, $this->config->data['TABS']['GROUPTABS'], $this->dn);
235 /* Set up the group ACL's for this 'dn' */
236 $this->grouptab->set_acl_base($this->DivListGroup->selectedBase);
237 }
238 }
241 /********************
242 Save Group Tab/Object Changes
243 ********************/
245 /* Finish group edit is triggered by the tabulator dialog, so
246 the user wants to save edited data. Check and save at this
247 point. */
248 if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->grouptab->config)) ){
250 /* Check tabs, will feed message array
251 Save, or display error message? */
252 $message= $this->grouptab->check();
253 if (count($message) == 0){
255 /* Save user data to ldap */
256 $this->grouptab->save();
258 if (!isset($_POST['edit_apply'])){
259 /* Group has been saved successfully, remove lock from LDAP. */
260 if ($this->dn != "new"){
261 del_lock ($this->dn);
262 }
264 /* There's no page reload so we have to read new groups at this point. */
265 //$this->reload ();
266 unset ($this->grouptab);
267 $this->grouptab= NULL;
268 session::un_set('objectinfo');
269 }
270 } else {
271 /* Ok. There seem to be errors regarding to the tab data,
272 show message and continue as usual. */
273 msg_dialog::displayChecks($message);
274 }
275 }
278 /********************
279 Edit multiple entries
280 ********************/
282 /* User wants to edit data? */
283 if ($s_action == "multiple_edit" && !isset($this->grouptab->config)){
285 $this->dn = array();
286 foreach($this->list_get_selected_items() as $id){
287 $this->dn[] = $this->grouplist[$id]['dn'];;
288 }
289 $tmp = new multi_plug($this->config,"grouptabs",$this->config->data['TABS']['GROUPTABS'],
290 $this->dn,$this->DivListGroup->selectedBase,"groups");
291 if ($tmp->entries_locked()){
292 return($tmp->display_lock_message());
293 }
294 $tmp->lock_entries($this->ui->dn);
295 if($tmp->multiple_available()){
296 $this->grouptab = $tmp;
297 session::set('objectinfo',$this->grouptab->get_object_info());
298 }
299 }
302 /********************
303 Edit existing group
304 ********************/
306 /* User wants to edit data? */
307 if (($s_action=="edit") && (!isset($this->grouptab-> config))){
309 /* Get 'dn' from posted 'uid', must be unique */
310 $this->dn= $this->grouplist[trim($s_entry)]['dn'];
312 /* Check locking & lock entry if required */
313 $user = get_lock($this->dn);
314 if ($user != ""){
315 return(gen_locked_message ($user, $this->dn));
316 }
317 add_lock ($this->dn, $this->ui->dn);
319 /* Register grouptab to trigger edit dialog */
320 $this->grouptab= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $this->dn);
321 $this->grouptab->set_acl_base($this->dn);
322 session::set('objectinfo',$this->dn);
323 }
326 /********************
327 Delete MULTIPLE entries requested, display confirm dialog
328 ********************/
330 if ($s_action=="del_multiple"){
331 $ids = $this->list_get_selected_items();
333 if(count($ids)){
335 foreach($ids as $id){
336 $dn = $this->grouplist[$id]['dn'];
337 if (($user= get_lock($dn)) != ""){
338 return(gen_locked_message ($user, $dn));
339 }
340 $this->dns[$id] = $dn;
341 }
343 $dns_names = array();
344 foreach($this->dns as $dn){
345 add_lock ($dn, $this->ui->dn);
346 $dns_names[] =@LDAP::fix($dn);
347 }
349 /* Lock the current entry, so nobody will edit it during deletion */
350 $smarty->assign("info", msgPool::deleteInfo($dns_names,_("group")));
351 $smarty->assign("multiple", true);
352 return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
353 }
354 }
357 /********************
358 Delete MULTIPLE entries confirmed
359 ********************/
361 /* Confirmation for deletion has been passed. Groups should be deleted. */
362 if (isset($_POST['delete_multiple_groups_confirm'])){
364 /* Remove user by user and check acls before removeing them */
365 foreach($this->dns as $key => $dn){
367 /* Load permissions for selected 'dn' and check if
368 we're allowed to remove this 'dn' */
369 $acl = $this->ui->get_permissions($dn,"groups/group");
370 if(preg_match("/d/",$acl)){
372 /* Delete request is permitted, perform LDAP action */
373 $this->grouptab= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $dn);
374 $this->grouptab->set_acl_base($dn);
375 $this->grouptab->delete ();
376 unset ($this->grouptab);
377 $this->grouptab= NULL;
379 } else {
381 /* Normally this shouldn't be reached, send some extra
382 logs to notify the administrator */
383 msg_dialog::display(_("Permission error"), msgPool::permDelete(), ERROR_DIALOG);
384 new log("security","groups/".get_class($this),$dn,array(),"Tried to trick deletion.");
385 }
386 /* Remove lock file after successfull deletion */
387 del_lock ($dn);
388 unset($this->dns[$key]);
389 }
390 }
393 /********************
394 Delete MULTIPLE entries Canceled
395 ********************/
397 /* Remove lock */
398 if(isset($_POST['delete_multiple_user_cancel'])){
399 foreach($this->dns as $key => $dn){
400 del_lock ($dn);
401 unset($this->dns[$key]);
402 }
403 }
406 /********************
407 Delete group
408 ********************/
410 /* Remove group was requested */
411 if ($s_action=="del"){
413 /* Get 'dn' from posted 'uid' */
414 $this->dn= $this->grouplist[trim($s_entry)]['dn'];
416 /* Load permissions for selected 'dn' and check if
417 we're allowed to remove this 'dn' */
418 $acl = $this->ui->get_permissions($this->dn,"groups/group");
419 if(preg_match("/d/",$acl)){
421 /* Check locking, save current plugin in 'back_plugin', so
422 the dialog knows where to return. */
423 if (($user= get_lock($this->dn)) != ""){
424 return(gen_locked_message ($user, $this->dn));
425 }
427 /* Lock the current entry, so nobody will edit it during deletion */
428 add_lock ($this->dn, $this->ui->dn);
429 $smarty->assign("info", msgPool::deleteInfo(@LDAP::fix($this->dn),_("group")));
430 $smarty->assign("multiple", false);
431 return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
433 } else {
435 /* Obviously the user isn't allowed to delete. Show message and clean session. */
436 msg_dialog::display(_("Permission error"), msgPool::permDelete());
437 }
438 }
441 /********************
442 Delete group confirmed
443 ********************/
445 /* Confirmation for deletion has been passed. Group should be deleted. */
446 if (isset($_POST['delete_group_confirm'])){
448 /* Some nice guy may send this as POST, so we've to check
449 for the permissions again. */
450 $acl = $this->ui->get_permissions($this->dn,"groups/group");
451 if(preg_match("/d/",$acl)){
453 /* Delete request is permitted, perform LDAP action */
454 $this->grouptab= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $this->dn);
455 $this->grouptab->set_acl_base($this->dn);
456 $this->grouptab->delete ();
457 unset ($this->grouptab);
458 $this->grouptab= NULL;
460 /* Group list has changed, reload it. */
461 //$this->reload ();
463 } else {
465 /* Normally this shouldn't be reached, send some extra
466 logs to notify the administrator */
467 msg_dialog::display(_("Permission error"), msgPool::permDelete(), ERROR_DIALOG);
468 new log("security","groups/".get_class($this),$dn,array(),"Tried to trick deletion.");
469 }
471 /* Remove lock file after successfull deletion */
472 del_lock ($this->dn);
473 session::un_set('objectinfo');
474 }
477 /********************
478 Delete group canceled
479 ********************/
481 /* Delete group canceled? */
482 if (isset($_POST['delete_cancel'])){
483 del_lock ($this->dn);
484 session::un_set('objectinfo');
485 }
488 /********************
489 A dialog was canceled
490 ********************/
492 /* Cancel dialogs */
493 if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel'])){
494 if(isset($this->grouptab->dn)){
495 del_lock ($this->grouptab->dn);
496 }
497 unset ($this->grouptab);
498 $this->grouptab= NULL;
499 session::un_set('objectinfo');
500 }
503 /********************
504 If there is currently a dialog open, display it
505 ********************/
507 /* Show tab dialog if object is present */
508 if (isset($this->grouptab->config)){
509 $display= $this->grouptab->execute();
511 /* Don't show buttons if tab dialog requests this */
512 if(isset($this->grouptab->by_object)){
513 if (!$this->grouptab->by_object[$this->grouptab->current]->dialog){
514 $display.= "<p style=\"text-align:right\">\n";
515 $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\"".msgPool::okButton()."\">\n";
516 $display.= " \n";
517 if ($this->dn != "new"){
518 $display.= "<input type=submit name=\"edit_apply\" value=\"".msgPool::applyButton()."\">\n";
519 $display.= " \n";
520 }
521 $display.= "<input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">\n";
522 $display.= "</p>";
523 }
524 }
525 return ($display);
526 }
529 /* Check if there is a snapshot dialog open */
530 $base = $this->DivListGroup->selectedBase;
531 if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
532 return($str);
533 }
535 /* Display dialog with group list */
536 $this->DivListGroup->parent = $this;
537 $this->DivListGroup->execute();
539 /* Add departments if subsearch is disabled */
540 if(!$this->DivListGroup->SubSearch){
541 $this->DivListGroup->AddDepartments($this->DivListGroup->selectedBase,4,1);
542 }
543 $this->reload ();
544 $this->DivListGroup->setEntries($this->grouplist);
545 return($this->DivListGroup->Draw());
546 }
549 /* Return departments, that will be included within snapshot detection */
550 function get_used_snapshot_bases()
551 {
552 return(array(get_groups_ou().$this->DivListGroup->selectedBase));
553 }
556 function list_get_selected_items()
557 {
558 $ids = array();
559 foreach($_POST as $name => $value){
560 if(preg_match("/^item_selected_[0-9]*$/",$name)){
561 $id = preg_replace("/^item_selected_/","",$name);
562 $ids[$id] = $id;
563 }
564 }
565 return($ids);
566 }
569 function reload($CreatePosixsList=false)
570 {
571 $this->grouplist = array();
572 $primaries = array();
573 $functional = array();
574 $error= $error2 = "";
575 $filter = "(objectclass=posixGroup)";
577 $base = $this->DivListGroup->selectedBase;
578 $Regex = $this->DivListGroup->Regex;
579 $UserRegex = $this->DivListGroup->UserRegex;
580 $SubSearch = $this->DivListGroup->SubSearch;
581 $ShowPrimaryGroups = $this->DivListGroup->ShowPrimaryGroups;
582 $ShowSambaGroups = $this->DivListGroup->ShowSambaGroups;
583 $ShowApplicationGroups = $this->DivListGroup->ShowApplicationGroups;
584 $ShowMailGroups = $this->DivListGroup->ShowMailGroups;
585 $ShowFunctionalGroups = $this->DivListGroup->ShowFunctionalGroups;
587 /* Prepare ldap class */
588 $ldap= $this->config->get_ldap_link();
589 $ldap->cd($base);
590 $ldap->set_size_limit(session::get('size_limit'));
593 /********************
594 Create filter depending on selected checkboxes
595 ********************/
597 /* Add application groups */
598 if ($ShowApplicationGroups){
599 $filter.= "(objectClass=gosaApplicationGroup)";
600 }
602 /* Add Mail Groups */
603 if ($ShowMailGroups){
604 $filter.= "(objectClass=gosaMailAccount)";
605 }
607 $sfilter= "";
608 if ($this->config->current['SAMBAVERSION'] == 3){
609 if (!$ShowPrimaryGroups){
610 $sfilter= "(objectClass=sambaGroupMapping)";
611 } elseif ($ShowSambaGroups){
612 $filter.= "(objectClass=sambaGroupMapping)";
613 }
614 }
616 /* Prepare filter for given Regex && UserRegex */
617 if ($filter != ""){
618 $filter= "(&(cn=$Regex)(objectClass=posixGroup)(|$filter))";
619 if ($UserRegex != ""){
620 $filter= "(&(|(memberUID=".$UserRegex.")(cn=".$UserRegex."))$filter)";
621 }
622 }
625 /********************
626 Collect some groupids to be able to skip primary & functional groups
627 ********************/
629 /* Collect primary groupIDs to show primary groups
630 if this option is enabled in gosa conf && the checkbox is checked */
631 if ($this->ShowPrimaryCheckBox){
632 $res = get_list("(&(uid=$Regex)(!(uid=*$))(objectClass=posixAccount)(gidNumber=*))",
633 "groups", $base,array("gidNumber", "cn"), GL_SUBSEARCH);
634 foreach ($res as $attrs){
635 $primaries[$attrs['gidNumber'][0]]= $attrs['cn'][0];
636 }
637 }
639 /* Collect all GroupIDs from those groups which are functional.
640 Only perfrom this search if ShowFunctionalGroups is unchecked, else leave arre empty */
641 $ff = "(&(cn=$Regex)(objectClass=posixGroup)(!(|(objectClass=gosaMailAccount)(objectClass=gosaApplicationGroup)$sfilter)))";
642 if ($SubSearch){
643 $res = get_sub_list($ff, "groups",get_groups_ou(), $base,array("gidNumber", "cn", "description"), GL_SUBSEARCH);
644 } else {
645 $res = get_sub_list($ff, "groups",get_groups_ou(), $base,array("gidNumber", "cn", "description"), GL_NONE);
646 }
647 foreach($res as $attrs){
648 if (!isset($primaries[$attrs['gidNumber'][0]])){
649 $functional[$attrs['gidNumber'][0]]= $attrs['gidNumber'][0];
650 }
651 }
653 /********************
654 Search for the prepared filter
655 ********************/
657 /* Attributes to search for */
658 $attrs = array("cn", "description", "gidNumber", "objectClass");
660 /* If subsearch is activated search for subobjects too */
661 $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
662 if(!empty($tmp)){
663 $attrs [] = "FAIrelease";
664 }
666 if ($SubSearch){
667 $res= get_sub_list($filter, "groups",get_groups_ou(), $base, $attrs, GL_SIZELIMIT| GL_SUBSEARCH);
668 } else {
669 $res= get_sub_list($filter, "groups",get_groups_ou(), get_groups_ou().$base, $attrs, GL_SIZELIMIT);
670 }
672 /* Sort values into grouplist*/
673 $tmp = $tmp2 = array();
674 foreach ($res as $value){
675 /* Skip functional groups if checkbox isn't checked */
676 if (!$ShowFunctionalGroups && isset($functional[$value['gidNumber'][0]])){
677 continue;
678 }
680 /* If gidNumber is in $primaries skip this entry */
681 if (($ShowPrimaryGroups) || (!$ShowPrimaryGroups && !isset($primaries[$value['gidNumber'][0]]))){
682 $tmp2[$value['cn'][0]] = $value;
683 $tmp [$value['cn'][0]] = $value['cn'][0];
684 }
685 }
686 natcasesort($tmp);
687 foreach($tmp as $name){
688 $this->grouplist[] = $tmp2[$name];
689 }
690 reset ($this->grouplist);
691 }
694 function copyPasteHandling_from_queue($s_action,$s_entry)
695 {
696 /* Check if Copy & Paste is disabled */
697 if(!is_object($this->CopyPasteHandler)){
698 return("");
699 }
701 /* Add a single entry to queue */
702 if($s_action == "cut" || $s_action == "copy"){
704 /* Cleanup object queue */
705 $this->CopyPasteHandler->cleanup_queue();
706 $dn = $this->grouplist[$s_entry]['dn'];
707 $this->CopyPasteHandler->add_to_queue($dn,$s_action,"grouptabs","GROUPTABS","groups");
708 }
711 /* Add entries to queue */
712 if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
714 /* Cleanup object queue */
715 $this->CopyPasteHandler->cleanup_queue();
717 /* Add new entries to CP queue */
718 foreach($this->list_get_selected_items() as $id){
719 $dn = $this->grouplist[$id]['dn'];
721 if($s_action == "copy_multiple"){
722 $this->CopyPasteHandler->add_to_queue($dn,"copy","grouptabs","GROUPTABS","groups");
723 }
724 if($s_action == "cut_multiple"){
725 $this->CopyPasteHandler->add_to_queue($dn,"cut","grouptabs","GROUPTABS","groups");
726 }
727 }
728 }
730 /* Start pasting entries */
731 if($s_action == "editPaste"){
732 $this->start_pasting_copied_objects = TRUE;
733 }
735 /* Return C&P dialog */
736 if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
738 /* Get dialog */
739 $data = $this->CopyPasteHandler->execute();
740 $this->CopyPasteHandler->SetVar("base",$this->DivListGroup->selectedBase);
742 /* Return dialog data */
743 if(!empty($data)){
744 return($data);
745 }
746 }
748 /* Automatically disable status for pasting */
749 if(!$this->CopyPasteHandler->entries_queued()){
750 $this->start_pasting_copied_objects = FALSE;
751 }
752 return("");
753 }
756 /* Save data to object */
757 function save_object()
758 {
759 $this->DivListGroup->save_object();
760 }
763 function remove_lock()
764 {
765 if (isset($this->grouptab->dn)){
766 del_lock ($this->grouptab->dn);
767 }
768 }
771 function remove_from_parent()
772 {
773 /* Optionally execute a command after we're done */
774 $this->postremove();
775 }
778 /* Save to LDAP */
779 function save()
780 {
781 /* Optionally execute a command after we're done */
782 $this->postcreate();
783 }
785 /* Unused functions */
786 function check() { }
787 function adapt_from_template($dn) { }
788 function password_change_needed() { }
789 }
790 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
791 ?>