Code

Updated headers
[gosa.git] / gosa-core / plugins / admin / groups / class_groupManagement.inc
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     }
48     
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("/^trigger_event_DaemonEvent_notify/",$_POST['menu_action'])){
152       $s_action = "notify";
153     }
155     $smarty= get_smarty();
159     /********************
160       Create notification event
161      ********************/
163     if($s_action == "notify"){
165       $ids = $this->list_get_selected_items();
166       $uids = array();
167       foreach($ids as $id){
168         $uids[] = $this->grouplist[$id]['cn'][0];
169       }
170       if(count($uids)){
171         $this->grouptab = new DaemonEvent_notify($this->config);
172         $this->grouptab->add_targets($uids);
173       }
174     }
176     /* Abort event dialog */
177     if(isset($_POST['abort_event_dialog'])){
178       $this->grouptab = FALSE;
179     }
181     /* Save event */
182     if(isset($_POST['save_event_dialog'])){
183       $o_queue = new gosaSupportDaemon();
184       $o_queue->append($this->grouptab);
185       if($o_queue->is_error()){
186         msg_dialog::display(_("Daemon"),sprintf(_("Something went wrong while talking to the daemon: %s."),
187               $o_queue->get_error()),ERROR_DIALOG);
188       }else{
189         $this->grouptab = FALSE;
190       }
191     }
193     /* Display event */
194     if($this->grouptab instanceof DaemonEvent){
195       $this->grouptab->save_object();
196       return($this->grouptab->execute());
197     }
201     /********************
202       Copy & Paste Handling  ...
203      ********************/
205     /* Display the copy & paste dialog, if it is currently open */
206     $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
207     if($ret){
208       return($ret);
209     }
212     /********************
213       Create a new group  ...
214      ********************/
216     /* New group? */
217     if ($s_action=="new"){
219       /* Check create permissions */
220       $acl = $this->ui->get_permissions($this->DivListGroup->selectedBase,"groups/group");
221       if(preg_match("/c/",$acl)){
223         /* By default we set 'dn' to 'new', all relevant plugins will
224            react on this. */
225         $this->dn= "new";
227         /* Create new grouptab object */
228         $this->grouptab= new grouptabs($this->config, $this->config->data['TABS']['GROUPTABS'], $this->dn);
230         /* Set up the group ACL's for this 'dn' */
231         $this->grouptab->set_acl_base($this->DivListGroup->selectedBase);
232       }
233     }
236     /********************
237       Save Group Tab/Object Changes
238      ********************/
240     /* Finish group edit is triggered by the tabulator dialog, so
241        the user wants to save edited data. Check and save at this
242        point. */
243     if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->grouptab->config)) ){
245       /* Check tabs, will feed message array 
246          Save, or display error message? */
247       $message= $this->grouptab->check();
248       if (count($message) == 0){
250         /* Save user data to ldap */
251         $this->grouptab->save();
253         if (!isset($_POST['edit_apply'])){
254           /* Group has been saved successfully, remove lock from LDAP. */
255           if ($this->dn != "new"){
256             del_lock ($this->dn);
257           }
259           /* There's no page reload so we have to read new groups at this point. */
260           //$this->reload ();
261           unset ($this->grouptab);
262           $this->grouptab= NULL;
263           session::un_set('objectinfo');
264         }
265       } else {
266         /* Ok. There seem to be errors regarding to the tab data,
267            show message and continue as usual. */
268         show_errors($message);
269       }
270     }
273     /********************
274       Edit multiple entries
275      ********************/
277     /* User wants to edit data? */
278     if ($s_action == "multiple_edit" && !isset($this->grouptab->config)){
280       $this->dn = array();
281       foreach($this->list_get_selected_items() as $id){
282         $this->dn[] = $this->grouplist[$id]['dn'];;
283       }
284       $tmp = new multi_plug($this->config,"grouptabs",$this->config->data['TABS']['GROUPTABS'],
285             $this->dn,$this->DivListGroup->selectedBase,"groups");
286       if ($tmp->entries_locked()){
287         return($tmp->display_lock_message());
288       }
289       $tmp->lock_entries($this->ui->dn);
290       if($tmp->multiple_available()){
291         $this->grouptab = $tmp;
292         session::set('objectinfo',$this->grouptab->get_object_info());
293       }
294     }
297     /********************
298       Edit existing group 
299      ********************/
301     /* User wants to edit data? */
302     if (($s_action=="edit") && (!isset($this->grouptab-> config))){
304       /* Get 'dn' from posted 'uid', must be unique */
305       $this->dn= $this->grouplist[trim($s_entry)]['dn'];
307       /* Check locking & lock entry if required */
308       $user = get_lock($this->dn);
309       if ($user != ""){
310         return(gen_locked_message ($user, $this->dn));
311       }
312       add_lock ($this->dn, $this->ui->dn);
314       /* Register grouptab to trigger edit dialog */
315       $this->grouptab= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $this->dn);
316       $this->grouptab->set_acl_base($this->dn);
317       session::set('objectinfo',$this->dn);
318     }
321     /********************
322       Delete MULTIPLE entries requested, display confirm dialog
323      ********************/
325     if ($s_action=="del_multiple"){
326       $ids = $this->list_get_selected_items();
328       if(count($ids)){
330         foreach($ids as $id){
331           $dn = $this->grouplist[$id]['dn'];
332           if (($user= get_lock($dn)) != ""){
333             return(gen_locked_message ($user, $dn));
334           }
335           $this->dns[$id] = $dn;
336         }
338         $dns_names = "<br><pre>";
339         foreach($this->dns as $dn){
340           add_lock ($dn, $this->ui->dn);
341           $dns_names .= $dn."\n";
342         }
343         $dns_names .="</pre>";
345         /* Lock the current entry, so nobody will edit it during deletion */
346         if (count($this->dns) == 1){
347           $smarty->assign("info",     sprintf(_("You're about to delete the following entry %s"), @LDAP::fix($dns_names)));
348         } else {
349           $smarty->assign("info",     sprintf(_("You're about to delete the following entries %s"), @LDAP::fix($dns_names)));
350         }
351         $smarty->assign("multiple", true);
352         return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
353       }
354     }
357     /********************
358       Delete MULTIPLE entries confirmed
359      ********************/
361       /* Confirmation for deletion has been passed. Groups should be deleted. */
362       if (isset($_POST['delete_multiple_groups_confirm'])){
364         /* Remove user by user and check acls before removeing them */
365         foreach($this->dns as $key => $dn){
367           /* Load permissions for selected 'dn' and check if
368              we're allowed to remove this 'dn' */
369           $acl = $this->ui->get_permissions($dn,"groups/group");
370           if(preg_match("/d/",$acl)){
372             /* Delete request is permitted, perform LDAP action */
373             $this->grouptab= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $dn);
374             $this->grouptab->set_acl_base($dn);
375             $this->grouptab->delete ();
376             unset ($this->grouptab);
377             $this->grouptab= NULL;
379           } else {
381             /* Normally this shouldn't be reached, send some extra
382                logs to notify the administrator */
383             msg_dialog::display(_("Permission error"), _("You have no permission to delete this entry!"), ERROR_DIALOG);
384             new log("security","groups/".get_class($this),$dn,array(),"Tried to trick deletion.");
385           }
386           /* Remove lock file after successfull deletion */
387           del_lock ($dn);
388           unset($this->dns[$key]);
389         }
390       }
393       /********************
394         Delete MULTIPLE entries Canceled
395        ********************/
397       /* Remove lock */
398     if(isset($_POST['delete_multiple_user_cancel'])){
399       foreach($this->dns as $key => $dn){
400         del_lock ($dn);
401         unset($this->dns[$key]);
402       }
403     }
406     /********************
407       Delete group 
408      ********************/
410     /* Remove group was requested */
411     if ($s_action=="del"){
413       /* Get 'dn' from posted 'uid' */
414       $this->dn= $this->grouplist[trim($s_entry)]['dn'];
416       /* Load permissions for selected 'dn' and check if
417          we're allowed to remove this 'dn' */
418       $acl = $this->ui->get_permissions($this->dn,"groups/group");
419       if(preg_match("/d/",$acl)){
421         /* Check locking, save current plugin in 'back_plugin', so
422            the dialog knows where to return. */
423         if (($user= get_lock($this->dn)) != ""){
424           return(gen_locked_message ($user, $this->dn));
425         }
427         /* Lock the current entry, so nobody will edit it during deletion */
428         add_lock ($this->dn, $this->ui->dn);
429         $smarty->assign("info", sprintf(_("You're about to delete the group '%s'."), @LDAP::fix($this->dn)));
430         $smarty->assign("multiple", false);
431         return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
433       } else {
434         
435         /* Obviously the user isn't allowed to delete. Show message and clean session. */
436         msg_dialog::display(_("Permission error"), _("You have no permission to delete this entry!"), ERROR_DIALOG);
437       }
438     }
441     /********************
442       Delete group confirmed  
443      ********************/
445     /* Confirmation for deletion has been passed. Group should be deleted. */
446     if (isset($_POST['delete_group_confirm'])){
448       /* Some nice guy may send this as POST, so we've to check
449          for the permissions again. */
450       $acl = $this->ui->get_permissions($this->dn,"groups/group");
451       if(preg_match("/d/",$acl)){
453         /* Delete request is permitted, perform LDAP action */
454         $this->grouptab= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $this->dn);
455         $this->grouptab->set_acl_base($this->dn);
456         $this->grouptab->delete ();
457         unset ($this->grouptab);
458         $this->grouptab= NULL;
460         /* Group list has changed, reload it. */
461         //$this->reload ();
463       } else {
465         /* Normally this shouldn't be reached, send some extra
466            logs to notify the administrator */
467         msg_dialog::display(_("Permission error"), _("You have no permission to delete this entry!"), ERROR_DIALOG);
468         new log("security","groups/".get_class($this),$dn,array(),"Tried to trick deletion.");
469       }
471       /* Remove lock file after successfull deletion */
472       del_lock ($this->dn);
473       session::un_set('objectinfo');
474     }
477     /********************
478       Delete group canceled  
479      ********************/
481     /* Delete group canceled? */
482     if (isset($_POST['delete_cancel'])){
483       del_lock ($this->dn);
484       session::un_set('objectinfo');
485     }
486     
488     /********************
489       A dialog was canceled  
490      ********************/
492     /* Cancel dialogs */
493     if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel'])){
494       if(isset($this->grouptab->dn)){
495         del_lock ($this->grouptab->dn);
496       }
497       unset ($this->grouptab);
498       $this->grouptab= NULL;
499       session::un_set('objectinfo');
500     }
503     /********************
504       If there is currently a dialog open, display it
505      ********************/
507     /* Show tab dialog if object is present */
508     if (isset($this->grouptab->config)){
509       $display= $this->grouptab->execute();
511       /* Don't show buttons if tab dialog requests this */
512       if(isset($this->grouptab->by_object)){
513         if (!$this->grouptab->by_object[$this->grouptab->current]->dialog){
514           $display.= "<p style=\"text-align:right\">\n";
515           $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
516           $display.= "&nbsp;\n";
517           if ($this->dn != "new"){
518             $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
519             $display.= "&nbsp;\n";
520           }
521           $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
522           $display.= "</p>";
523         }
524       }
525       return ($display);
526     }
529     /* Check if there is a snapshot dialog open */
530     $base = $this->DivListGroup->selectedBase;
531     if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
532       return($str);
533     }
534    
535     /* Display dialog with group list */
536     $this->DivListGroup->parent = $this;
537     $this->DivListGroup->execute();
539     /* Add departments if subsearch is disabled */
540     if(!$this->DivListGroup->SubSearch){
541       $this->DivListGroup->AddDepartments($this->DivListGroup->selectedBase,4,1);
542     }
543     $this->reload ();
544     $this->DivListGroup->setEntries($this->grouplist);
545     return($this->DivListGroup->Draw());
546   }
549   /* Return departments, that will be included within snapshot detection */
550   function get_used_snapshot_bases()
551   {
552     return(array(get_groups_ou().$this->DivListGroup->selectedBase));
553   }
556   function list_get_selected_items()
557   {
558     $ids = array();
559     foreach($_POST as $name => $value){
560       if(preg_match("/^item_selected_[0-9]*$/",$name)){
561         $id   = preg_replace("/^item_selected_/","",$name);
562         $ids[$id] = $id;
563       }
564     }
565     return($ids);
566   }
569   function reload($CreatePosixsList=false)
570   {
571     $this->grouplist        = array();
572     $primaries              = array();
573     $functional             = array();
574     $error= $error2         = "";
575     $filter                 = "(objectclass=posixGroup)";
577     $base                   = $this->DivListGroup->selectedBase;
578     $Regex                  = $this->DivListGroup->Regex;
579     $UserRegex              = $this->DivListGroup->UserRegex;
580     $SubSearch              = $this->DivListGroup->SubSearch;
581     $ShowPrimaryGroups      = $this->DivListGroup->ShowPrimaryGroups;
582     $ShowSambaGroups        = $this->DivListGroup->ShowSambaGroups;
583     $ShowApplicationGroups  = $this->DivListGroup->ShowApplicationGroups;
584     $ShowMailGroups         = $this->DivListGroup->ShowMailGroups;
585     $ShowFunctionalGroups   = $this->DivListGroup->ShowFunctionalGroups;
587     /* Prepare ldap class */
588     $ldap= $this->config->get_ldap_link();
589     $ldap->cd($base);
590     $ldap->set_size_limit(session::get('size_limit'));
593     /********************
594       Create filter depending on selected checkboxes 
595      ********************/
597     /* Add application groups */
598     if ($ShowApplicationGroups){
599       $filter.= "(objectClass=gosaApplicationGroup)";
600     }
601     
602     /* Add Mail Groups */
603     if ($ShowMailGroups){
604       $filter.= "(objectClass=gosaMailAccount)";
605     }
607     $sfilter= "";
608     if ($this->config->current['SAMBAVERSION'] == 3){
609       if (!$ShowPrimaryGroups){
610         $sfilter= "(objectClass=sambaGroupMapping)";
611       } elseif ($ShowSambaGroups){
612         $filter.= "(objectClass=sambaGroupMapping)";
613       }
614     }
616     /* Prepare filter for given Regex && UserRegex */
617     if ($filter != ""){
618       $filter= "(&(cn=$Regex)(objectClass=posixGroup)(|$filter))";
619       if ($UserRegex != ""){
620         $filter= "(&(|(memberUID=".$UserRegex.")(cn=".$UserRegex."))$filter)";
621       }
622     }
625     /********************
626       Collect some groupids to be able to skip primary & functional groups 
627      ********************/
629     /* Collect primary groupIDs to show primary groups 
630        if this option is enabled in gosa conf && the checkbox is checked */  
631     if ($this->ShowPrimaryCheckBox){
632       $res = get_list("(&(uid=$Regex)(!(uid=*$))(objectClass=posixAccount)(gidNumber=*))",
633             "groups", $base,array("gidNumber", "cn"),  GL_SUBSEARCH);
634       foreach ($res as $attrs){
635         $primaries[$attrs['gidNumber'][0]]= $attrs['cn'][0];
636       }
637     }
639     /* Collect all GroupIDs from those groups which are functional.
640        Only perfrom this search if  ShowFunctionalGroups  is unchecked, else leave arre empty  */ 
641     $ff = "(&(cn=$Regex)(objectClass=posixGroup)(!(|(objectClass=gosaMailAccount)(objectClass=gosaApplicationGroup)$sfilter)))";
642     if ($SubSearch){
643       $res = get_sub_list($ff, "groups",get_groups_ou(), $base,array("gidNumber", "cn", "description"), GL_SUBSEARCH);
644     } else {
645       $res = get_sub_list($ff, "groups",get_groups_ou(), $base,array("gidNumber", "cn", "description"), GL_NONE);
646     }
647     foreach($res as $attrs){
648       if (!isset($primaries[$attrs['gidNumber'][0]])){
649         $functional[$attrs['gidNumber'][0]]= $attrs['gidNumber'][0];
650       }
651     }
652  
653     /********************
654       Search for the prepared filter 
655      ********************/
656    
657     /* Attributes to search for */    
658     $attrs = array("cn", "description", "gidNumber", "objectClass");
659  
660     /* If subsearch is activated search for subobjects too */
661     $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
662     if(!empty($tmp)){
663       $attrs [] = "FAIrelease";
664     }
666     if ($SubSearch){
667       $res= get_sub_list($filter, "groups",get_groups_ou(), $base, $attrs, GL_SIZELIMIT| GL_SUBSEARCH);
668     } else {
669       $res= get_sub_list($filter, "groups",get_groups_ou(), get_groups_ou().$base, $attrs, GL_SIZELIMIT);
670     }
672     /* Sort values into grouplist*/
673     $tmp = $tmp2 = array();
674     foreach ($res as $value){
675       /* Skip functional groups if checkbox isn't checked */
676       if (!$ShowFunctionalGroups && isset($functional[$value['gidNumber'][0]])){
677         continue;
678       }
679       
680       /* If gidNumber is in $primaries skip this entry */
681       if (($ShowPrimaryGroups)   ||   (!$ShowPrimaryGroups && !isset($primaries[$value['gidNumber'][0]]))){
682         $tmp2[$value['cn'][0]] = $value;
683         $tmp [$value['cn'][0]] = $value['cn'][0];
684       }
685     }
686     natcasesort($tmp);
687     foreach($tmp as $name){
688       $this->grouplist[] = $tmp2[$name]; 
689     }
690     reset ($this->grouplist);
691   }
694   function copyPasteHandling_from_queue($s_action,$s_entry)
695   {
696     /* Check if Copy & Paste is disabled */
697     if(!is_object($this->CopyPasteHandler)){
698       return("");
699     }
701     /* Add a single entry to queue */
702     if($s_action == "cut" || $s_action == "copy"){
704       /* Cleanup object queue */
705       $this->CopyPasteHandler->cleanup_queue();
706       $dn = $this->grouplist[$s_entry]['dn'];
707       $this->CopyPasteHandler->add_to_queue($dn,$s_action,"grouptabs","GROUPTABS","groups");
708     }
711     /* Add entries to queue */
712     if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
714       /* Cleanup object queue */
715       $this->CopyPasteHandler->cleanup_queue();
717       /* Add new entries to CP queue */
718       foreach($this->list_get_selected_items() as $id){
719         $dn = $this->grouplist[$id]['dn'];
721         if($s_action == "copy_multiple"){
722           $this->CopyPasteHandler->add_to_queue($dn,"copy","grouptabs","GROUPTABS","groups");
723         }
724         if($s_action == "cut_multiple"){
725           $this->CopyPasteHandler->add_to_queue($dn,"cut","grouptabs","GROUPTABS","groups");
726         }
727       }
728     }
730     /* Start pasting entries */
731     if($s_action == "editPaste"){
732       $this->start_pasting_copied_objects = TRUE;
733     }
735     /* Return C&P dialog */
736     if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
738       /* Get dialog */
739       $data = $this->CopyPasteHandler->execute();
740       $this->CopyPasteHandler->SetVar("base",$this->DivListGroup->selectedBase);
742       /* Return dialog data */
743       if(!empty($data)){
744         return($data);
745       }
746     }
748     /* Automatically disable status for pasting */
749     if(!$this->CopyPasteHandler->entries_queued()){
750       $this->start_pasting_copied_objects = FALSE;
751     }
752     return("");
753   }
756   /* Save data to object */
757   function save_object()
758   {
759     $this->DivListGroup->save_object();
760   }
763   function remove_lock()
764   {
765     if (isset($this->grouptab->dn)){
766       del_lock ($this->grouptab->dn);
767     }
768   }
771   function remove_from_parent()
772   {
773     /* Optionally execute a command after we're done */
774     $this->postremove();
775   }
778   /* Save to LDAP */
779   function save()
780   {
781     /* Optionally execute a command after we're done */
782     $this->postcreate();
783   }
785   /* Unused functions  */
786   function check()  { }
787   function adapt_from_template($dn) { }
788   function password_change_needed()  { }
790 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
791 ?>