23b264a97615d9e27426df25e57282685fcd1e26
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 msgDialog::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 = "<br><pre>";
344 foreach($this->dns as $dn){
345 add_lock ($dn, $this->ui->dn);
346 $dns_names .= $dn."\n";
347 }
348 $dns_names .="</pre>";
350 /* Lock the current entry, so nobody will edit it during deletion */
351 if (count($this->dns) == 1){
352 $smarty->assign("info", sprintf(_("You're about to delete the following entry %s"), @LDAP::fix($dns_names)));
353 } else {
354 $smarty->assign("info", sprintf(_("You're about to delete the following entries %s"), @LDAP::fix($dns_names)));
355 }
356 $smarty->assign("multiple", true);
357 return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
358 }
359 }
362 /********************
363 Delete MULTIPLE entries confirmed
364 ********************/
366 /* Confirmation for deletion has been passed. Groups should be deleted. */
367 if (isset($_POST['delete_multiple_groups_confirm'])){
369 /* Remove user by user and check acls before removeing them */
370 foreach($this->dns as $key => $dn){
372 /* Load permissions for selected 'dn' and check if
373 we're allowed to remove this 'dn' */
374 $acl = $this->ui->get_permissions($dn,"groups/group");
375 if(preg_match("/d/",$acl)){
377 /* Delete request is permitted, perform LDAP action */
378 $this->grouptab= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $dn);
379 $this->grouptab->set_acl_base($dn);
380 $this->grouptab->delete ();
381 unset ($this->grouptab);
382 $this->grouptab= NULL;
384 } else {
386 /* Normally this shouldn't be reached, send some extra
387 logs to notify the administrator */
388 msg_dialog::display(_("Permission error"), _("You have no permission to delete this entry!"), ERROR_DIALOG);
389 new log("security","groups/".get_class($this),$dn,array(),"Tried to trick deletion.");
390 }
391 /* Remove lock file after successfull deletion */
392 del_lock ($dn);
393 unset($this->dns[$key]);
394 }
395 }
398 /********************
399 Delete MULTIPLE entries Canceled
400 ********************/
402 /* Remove lock */
403 if(isset($_POST['delete_multiple_user_cancel'])){
404 foreach($this->dns as $key => $dn){
405 del_lock ($dn);
406 unset($this->dns[$key]);
407 }
408 }
411 /********************
412 Delete group
413 ********************/
415 /* Remove group was requested */
416 if ($s_action=="del"){
418 /* Get 'dn' from posted 'uid' */
419 $this->dn= $this->grouplist[trim($s_entry)]['dn'];
421 /* Load permissions for selected 'dn' and check if
422 we're allowed to remove this 'dn' */
423 $acl = $this->ui->get_permissions($this->dn,"groups/group");
424 if(preg_match("/d/",$acl)){
426 /* Check locking, save current plugin in 'back_plugin', so
427 the dialog knows where to return. */
428 if (($user= get_lock($this->dn)) != ""){
429 return(gen_locked_message ($user, $this->dn));
430 }
432 /* Lock the current entry, so nobody will edit it during deletion */
433 add_lock ($this->dn, $this->ui->dn);
434 $smarty->assign("info", sprintf(_("You're about to delete the group '%s'."), @LDAP::fix($this->dn)));
435 $smarty->assign("multiple", false);
436 return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
438 } else {
440 /* Obviously the user isn't allowed to delete. Show message and clean session. */
441 msg_dialog::display(_("Permission error"), _("You have no permission to delete this entry!"), ERROR_DIALOG);
442 }
443 }
446 /********************
447 Delete group confirmed
448 ********************/
450 /* Confirmation for deletion has been passed. Group should be deleted. */
451 if (isset($_POST['delete_group_confirm'])){
453 /* Some nice guy may send this as POST, so we've to check
454 for the permissions again. */
455 $acl = $this->ui->get_permissions($this->dn,"groups/group");
456 if(preg_match("/d/",$acl)){
458 /* Delete request is permitted, perform LDAP action */
459 $this->grouptab= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $this->dn);
460 $this->grouptab->set_acl_base($this->dn);
461 $this->grouptab->delete ();
462 unset ($this->grouptab);
463 $this->grouptab= NULL;
465 /* Group list has changed, reload it. */
466 //$this->reload ();
468 } else {
470 /* Normally this shouldn't be reached, send some extra
471 logs to notify the administrator */
472 msg_dialog::display(_("Permission error"), _("You have no permission to delete this entry!"), ERROR_DIALOG);
473 new log("security","groups/".get_class($this),$dn,array(),"Tried to trick deletion.");
474 }
476 /* Remove lock file after successfull deletion */
477 del_lock ($this->dn);
478 session::un_set('objectinfo');
479 }
482 /********************
483 Delete group canceled
484 ********************/
486 /* Delete group canceled? */
487 if (isset($_POST['delete_cancel'])){
488 del_lock ($this->dn);
489 session::un_set('objectinfo');
490 }
493 /********************
494 A dialog was canceled
495 ********************/
497 /* Cancel dialogs */
498 if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel'])){
499 if(isset($this->grouptab->dn)){
500 del_lock ($this->grouptab->dn);
501 }
502 unset ($this->grouptab);
503 $this->grouptab= NULL;
504 session::un_set('objectinfo');
505 }
508 /********************
509 If there is currently a dialog open, display it
510 ********************/
512 /* Show tab dialog if object is present */
513 if (isset($this->grouptab->config)){
514 $display= $this->grouptab->execute();
516 /* Don't show buttons if tab dialog requests this */
517 if(isset($this->grouptab->by_object)){
518 if (!$this->grouptab->by_object[$this->grouptab->current]->dialog){
519 $display.= "<p style=\"text-align:right\">\n";
520 $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
521 $display.= " \n";
522 if ($this->dn != "new"){
523 $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
524 $display.= " \n";
525 }
526 $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
527 $display.= "</p>";
528 }
529 }
530 return ($display);
531 }
534 /* Check if there is a snapshot dialog open */
535 $base = $this->DivListGroup->selectedBase;
536 if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
537 return($str);
538 }
540 /* Display dialog with group list */
541 $this->DivListGroup->parent = $this;
542 $this->DivListGroup->execute();
544 /* Add departments if subsearch is disabled */
545 if(!$this->DivListGroup->SubSearch){
546 $this->DivListGroup->AddDepartments($this->DivListGroup->selectedBase,4,1);
547 }
548 $this->reload ();
549 $this->DivListGroup->setEntries($this->grouplist);
550 return($this->DivListGroup->Draw());
551 }
554 /* Return departments, that will be included within snapshot detection */
555 function get_used_snapshot_bases()
556 {
557 return(array(get_groups_ou().$this->DivListGroup->selectedBase));
558 }
561 function list_get_selected_items()
562 {
563 $ids = array();
564 foreach($_POST as $name => $value){
565 if(preg_match("/^item_selected_[0-9]*$/",$name)){
566 $id = preg_replace("/^item_selected_/","",$name);
567 $ids[$id] = $id;
568 }
569 }
570 return($ids);
571 }
574 function reload($CreatePosixsList=false)
575 {
576 $this->grouplist = array();
577 $primaries = array();
578 $functional = array();
579 $error= $error2 = "";
580 $filter = "(objectclass=posixGroup)";
582 $base = $this->DivListGroup->selectedBase;
583 $Regex = $this->DivListGroup->Regex;
584 $UserRegex = $this->DivListGroup->UserRegex;
585 $SubSearch = $this->DivListGroup->SubSearch;
586 $ShowPrimaryGroups = $this->DivListGroup->ShowPrimaryGroups;
587 $ShowSambaGroups = $this->DivListGroup->ShowSambaGroups;
588 $ShowApplicationGroups = $this->DivListGroup->ShowApplicationGroups;
589 $ShowMailGroups = $this->DivListGroup->ShowMailGroups;
590 $ShowFunctionalGroups = $this->DivListGroup->ShowFunctionalGroups;
592 /* Prepare ldap class */
593 $ldap= $this->config->get_ldap_link();
594 $ldap->cd($base);
595 $ldap->set_size_limit(session::get('size_limit'));
598 /********************
599 Create filter depending on selected checkboxes
600 ********************/
602 /* Add application groups */
603 if ($ShowApplicationGroups){
604 $filter.= "(objectClass=gosaApplicationGroup)";
605 }
607 /* Add Mail Groups */
608 if ($ShowMailGroups){
609 $filter.= "(objectClass=gosaMailAccount)";
610 }
612 $sfilter= "";
613 if ($this->config->current['SAMBAVERSION'] == 3){
614 if (!$ShowPrimaryGroups){
615 $sfilter= "(objectClass=sambaGroupMapping)";
616 } elseif ($ShowSambaGroups){
617 $filter.= "(objectClass=sambaGroupMapping)";
618 }
619 }
621 /* Prepare filter for given Regex && UserRegex */
622 if ($filter != ""){
623 $filter= "(&(cn=$Regex)(objectClass=posixGroup)(|$filter))";
624 if ($UserRegex != ""){
625 $filter= "(&(|(memberUID=".$UserRegex.")(cn=".$UserRegex."))$filter)";
626 }
627 }
630 /********************
631 Collect some groupids to be able to skip primary & functional groups
632 ********************/
634 /* Collect primary groupIDs to show primary groups
635 if this option is enabled in gosa conf && the checkbox is checked */
636 if ($this->ShowPrimaryCheckBox){
637 $res = get_list("(&(uid=$Regex)(!(uid=*$))(objectClass=posixAccount)(gidNumber=*))",
638 "groups", $base,array("gidNumber", "cn"), GL_SUBSEARCH);
639 foreach ($res as $attrs){
640 $primaries[$attrs['gidNumber'][0]]= $attrs['cn'][0];
641 }
642 }
644 /* Collect all GroupIDs from those groups which are functional.
645 Only perfrom this search if ShowFunctionalGroups is unchecked, else leave arre empty */
646 $ff = "(&(cn=$Regex)(objectClass=posixGroup)(!(|(objectClass=gosaMailAccount)(objectClass=gosaApplicationGroup)$sfilter)))";
647 if ($SubSearch){
648 $res = get_sub_list($ff, "groups",get_groups_ou(), $base,array("gidNumber", "cn", "description"), GL_SUBSEARCH);
649 } else {
650 $res = get_sub_list($ff, "groups",get_groups_ou(), $base,array("gidNumber", "cn", "description"), GL_NONE);
651 }
652 foreach($res as $attrs){
653 if (!isset($primaries[$attrs['gidNumber'][0]])){
654 $functional[$attrs['gidNumber'][0]]= $attrs['gidNumber'][0];
655 }
656 }
658 /********************
659 Search for the prepared filter
660 ********************/
662 /* Attributes to search for */
663 $attrs = array("cn", "description", "gidNumber", "objectClass");
665 /* If subsearch is activated search for subobjects too */
666 $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
667 if(!empty($tmp)){
668 $attrs [] = "FAIrelease";
669 }
671 if ($SubSearch){
672 $res= get_sub_list($filter, "groups",get_groups_ou(), $base, $attrs, GL_SIZELIMIT| GL_SUBSEARCH);
673 } else {
674 $res= get_sub_list($filter, "groups",get_groups_ou(), get_groups_ou().$base, $attrs, GL_SIZELIMIT);
675 }
677 /* Sort values into grouplist*/
678 $tmp = $tmp2 = array();
679 foreach ($res as $value){
680 /* Skip functional groups if checkbox isn't checked */
681 if (!$ShowFunctionalGroups && isset($functional[$value['gidNumber'][0]])){
682 continue;
683 }
685 /* If gidNumber is in $primaries skip this entry */
686 if (($ShowPrimaryGroups) || (!$ShowPrimaryGroups && !isset($primaries[$value['gidNumber'][0]]))){
687 $tmp2[$value['cn'][0]] = $value;
688 $tmp [$value['cn'][0]] = $value['cn'][0];
689 }
690 }
691 natcasesort($tmp);
692 foreach($tmp as $name){
693 $this->grouplist[] = $tmp2[$name];
694 }
695 reset ($this->grouplist);
696 }
699 function copyPasteHandling_from_queue($s_action,$s_entry)
700 {
701 /* Check if Copy & Paste is disabled */
702 if(!is_object($this->CopyPasteHandler)){
703 return("");
704 }
706 /* Add a single entry to queue */
707 if($s_action == "cut" || $s_action == "copy"){
709 /* Cleanup object queue */
710 $this->CopyPasteHandler->cleanup_queue();
711 $dn = $this->grouplist[$s_entry]['dn'];
712 $this->CopyPasteHandler->add_to_queue($dn,$s_action,"grouptabs","GROUPTABS","groups");
713 }
716 /* Add entries to queue */
717 if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
719 /* Cleanup object queue */
720 $this->CopyPasteHandler->cleanup_queue();
722 /* Add new entries to CP queue */
723 foreach($this->list_get_selected_items() as $id){
724 $dn = $this->grouplist[$id]['dn'];
726 if($s_action == "copy_multiple"){
727 $this->CopyPasteHandler->add_to_queue($dn,"copy","grouptabs","GROUPTABS","groups");
728 }
729 if($s_action == "cut_multiple"){
730 $this->CopyPasteHandler->add_to_queue($dn,"cut","grouptabs","GROUPTABS","groups");
731 }
732 }
733 }
735 /* Start pasting entries */
736 if($s_action == "editPaste"){
737 $this->start_pasting_copied_objects = TRUE;
738 }
740 /* Return C&P dialog */
741 if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
743 /* Get dialog */
744 $data = $this->CopyPasteHandler->execute();
745 $this->CopyPasteHandler->SetVar("base",$this->DivListGroup->selectedBase);
747 /* Return dialog data */
748 if(!empty($data)){
749 return($data);
750 }
751 }
753 /* Automatically disable status for pasting */
754 if(!$this->CopyPasteHandler->entries_queued()){
755 $this->start_pasting_copied_objects = FALSE;
756 }
757 return("");
758 }
761 /* Save data to object */
762 function save_object()
763 {
764 $this->DivListGroup->save_object();
765 }
768 function remove_lock()
769 {
770 if (isset($this->grouptab->dn)){
771 del_lock ($this->grouptab->dn);
772 }
773 }
776 function remove_from_parent()
777 {
778 /* Optionally execute a command after we're done */
779 $this->postremove();
780 }
783 /* Save to LDAP */
784 function save()
785 {
786 /* Optionally execute a command after we're done */
787 $this->postcreate();
788 }
790 /* Unused functions */
791 function check() { }
792 function adapt_from_template($dn) { }
793 function password_change_needed() { }
794 }
795 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
796 ?>