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(_("Infrastructure error"), msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
192 }else{
193 $this->grouptab = FALSE;
194 }
195 }
197 /* Display event */
198 if($this->grouptab instanceof DaemonEvent){
199 $this->grouptab->save_object();
200 return($this->grouptab->execute());
201 }
205 /********************
206 Copy & Paste Handling ...
207 ********************/
209 /* Display the copy & paste dialog, if it is currently open */
210 $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
211 if($ret){
212 return($ret);
213 }
216 /********************
217 Create a new group ...
218 ********************/
220 /* New group? */
221 if ($s_action=="new"){
223 /* Check create permissions */
224 $acl = $this->ui->get_permissions($this->DivListGroup->selectedBase,"groups/group");
225 if(preg_match("/c/",$acl)){
227 /* By default we set 'dn' to 'new', all relevant plugins will
228 react on this. */
229 $this->dn= "new";
231 /* Create new grouptab object */
232 $this->grouptab= new grouptabs($this->config, $this->config->data['TABS']['GROUPTABS'], $this->dn);
234 /* Set up the group ACL's for this 'dn' */
235 $this->grouptab->set_acl_base($this->DivListGroup->selectedBase);
236 }
237 }
240 /********************
241 Save Group Tab/Object Changes
242 ********************/
244 /* Finish group edit is triggered by the tabulator dialog, so
245 the user wants to save edited data. Check and save at this
246 point. */
247 if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->grouptab->config)) ){
249 /* Check tabs, will feed message array
250 Save, or display error message? */
251 $message= $this->grouptab->check();
252 if (count($message) == 0){
254 /* Save user data to ldap */
255 $this->grouptab->save();
257 if (!isset($_POST['edit_apply'])){
258 /* Group has been saved successfully, remove lock from LDAP. */
259 if ($this->dn != "new"){
260 del_lock ($this->dn);
261 }
263 /* There's no page reload so we have to read new groups at this point. */
264 //$this->reload ();
265 unset ($this->grouptab);
266 $this->grouptab= NULL;
267 session::un_set('objectinfo');
268 }
269 } else {
270 /* Ok. There seem to be errors regarding to the tab data,
271 show message and continue as usual. */
272 msg_dialog::displayChecks($message);
273 }
274 }
277 /********************
278 Edit multiple entries
279 ********************/
281 /* User wants to edit data? */
282 if ($s_action == "multiple_edit" && !isset($this->grouptab->config)){
284 $this->dn = array();
285 foreach($this->list_get_selected_items() as $id){
286 $this->dn[] = $this->grouplist[$id]['dn'];;
287 }
288 $tmp = new multi_plug($this->config,"grouptabs",$this->config->data['TABS']['GROUPTABS'],
289 $this->dn,$this->DivListGroup->selectedBase,"groups");
290 if ($tmp->entries_locked()){
291 return($tmp->display_lock_message());
292 }
293 $tmp->lock_entries($this->ui->dn);
294 if($tmp->multiple_available()){
295 $this->grouptab = $tmp;
296 session::set('objectinfo',$this->grouptab->get_object_info());
297 }
298 }
301 /********************
302 Edit existing group
303 ********************/
305 /* User wants to edit data? */
306 if (($s_action=="edit") && (!isset($this->grouptab-> config))){
308 /* Get 'dn' from posted 'uid', must be unique */
309 $this->dn= $this->grouplist[trim($s_entry)]['dn'];
311 /* Check locking & lock entry if required */
312 $user = get_lock($this->dn);
313 if ($user != ""){
314 return(gen_locked_message ($user, $this->dn));
315 }
316 add_lock ($this->dn, $this->ui->dn);
318 /* Register grouptab to trigger edit dialog */
319 $this->grouptab= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $this->dn);
320 $this->grouptab->set_acl_base($this->dn);
321 session::set('objectinfo',$this->dn);
322 }
325 /********************
326 Delete MULTIPLE entries requested, display confirm dialog
327 ********************/
329 if ($s_action=="del_multiple"){
330 $ids = $this->list_get_selected_items();
332 if(count($ids)){
334 foreach($ids as $id){
335 $dn = $this->grouplist[$id]['dn'];
336 if (($user= get_lock($dn)) != ""){
337 return(gen_locked_message ($user, $dn));
338 }
339 $this->dns[$id] = $dn;
340 }
342 $dns_names = array();
343 foreach($this->dns as $dn){
344 add_lock ($dn, $this->ui->dn);
345 $dns_names[] =@LDAP::fix($dn);
346 }
348 /* Lock the current entry, so nobody will edit it during deletion */
349 $smarty->assign("info", msgPool::deleteInfo($dns_names,_("group")));
350 $smarty->assign("multiple", true);
351 return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
352 }
353 }
356 /********************
357 Delete MULTIPLE entries confirmed
358 ********************/
360 /* Confirmation for deletion has been passed. Groups should be deleted. */
361 if (isset($_POST['delete_multiple_groups_confirm'])){
363 /* Remove user by user and check acls before removeing them */
364 foreach($this->dns as $key => $dn){
366 /* Load permissions for selected 'dn' and check if
367 we're allowed to remove this 'dn' */
368 $acl = $this->ui->get_permissions($dn,"groups/group");
369 if(preg_match("/d/",$acl)){
371 /* Delete request is permitted, perform LDAP action */
372 $this->grouptab= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $dn);
373 $this->grouptab->set_acl_base($dn);
374 $this->grouptab->delete ();
375 unset ($this->grouptab);
376 $this->grouptab= NULL;
378 } else {
380 /* Normally this shouldn't be reached, send some extra
381 logs to notify the administrator */
382 msg_dialog::display(_("Permission error"), msgPool::permDelete(), ERROR_DIALOG);
383 new log("security","groups/".get_class($this),$dn,array(),"Tried to trick deletion.");
384 }
385 /* Remove lock file after successfull deletion */
386 del_lock ($dn);
387 unset($this->dns[$key]);
388 }
389 }
392 /********************
393 Delete MULTIPLE entries Canceled
394 ********************/
396 /* Remove lock */
397 if(isset($_POST['delete_multiple_user_cancel'])){
398 foreach($this->dns as $key => $dn){
399 del_lock ($dn);
400 unset($this->dns[$key]);
401 }
402 }
405 /********************
406 Delete group
407 ********************/
409 /* Remove group was requested */
410 if ($s_action=="del"){
412 /* Get 'dn' from posted 'uid' */
413 $this->dn= $this->grouplist[trim($s_entry)]['dn'];
415 /* Load permissions for selected 'dn' and check if
416 we're allowed to remove this 'dn' */
417 $acl = $this->ui->get_permissions($this->dn,"groups/group");
418 if(preg_match("/d/",$acl)){
420 /* Check locking, save current plugin in 'back_plugin', so
421 the dialog knows where to return. */
422 if (($user= get_lock($this->dn)) != ""){
423 return(gen_locked_message ($user, $this->dn));
424 }
426 /* Lock the current entry, so nobody will edit it during deletion */
427 add_lock ($this->dn, $this->ui->dn);
428 $smarty->assign("info", msgPool::deleteInfo(@LDAP::fix($this->dn),_("group")));
429 $smarty->assign("multiple", false);
430 return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
432 } else {
434 /* Obviously the user isn't allowed to delete. Show message and clean session. */
435 msg_dialog::display(_("Permission error"), msgPool::permDelete());
436 }
437 }
440 /********************
441 Delete group confirmed
442 ********************/
444 /* Confirmation for deletion has been passed. Group should be deleted. */
445 if (isset($_POST['delete_group_confirm'])){
447 /* Some nice guy may send this as POST, so we've to check
448 for the permissions again. */
449 $acl = $this->ui->get_permissions($this->dn,"groups/group");
450 if(preg_match("/d/",$acl)){
452 /* Delete request is permitted, perform LDAP action */
453 $this->grouptab= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $this->dn);
454 $this->grouptab->set_acl_base($this->dn);
455 $this->grouptab->delete ();
456 unset ($this->grouptab);
457 $this->grouptab= NULL;
459 /* Group list has changed, reload it. */
460 //$this->reload ();
462 } else {
464 /* Normally this shouldn't be reached, send some extra
465 logs to notify the administrator */
466 msg_dialog::display(_("Permission error"), msgPool::permDelete(), ERROR_DIALOG);
467 new log("security","groups/".get_class($this),$dn,array(),"Tried to trick deletion.");
468 }
470 /* Remove lock file after successfull deletion */
471 del_lock ($this->dn);
472 session::un_set('objectinfo');
473 }
476 /********************
477 Delete group canceled
478 ********************/
480 /* Delete group canceled? */
481 if (isset($_POST['delete_cancel'])){
482 del_lock ($this->dn);
483 session::un_set('objectinfo');
484 }
487 /********************
488 A dialog was canceled
489 ********************/
491 /* Cancel dialogs */
492 if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel'])){
493 if(isset($this->grouptab->dn)){
494 del_lock ($this->grouptab->dn);
495 }
496 unset ($this->grouptab);
497 $this->grouptab= NULL;
498 session::un_set('objectinfo');
499 }
502 /********************
503 If there is currently a dialog open, display it
504 ********************/
506 /* Show tab dialog if object is present */
507 if (isset($this->grouptab->config)){
508 $display= $this->grouptab->execute();
510 /* Don't show buttons if tab dialog requests this */
511 if(isset($this->grouptab->by_object)){
512 if (!$this->grouptab->by_object[$this->grouptab->current]->dialog){
513 $display.= "<p style=\"text-align:right\">\n";
514 $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\"".msgPool::okButton()."\">\n";
515 $display.= " \n";
516 if ($this->dn != "new"){
517 $display.= "<input type=submit name=\"edit_apply\" value=\"".msgPool::applyButton()."\">\n";
518 $display.= " \n";
519 }
520 $display.= "<input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">\n";
521 $display.= "</p>";
522 }
523 }
524 return ($display);
525 }
528 /* Check if there is a snapshot dialog open */
529 $base = $this->DivListGroup->selectedBase;
530 if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
531 return($str);
532 }
534 /* Display dialog with group list */
535 $this->DivListGroup->parent = $this;
536 $this->DivListGroup->execute();
538 /* Add departments if subsearch is disabled */
539 if(!$this->DivListGroup->SubSearch){
540 $this->DivListGroup->AddDepartments($this->DivListGroup->selectedBase,4,1);
541 }
542 $this->reload ();
543 $this->DivListGroup->setEntries($this->grouplist);
544 return($this->DivListGroup->Draw());
545 }
548 /* Return departments, that will be included within snapshot detection */
549 function get_used_snapshot_bases()
550 {
551 return(array(get_groups_ou().$this->DivListGroup->selectedBase));
552 }
555 function list_get_selected_items()
556 {
557 $ids = array();
558 foreach($_POST as $name => $value){
559 if(preg_match("/^item_selected_[0-9]*$/",$name)){
560 $id = preg_replace("/^item_selected_/","",$name);
561 $ids[$id] = $id;
562 }
563 }
564 return($ids);
565 }
568 function reload($CreatePosixsList=false)
569 {
570 $this->grouplist = array();
571 $primaries = array();
572 $functional = array();
573 $error= $error2 = "";
574 $filter = "(objectclass=posixGroup)";
576 $base = $this->DivListGroup->selectedBase;
577 $Regex = $this->DivListGroup->Regex;
578 $UserRegex = $this->DivListGroup->UserRegex;
579 $SubSearch = $this->DivListGroup->SubSearch;
580 $ShowPrimaryGroups = $this->DivListGroup->ShowPrimaryGroups;
581 $ShowSambaGroups = $this->DivListGroup->ShowSambaGroups;
582 $ShowApplicationGroups = $this->DivListGroup->ShowApplicationGroups;
583 $ShowMailGroups = $this->DivListGroup->ShowMailGroups;
584 $ShowFunctionalGroups = $this->DivListGroup->ShowFunctionalGroups;
586 /* Prepare ldap class */
587 $ldap= $this->config->get_ldap_link();
588 $ldap->cd($base);
589 $ldap->set_size_limit(session::get('size_limit'));
592 /********************
593 Create filter depending on selected checkboxes
594 ********************/
596 /* Add application groups */
597 if ($ShowApplicationGroups){
598 $filter.= "(objectClass=gosaApplicationGroup)";
599 }
601 /* Add Mail Groups */
602 if ($ShowMailGroups){
603 $filter.= "(objectClass=gosaMailAccount)";
604 }
606 $sfilter= "";
607 if ($this->config->current['SAMBAVERSION'] == 3){
608 if (!$ShowPrimaryGroups){
609 $sfilter= "(objectClass=sambaGroupMapping)";
610 } elseif ($ShowSambaGroups){
611 $filter.= "(objectClass=sambaGroupMapping)";
612 }
613 }
615 /* Prepare filter for given Regex && UserRegex */
616 if ($filter != ""){
617 $filter= "(&(cn=$Regex)(objectClass=posixGroup)(|$filter))";
618 if ($UserRegex != ""){
619 $filter= "(&(|(memberUID=".$UserRegex.")(cn=".$UserRegex."))$filter)";
620 }
621 }
624 /********************
625 Collect some groupids to be able to skip primary & functional groups
626 ********************/
628 /* Collect primary groupIDs to show primary groups
629 if this option is enabled in gosa conf && the checkbox is checked */
630 if ($this->ShowPrimaryCheckBox){
631 $res = get_list("(&(uid=$Regex)(!(uid=*$))(objectClass=posixAccount)(gidNumber=*))",
632 "groups", $base,array("gidNumber", "cn"), GL_SUBSEARCH);
633 foreach ($res as $attrs){
634 $primaries[$attrs['gidNumber'][0]]= $attrs['cn'][0];
635 }
636 }
638 /* Collect all GroupIDs from those groups which are functional.
639 Only perfrom this search if ShowFunctionalGroups is unchecked, else leave arre empty */
640 $ff = "(&(cn=$Regex)(objectClass=posixGroup)(!(|(objectClass=gosaMailAccount)(objectClass=gosaApplicationGroup)$sfilter)))";
641 if ($SubSearch){
642 $res = get_sub_list($ff, "groups",get_groups_ou(), $base,array("gidNumber", "cn", "description"), GL_SUBSEARCH);
643 } else {
644 $res = get_sub_list($ff, "groups",get_groups_ou(), $base,array("gidNumber", "cn", "description"), GL_NONE);
645 }
646 foreach($res as $attrs){
647 if (!isset($primaries[$attrs['gidNumber'][0]])){
648 $functional[$attrs['gidNumber'][0]]= $attrs['gidNumber'][0];
649 }
650 }
652 /********************
653 Search for the prepared filter
654 ********************/
656 /* Attributes to search for */
657 $attrs = array("cn", "description", "gidNumber", "objectClass");
659 /* If subsearch is activated search for subobjects too */
660 $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
661 if(!empty($tmp)){
662 $attrs [] = "FAIrelease";
663 }
665 if ($SubSearch){
666 $res= get_sub_list($filter, "groups",get_groups_ou(), $base, $attrs, GL_SIZELIMIT| GL_SUBSEARCH);
667 } else {
668 $res= get_sub_list($filter, "groups",get_groups_ou(), get_groups_ou().$base, $attrs, GL_SIZELIMIT);
669 }
671 /* Sort values into grouplist*/
672 $tmp = $tmp2 = array();
673 foreach ($res as $value){
674 /* Skip functional groups if checkbox isn't checked */
675 if (!$ShowFunctionalGroups && isset($functional[$value['gidNumber'][0]])){
676 continue;
677 }
679 /* If gidNumber is in $primaries skip this entry */
680 if (($ShowPrimaryGroups) || (!$ShowPrimaryGroups && !isset($primaries[$value['gidNumber'][0]]))){
681 $tmp2[$value['cn'][0]] = $value;
682 $tmp [$value['cn'][0]] = $value['cn'][0];
683 }
684 }
685 natcasesort($tmp);
686 foreach($tmp as $name){
687 $this->grouplist[] = $tmp2[$name];
688 }
689 reset ($this->grouplist);
690 }
693 function copyPasteHandling_from_queue($s_action,$s_entry)
694 {
695 /* Check if Copy & Paste is disabled */
696 if(!is_object($this->CopyPasteHandler)){
697 return("");
698 }
700 /* Add a single entry to queue */
701 if($s_action == "cut" || $s_action == "copy"){
703 /* Cleanup object queue */
704 $this->CopyPasteHandler->cleanup_queue();
705 $dn = $this->grouplist[$s_entry]['dn'];
706 $this->CopyPasteHandler->add_to_queue($dn,$s_action,"grouptabs","GROUPTABS","groups");
707 }
710 /* Add entries to queue */
711 if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
713 /* Cleanup object queue */
714 $this->CopyPasteHandler->cleanup_queue();
716 /* Add new entries to CP queue */
717 foreach($this->list_get_selected_items() as $id){
718 $dn = $this->grouplist[$id]['dn'];
720 if($s_action == "copy_multiple"){
721 $this->CopyPasteHandler->add_to_queue($dn,"copy","grouptabs","GROUPTABS","groups");
722 }
723 if($s_action == "cut_multiple"){
724 $this->CopyPasteHandler->add_to_queue($dn,"cut","grouptabs","GROUPTABS","groups");
725 }
726 }
727 }
729 /* Start pasting entries */
730 if($s_action == "editPaste"){
731 $this->start_pasting_copied_objects = TRUE;
732 }
734 /* Return C&P dialog */
735 if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
737 /* Get dialog */
738 $data = $this->CopyPasteHandler->execute();
739 $this->CopyPasteHandler->SetVar("base",$this->DivListGroup->selectedBase);
741 /* Return dialog data */
742 if(!empty($data)){
743 return($data);
744 }
745 }
747 /* Automatically disable status for pasting */
748 if(!$this->CopyPasteHandler->entries_queued()){
749 $this->start_pasting_copied_objects = FALSE;
750 }
751 return("");
752 }
755 /* Save data to object */
756 function save_object()
757 {
758 $this->DivListGroup->save_object();
759 }
762 function remove_lock()
763 {
764 if (isset($this->grouptab->dn)){
765 del_lock ($this->grouptab->dn);
766 }
767 }
770 function remove_from_parent()
771 {
772 /* Optionally execute a command after we're done */
773 $this->postremove();
774 }
777 /* Save to LDAP */
778 function save()
779 {
780 /* Optionally execute a command after we're done */
781 $this->postcreate();
782 }
784 /* Unused functions */
785 function check() { }
786 function adapt_from_template($dn) { }
787 function password_change_needed() { }
788 }
789 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
790 ?>