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