3ddaa108ca91d5a292dc366c2a2969c58bd58c8a
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 */
21 class groupManagement extends plugin
22 {
23 /* Definitions */
24 var $plHeadline= "Groups";
25 var $plDescription= "Manage POSIX groups";
27 /* Dialog attributes */
28 var $grouptab = NULL;
29 var $grouplist = array();
30 var $ui = NULL;
31 var $CopyPasteHandler = NULL;
32 var $DivListGroup = NULL;
33 var $ShowPrimaryCheckBox= false;
34 var $start_pasting_copied_objects = FALSE;
36 function groupManagement (&$config, &$ui)
37 {
38 /* Save configuration for internal use */
39 $this->config = &$config;
40 $this->ui = &$ui;
42 /* Copy & Paste enabled ?*/
43 if((isset($this->config->data['MAIN']['ENABLECOPYPASTE']))&&(preg_match("/true/i",$this->config->data['MAIN']['ENABLECOPYPASTE']))){
44 $this->CopyPasteHandler = new CopyPasteHandler($this->config);
45 }
47 /* Detect if we have to display the primary group checkbox */
48 $tmp = "";
49 if (isset($this->config->data['MAIN']['NOPRIMARYGROUP'])){
50 $tmp = $this->config->data['MAIN']['NOPRIMARYGROUP'];
51 }
52 if(preg_match("/true/i",$tmp)|| (preg_match("/yes/",$tmp))){
53 $this->ShowPrimaryCheckBox = false;
54 } else {
55 $this->ShowPrimaryCheckBox = true;
56 }
58 /* Create dialog object */
59 $this->DivListGroup = new divListGroup($this->config,$this);
60 $this->DivListGroup->DisableCheckBox("ShowPrimaryGroups",$this->ShowPrimaryCheckBox);
61 }
64 function execute()
65 {
66 /* Call parent execute */
67 plugin::execute();
69 /* Store these posts if the current object is locked (used by somebody else)*/
70 session::set('LOCK_VARS_TO_USE',array("/^act$/","/^id$/","/^group_edit_/","/^group_del_/","/^item_selected/","/^remove_multiple_groups/","/^multiple_edit/","/menu_action/"));
72 /* Save data */
73 $s_action = "";
74 $s_entry = "";
76 /* Test Posts */
77 foreach($_POST as $key => $val){
78 // Post for delete
79 if(preg_match("/^group_del.*/",$key)){
80 $s_action = "del";
81 $s_entry = preg_replace("/group_".$s_action."_/i","",$key);
82 // Post for edit
83 }elseif(preg_match("/^group_edit_.*/",$key)){
84 $s_action="edit";
85 $s_entry = preg_replace("/group_".$s_action."_/i","",$key);
86 // Post for new
87 }elseif(preg_match("/^group_new.*/",$key)){
88 $s_action="new";
89 }elseif(preg_match("/^dep_home.*/i",$key)){
90 $s_action="home";
91 }elseif(preg_match("/^group_tplnew.*/i",$key)){
92 $s_action="new_tpl";
93 }elseif(preg_match("/^group_chgpw.*/i",$key)){
94 $s_action="change_pw";
95 $s_entry = preg_replace("/group_chgpw_/i","",$key);
96 }elseif(preg_match("/_group_edit_/",$key)){
97 $type = preg_replace("/_group_edit_.*$/","",$key);
98 $s_action="edit";
99 $s_entry = preg_replace("/".$type."_group_edit_/i","",$key);
100 $_POST['arg'] = $type;
101 }elseif(preg_match("/^editPaste.*/i",$key)){
102 $s_action="editPaste";
103 }elseif(preg_match("/^copy_.*/",$key)){
104 $s_action="copy";
105 $s_entry = preg_replace("/^copy_/i","",$key);
106 }elseif(preg_match("/^cut_.*/",$key)){
107 $s_action="cut";
108 $s_entry = preg_replace("/^cut_/i","",$key);
109 }elseif(preg_match("/^remove_multiple_groups/",$key)){
110 $s_action="del_multiple";
111 }elseif(preg_match("/^multiple_copy_groups/",$key)){
112 $s_action = "copy_multiple";
113 }elseif(preg_match("/^multiple_cut_groups/",$key)){
114 $s_action = "cut_multiple";
115 }
116 }
117 $s_entry = preg_replace("/_.$/","",$s_entry);
119 /* Check for posted gets */
120 if((isset($_GET['act'])) && ($_GET['act'] == "edit_entry")){
121 $s_entry = $_GET['id'];
122 $s_action = "edit";
123 }
125 /* handle C&P from layers menu */
126 if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
127 $s_action = "copy_multiple";
128 }
129 if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
130 $s_action = "cut_multiple";
131 }
132 if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
133 $s_action = "editPaste";
134 }
136 /* Create options */
137 if(isset($_POST['menu_action']) && $_POST['menu_action'] == "group_new"){
138 $s_action = "new";
139 }
141 /* handle remove from layers menu */
142 if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
143 $s_action = "del_multiple";
144 }
145 if(isset($_POST['menu_action']) && $_POST['menu_action'] == "multiple_edit"){
146 $s_action = "multiple_edit";
147 }
149 if(isset($_POST['menu_action']) && preg_match("/^trigger_event_DaemonEvent_notify/",$_POST['menu_action'])){
150 $s_action = "notify";
151 }
153 $smarty= get_smarty();
157 /********************
158 Create notification event
159 ********************/
161 if($s_action == "notify"){
163 $ids = $this->list_get_selected_items();
164 $uids = array();
165 foreach($ids as $id){
166 $uids[] = $this->grouplist[$id]['cn'][0];
167 }
168 if(count($uids)){
169 $this->grouptab = new DaemonEvent_notify($this->config);
170 $this->grouptab->add_targets($uids);
171 }
172 }
174 /* Abort event dialog */
175 if(isset($_POST['abort_event_dialog'])){
176 $this->grouptab = FALSE;
177 }
179 /* Save event */
180 if(isset($_POST['save_event_dialog'])){
181 $o_queue = new gosaSupportDaemon();
182 $o_queue->append($this->grouptab);
183 if($o_queue->is_error()){
184 msg_dialog::display(_("Daemon"),sprintf(_("Something went wrong while talking to the daemon: %s."),
185 $o_queue->get_error()),ERROR_DIALOG);
186 }else{
187 $this->grouptab = FALSE;
188 }
189 }
191 /* Display event */
192 if($this->grouptab instanceof DaemonEvent){
193 $this->grouptab->save_object();
194 return($this->grouptab->execute());
195 }
199 /********************
200 Copy & Paste Handling ...
201 ********************/
203 /* Display the copy & paste dialog, if it is currently open */
204 $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
205 if($ret){
206 return($ret);
207 }
210 /********************
211 Create a new group ...
212 ********************/
214 /* New group? */
215 if ($s_action=="new"){
217 /* Check create permissions */
218 $acl = $this->ui->get_permissions($this->DivListGroup->selectedBase,"groups/group");
219 if(preg_match("/c/",$acl)){
221 /* By default we set 'dn' to 'new', all relevant plugins will
222 react on this. */
223 $this->dn= "new";
225 /* Create new grouptab object */
226 $this->grouptab= new grouptabs($this->config, $this->config->data['TABS']['GROUPTABS'], $this->dn);
228 /* Set up the group ACL's for this 'dn' */
229 $this->grouptab->set_acl_base($this->DivListGroup->selectedBase);
230 }
231 }
234 /********************
235 Save Group Tab/Object Changes
236 ********************/
238 /* Finish group edit is triggered by the tabulator dialog, so
239 the user wants to save edited data. Check and save at this
240 point. */
241 if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->grouptab->config)) ){
243 /* Check tabs, will feed message array
244 Save, or display error message? */
245 $message= $this->grouptab->check();
246 if (count($message) == 0){
248 /* Save user data to ldap */
249 $this->grouptab->save();
251 if (!isset($_POST['edit_apply'])){
252 /* Group has been saved successfully, remove lock from LDAP. */
253 if ($this->dn != "new"){
254 del_lock ($this->dn);
255 }
257 /* There's no page reload so we have to read new groups at this point. */
258 //$this->reload ();
259 unset ($this->grouptab);
260 $this->grouptab= NULL;
261 session::un_set('objectinfo');
262 }
263 } else {
264 /* Ok. There seem to be errors regarding to the tab data,
265 show message and continue as usual. */
266 show_errors($message);
267 }
268 }
271 /********************
272 Edit multiple entries
273 ********************/
275 /* User wants to edit data? */
276 if ($s_action == "multiple_edit" && !isset($this->grouptab->config)){
278 $this->dn = array();
279 foreach($this->list_get_selected_items() as $id){
280 $this->dn[] = $this->grouplist[$id]['dn'];;
281 }
282 $tmp = new multi_plug($this->config,"grouptabs",$this->config->data['TABS']['GROUPTABS'],
283 $this->dn,$this->DivListGroup->selectedBase,"groups");
284 if ($tmp->entries_locked()){
285 return($tmp->display_lock_message());
286 }
287 $tmp->lock_entries($this->ui->dn);
288 if($tmp->multiple_available()){
289 $this->grouptab = $tmp;
290 session::set('objectinfo',$this->grouptab->get_object_info());
291 }
292 }
295 /********************
296 Edit existing group
297 ********************/
299 /* User wants to edit data? */
300 if (($s_action=="edit") && (!isset($this->grouptab-> config))){
302 /* Get 'dn' from posted 'uid', must be unique */
303 $this->dn= $this->grouplist[trim($s_entry)]['dn'];
305 /* Check locking & lock entry if required */
306 $user = get_lock($this->dn);
307 if ($user != ""){
308 return(gen_locked_message ($user, $this->dn));
309 }
310 add_lock ($this->dn, $this->ui->dn);
312 /* Register grouptab to trigger edit dialog */
313 $this->grouptab= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $this->dn);
314 $this->grouptab->set_acl_base($this->dn);
315 session::set('objectinfo',$this->dn);
316 }
319 /********************
320 Delete MULTIPLE entries requested, display confirm dialog
321 ********************/
323 if ($s_action=="del_multiple"){
324 $ids = $this->list_get_selected_items();
326 if(count($ids)){
328 foreach($ids as $id){
329 $dn = $this->grouplist[$id]['dn'];
330 if (($user= get_lock($dn)) != ""){
331 return(gen_locked_message ($user, $dn));
332 }
333 $this->dns[$id] = $dn;
334 }
336 $dns_names = "<br><pre>";
337 foreach($this->dns as $dn){
338 add_lock ($dn, $this->ui->dn);
339 $dns_names .= $dn."\n";
340 }
341 $dns_names .="</pre>";
343 /* Lock the current entry, so nobody will edit it during deletion */
344 if (count($this->dns) == 1){
345 $smarty->assign("info", sprintf(_("You're about to delete the following entry %s"), @LDAP::fix($dns_names)));
346 } else {
347 $smarty->assign("info", sprintf(_("You're about to delete the following entries %s"), @LDAP::fix($dns_names)));
348 }
349 $smarty->assign("multiple", true);
350 return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
351 }
352 }
355 /********************
356 Delete MULTIPLE entries confirmed
357 ********************/
359 /* Confirmation for deletion has been passed. Groups should be deleted. */
360 if (isset($_POST['delete_multiple_groups_confirm'])){
362 /* Remove user by user and check acls before removeing them */
363 foreach($this->dns as $key => $dn){
365 /* Load permissions for selected 'dn' and check if
366 we're allowed to remove this 'dn' */
367 $acl = $this->ui->get_permissions($dn,"groups/group");
368 if(preg_match("/d/",$acl)){
370 /* Delete request is permitted, perform LDAP action */
371 $this->grouptab= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $dn);
372 $this->grouptab->set_acl_base($dn);
373 $this->grouptab->delete ();
374 unset ($this->grouptab);
375 $this->grouptab= NULL;
377 } else {
379 /* Normally this shouldn't be reached, send some extra
380 logs to notify the administrator */
381 msg_dialog::display(_("Permission error"), _("You have no permission to delete this entry!"), ERROR_DIALOG);
382 new log("security","groups/".get_class($this),$dn,array(),"Tried to trick deletion.");
383 }
384 /* Remove lock file after successfull deletion */
385 del_lock ($dn);
386 unset($this->dns[$key]);
387 }
388 }
391 /********************
392 Delete MULTIPLE entries Canceled
393 ********************/
395 /* Remove lock */
396 if(isset($_POST['delete_multiple_user_cancel'])){
397 foreach($this->dns as $key => $dn){
398 del_lock ($dn);
399 unset($this->dns[$key]);
400 }
401 }
404 /********************
405 Delete group
406 ********************/
408 /* Remove group was requested */
409 if ($s_action=="del"){
411 /* Get 'dn' from posted 'uid' */
412 $this->dn= $this->grouplist[trim($s_entry)]['dn'];
414 /* Load permissions for selected 'dn' and check if
415 we're allowed to remove this 'dn' */
416 $acl = $this->ui->get_permissions($this->dn,"groups/group");
417 if(preg_match("/d/",$acl)){
419 /* Check locking, save current plugin in 'back_plugin', so
420 the dialog knows where to return. */
421 if (($user= get_lock($this->dn)) != ""){
422 return(gen_locked_message ($user, $this->dn));
423 }
425 /* Lock the current entry, so nobody will edit it during deletion */
426 add_lock ($this->dn, $this->ui->dn);
427 $smarty->assign("info", sprintf(_("You're about to delete the group '%s'."), @LDAP::fix($this->dn)));
428 $smarty->assign("multiple", false);
429 return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
431 } else {
433 /* Obviously the user isn't allowed to delete. Show message and clean session. */
434 msg_dialog::display(_("Permission error"), _("You have no permission to delete this entry!"), ERROR_DIALOG);
435 }
436 }
439 /********************
440 Delete group confirmed
441 ********************/
443 /* Confirmation for deletion has been passed. Group should be deleted. */
444 if (isset($_POST['delete_group_confirm'])){
446 /* Some nice guy may send this as POST, so we've to check
447 for the permissions again. */
448 $acl = $this->ui->get_permissions($this->dn,"groups/group");
449 if(preg_match("/d/",$acl)){
451 /* Delete request is permitted, perform LDAP action */
452 $this->grouptab= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $this->dn);
453 $this->grouptab->set_acl_base($this->dn);
454 $this->grouptab->delete ();
455 unset ($this->grouptab);
456 $this->grouptab= NULL;
458 /* Group list has changed, reload it. */
459 //$this->reload ();
461 } else {
463 /* Normally this shouldn't be reached, send some extra
464 logs to notify the administrator */
465 msg_dialog::display(_("Permission error"), _("You have no permission to delete this entry!"), ERROR_DIALOG);
466 new log("security","groups/".get_class($this),$dn,array(),"Tried to trick deletion.");
467 }
469 /* Remove lock file after successfull deletion */
470 del_lock ($this->dn);
471 session::un_set('objectinfo');
472 }
475 /********************
476 Delete group canceled
477 ********************/
479 /* Delete group canceled? */
480 if (isset($_POST['delete_cancel'])){
481 del_lock ($this->dn);
482 session::un_set('objectinfo');
483 }
486 /********************
487 A dialog was canceled
488 ********************/
490 /* Cancel dialogs */
491 if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel'])){
492 if(isset($this->grouptab->dn)){
493 del_lock ($this->grouptab->dn);
494 }
495 unset ($this->grouptab);
496 $this->grouptab= NULL;
497 session::un_set('objectinfo');
498 }
501 /********************
502 If there is currently a dialog open, display it
503 ********************/
505 /* Show tab dialog if object is present */
506 if (isset($this->grouptab->config)){
507 $display= $this->grouptab->execute();
509 /* Don't show buttons if tab dialog requests this */
510 if(isset($this->grouptab->by_object)){
511 if (!$this->grouptab->by_object[$this->grouptab->current]->dialog){
512 $display.= "<p style=\"text-align:right\">\n";
513 $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
514 $display.= " \n";
515 if ($this->dn != "new"){
516 $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
517 $display.= " \n";
518 }
519 $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
520 $display.= "</p>";
521 }
522 }
523 return ($display);
524 }
527 /* Check if there is a snapshot dialog open */
528 $base = $this->DivListGroup->selectedBase;
529 if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
530 return($str);
531 }
533 /* Display dialog with group list */
534 $this->DivListGroup->parent = $this;
535 $this->DivListGroup->execute();
537 /* Add departments if subsearch is disabled */
538 if(!$this->DivListGroup->SubSearch){
539 $this->DivListGroup->AddDepartments($this->DivListGroup->selectedBase,4,1);
540 }
541 $this->reload ();
542 $this->DivListGroup->setEntries($this->grouplist);
543 return($this->DivListGroup->Draw());
544 }
547 /* Return departments, that will be included within snapshot detection */
548 function get_used_snapshot_bases()
549 {
550 return(array(get_groups_ou().$this->DivListGroup->selectedBase));
551 }
554 function list_get_selected_items()
555 {
556 $ids = array();
557 foreach($_POST as $name => $value){
558 if(preg_match("/^item_selected_[0-9]*$/",$name)){
559 $id = preg_replace("/^item_selected_/","",$name);
560 $ids[$id] = $id;
561 }
562 }
563 return($ids);
564 }
567 function reload($CreatePosixsList=false)
568 {
569 $this->grouplist = array();
570 $primaries = array();
571 $functional = array();
572 $error= $error2 = "";
573 $filter = "(objectclass=posixGroup)";
575 $base = $this->DivListGroup->selectedBase;
576 $Regex = $this->DivListGroup->Regex;
577 $UserRegex = $this->DivListGroup->UserRegex;
578 $SubSearch = $this->DivListGroup->SubSearch;
579 $ShowPrimaryGroups = $this->DivListGroup->ShowPrimaryGroups;
580 $ShowSambaGroups = $this->DivListGroup->ShowSambaGroups;
581 $ShowApplicationGroups = $this->DivListGroup->ShowApplicationGroups;
582 $ShowMailGroups = $this->DivListGroup->ShowMailGroups;
583 $ShowFunctionalGroups = $this->DivListGroup->ShowFunctionalGroups;
585 /* Prepare ldap class */
586 $ldap= $this->config->get_ldap_link();
587 $ldap->cd($base);
588 $ldap->set_size_limit(session::get('size_limit'));
591 /********************
592 Create filter depending on selected checkboxes
593 ********************/
595 /* Add application groups */
596 if ($ShowApplicationGroups){
597 $filter.= "(objectClass=gosaApplicationGroup)";
598 }
600 /* Add Mail Groups */
601 if ($ShowMailGroups){
602 $filter.= "(objectClass=gosaMailAccount)";
603 }
605 $sfilter= "";
606 if ($this->config->current['SAMBAVERSION'] == 3){
607 if (!$ShowPrimaryGroups){
608 $sfilter= "(objectClass=sambaGroupMapping)";
609 } elseif ($ShowSambaGroups){
610 $filter.= "(objectClass=sambaGroupMapping)";
611 }
612 }
614 /* Prepare filter for given Regex && UserRegex */
615 if ($filter != ""){
616 $filter= "(&(cn=$Regex)(objectClass=posixGroup)(|$filter))";
617 if ($UserRegex != ""){
618 $filter= "(&(|(memberUID=".$UserRegex.")(cn=".$UserRegex."))$filter)";
619 }
620 }
623 /********************
624 Collect some groupids to be able to skip primary & functional groups
625 ********************/
627 /* Collect primary groupIDs to show primary groups
628 if this option is enabled in gosa conf && the checkbox is checked */
629 if ($this->ShowPrimaryCheckBox){
630 $res = get_list("(&(uid=$Regex)(!(uid=*$))(objectClass=posixAccount)(gidNumber=*))",
631 "groups", $base,array("gidNumber", "cn"), GL_SUBSEARCH);
632 foreach ($res as $attrs){
633 $primaries[$attrs['gidNumber'][0]]= $attrs['cn'][0];
634 }
635 }
637 /* Collect all GroupIDs from those groups which are functional.
638 Only perfrom this search if ShowFunctionalGroups is unchecked, else leave arre empty */
639 $ff = "(&(cn=$Regex)(objectClass=posixGroup)(!(|(objectClass=gosaMailAccount)(objectClass=gosaApplicationGroup)$sfilter)))";
640 if ($SubSearch){
641 $res = get_sub_list($ff, "groups",get_groups_ou(), $base,array("gidNumber", "cn", "description"), GL_SUBSEARCH);
642 } else {
643 $res = get_sub_list($ff, "groups",get_groups_ou(), $base,array("gidNumber", "cn", "description"), GL_NONE);
644 }
645 foreach($res as $attrs){
646 if (!isset($primaries[$attrs['gidNumber'][0]])){
647 $functional[$attrs['gidNumber'][0]]= $attrs['gidNumber'][0];
648 }
649 }
651 /********************
652 Search for the prepared filter
653 ********************/
655 /* Attributes to search for */
656 $attrs = array("cn", "description", "gidNumber", "objectClass");
658 /* If subsearch is activated search for subobjects too */
659 $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
660 if(!empty($tmp)){
661 $attrs [] = "FAIrelease";
662 }
664 if ($SubSearch){
665 $res= get_sub_list($filter, "groups",get_groups_ou(), $base, $attrs, GL_SIZELIMIT| GL_SUBSEARCH);
666 } else {
667 $res= get_sub_list($filter, "groups",get_groups_ou(), get_groups_ou().$base, $attrs, GL_SIZELIMIT);
668 }
670 /* Sort values into grouplist*/
671 $tmp = $tmp2 = array();
672 foreach ($res as $value){
673 /* Skip functional groups if checkbox isn't checked */
674 if (!$ShowFunctionalGroups && isset($functional[$value['gidNumber'][0]])){
675 continue;
676 }
678 /* If gidNumber is in $primaries skip this entry */
679 if (($ShowPrimaryGroups) || (!$ShowPrimaryGroups && !isset($primaries[$value['gidNumber'][0]]))){
680 $tmp2[$value['cn'][0]] = $value;
681 $tmp [$value['cn'][0]] = $value['cn'][0];
682 }
683 }
684 natcasesort($tmp);
685 foreach($tmp as $name){
686 $this->grouplist[] = $tmp2[$name];
687 }
688 reset ($this->grouplist);
689 }
692 function copyPasteHandling_from_queue($s_action,$s_entry)
693 {
694 /* Check if Copy & Paste is disabled */
695 if(!is_object($this->CopyPasteHandler)){
696 return("");
697 }
699 /* Add a single entry to queue */
700 if($s_action == "cut" || $s_action == "copy"){
702 /* Cleanup object queue */
703 $this->CopyPasteHandler->cleanup_queue();
704 $dn = $this->grouplist[$s_entry]['dn'];
705 $this->CopyPasteHandler->add_to_queue($dn,$s_action,"grouptabs","GROUPTABS","groups");
706 }
709 /* Add entries to queue */
710 if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
712 /* Cleanup object queue */
713 $this->CopyPasteHandler->cleanup_queue();
715 /* Add new entries to CP queue */
716 foreach($this->list_get_selected_items() as $id){
717 $dn = $this->grouplist[$id]['dn'];
719 if($s_action == "copy_multiple"){
720 $this->CopyPasteHandler->add_to_queue($dn,"copy","grouptabs","GROUPTABS","groups");
721 }
722 if($s_action == "cut_multiple"){
723 $this->CopyPasteHandler->add_to_queue($dn,"cut","grouptabs","GROUPTABS","groups");
724 }
725 }
726 }
728 /* Start pasting entries */
729 if($s_action == "editPaste"){
730 $this->start_pasting_copied_objects = TRUE;
731 }
733 /* Return C&P dialog */
734 if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
736 /* Get dialog */
737 $data = $this->CopyPasteHandler->execute();
738 $this->CopyPasteHandler->SetVar("base",$this->DivListGroup->selectedBase);
740 /* Return dialog data */
741 if(!empty($data)){
742 return($data);
743 }
744 }
746 /* Automatically disable status for pasting */
747 if(!$this->CopyPasteHandler->entries_queued()){
748 $this->start_pasting_copied_objects = FALSE;
749 }
750 return("");
751 }
754 /* Save data to object */
755 function save_object()
756 {
757 $this->DivListGroup->save_object();
758 }
761 function remove_lock()
762 {
763 if (isset($this->grouptab->dn)){
764 del_lock ($this->grouptab->dn);
765 }
766 }
769 function remove_from_parent()
770 {
771 /* Optionally execute a command after we're done */
772 $this->postremove();
773 }
776 /* Save to LDAP */
777 function save()
778 {
779 /* Optionally execute a command after we're done */
780 $this->postcreate();
781 }
783 /* Unused functions */
784 function check() { }
785 function adapt_from_template($dn) { }
786 function password_change_needed() { }
787 }
788 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
789 ?>