Code

Added iud to post events.
[gosa.git] / plugins / personal / environment / class_environment.inc
1 <?php
3 class environment extends plugin
4 {
5   /* CLI vars */
6   var $cli_summary          = "Manage server basic objects";
7   var $cli_description      = "Some longer text\nfor help";
8   var $cli_parameters       = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
10   /* attribute list for save action */
11   var $ignore_account       = FALSE;
12   var $plHeadline           = "Environment";
13   var $plDescription        = "This does something";
14   var $dialog               = false;    // Indicates that we are currently editing in an seperate dialog
15   
16   var $in_dialog            = false;
17   var $uid                  = "";
19   var $is_group             = false;
20   
21   /* Attribute definition
22    */
24   /* profile management */
25   var $useProfile         = false;  // Specifies if we want to use a Server 
26   var $gotoProfileServer  = "";     // Specifies the selected profile server
27   var $gotoProfileServers = array();// Specifies all available and selectable servers
28   var $gotoProfileFlags   = "";     // Flags enabled  ? only used to set ACL and save 
29   var $gotoProfileFlagC  = "";     // Flag is set to C if we have the profile caching fucntion enabled 
30   
31   var $gotoXResolution    = "auto";     // The selected resolution eg: 1024x768
32   var $gotoXResolutions   = array();// Contains all available resolutions for this account
33   var $gotoProfileFlagL  = "";     // Flag is set to L to enable runtime resolution change 
34   var $gotoProfileQuota   = "";     // User Quota Settings
36   /* Logon script section*/
37   var $gotoLogonScripts   = array();// Contains all available Logon Scripts  
38   var $gotoLogonScript    = "";     // The selected Logon Script
40   /* Printer */
41   var $gotoPrinter        = array();// All available Printer, with their configurations
42   var $gotoPrinterSel     = "";     //  The selected Printer
43   var $gosaDefaultPrinter = "";     // Default printer
45   /* Share */
46   var $gotoShares         = array();// Current Share Options
47   var $gotoShare          = "";     // currently selected Share Option
48   var $gotoShareSelections= array();// Available Shares for this account in Listbox format
49   var $gotoAvailableShares= array();// Available Shares for this account
51   /* Kiosk profile */
52   var $gotoKioskProfile   = "none";     // The selected Kiosk Profile
53   var $gotoKioskProfiles  = array();// All available Kiosk profiles
54   var $newKioskProfiles   = array();
56   /* Hotplug Devices */
57   var $gotoHotplugDevice  = array();     // Selected hotplug
58   var $gotoHotplugDevices = array();// Already configured hotplug devices 
60   var $NewAddedPrinters   = array();
61   var $NewDeletedPrinters = array();
63   /* general settings */
64   // Sets the attributes which will kept on page reload, which will be saved, ...
66   var $CopyPasteVars      = array("gotoHotplugDevices","newKioskProfiles","gotoAvailableShares","gotoShareSelections","gotoPrinterSel","gotoProfileFlagL","gotoXResolutions","gotoProfileFlagC","gotoProfileServers","useProfile","is_group","in_dialog","OrigCn");
68   var $attributes         = array("uid","gotoProfileServer","gotoProfileFlags",
69       "gotoXResolution","gotoProfileQuota",
70       "gotoLogonScripts","gotoLogonScript",
71       "gotoPrinter", "gosaDefaultPrinter",
72       "gotoShares","gotoShare",
73       "gotoKioskProfile","gotoKioskProfiles"
74       );
75   var $objectclasses      = array("gotoEnvironment"); // Specifies the objectClass which contains the attributes edited here 
76   var $cn;
77   var $OrigCn;
78   var $add_del_printer_member_was_called = false;
80   function environment ($config, $dn= NULL)
81   {
82     plugin::plugin ($config, $dn);
84     /* Setting uid to default */
85     if(isset($this->attrs['uid'][0])){
86       $this->uid = $this->attrs['uid'][0];
87     }
89     /* Check : Are we currently editing a group or user dialog */
90     if((isset($this->attrs['cn'][0]))&&(!isset($this->attrs['uid'][0]))){
91       $suffix="Group";
92       $this->uid          = $this->attrs['cn'][0];
93       $this->attrs['uid'] = $this->attrs['cn'][0];
94       $this->OrigCn = $this->attrs['cn'][0];
95     }else{
96       $suffix="User";
97     }
99     $this->gotoKioskProfile= preg_replace("/^.*\//i","",$this->gotoKioskProfile);
101     /* Get all Printer assignments */
102     $ldap = $this->config->get_ldap_link();
103     $ldap->cd($this->config->current['BASE']);
104     $ldap->search("(&(objectClass=gotoPrinter)(goto".$suffix."Printer=".$this->uid."))",array("*"));
105     while($printer = $ldap->fetch()){
106       $this->gotoPrinter[$printer['cn'][0]]=$printer;
107       $this->gotoPrinter[$printer['cn'][0]]['mode']="user";
108     }
109     $ldap->search("(&(objectClass=gotoPrinter)(goto".$suffix."AdminPrinter=".$this->uid."))",array("*"));
110     while($printer = $ldap->fetch()){
111       $this->gotoPrinter[$printer['cn'][0]]=$printer;
112       $this->gotoPrinter[$printer['cn'][0]]['mode']="admin";
113     }
115     /* prepare hotplugs */
116     if((isset($this->attrs['gotoHotplugDevice']))&&(is_array($this->attrs['gotoHotplugDevice']))){
117       unset($this->attrs['gotoHotplugDevice']['count']);
118       foreach($this->attrs['gotoHotplugDevice'] as $device){
119         $tmp = $tmp2 = array();
120         $tmp = split("\|",$device);
121         $tmp2['name']        = $tmp[0]; 
122         $tmp2['description'] = $tmp[1]; 
123         $tmp2['id']          = $tmp[2]; 
125         /* Produkt ID */
126         if(!isset($tmp[3])){
127           $tmp[3] = "";
128         }
129         /* Vendor ID */
130         if(!isset($tmp[4])){
131           $tmp[4] = "";
132         }
134         $tmp2['produkt']     = $tmp[3]; 
135         $tmp2['vendor']      = $tmp[4];
137         $this->gotoHotplugDevices[$tmp[0]]=$tmp2;
138       }
139     }
141     /* prepare LogonScripts */
142     if((isset($this->attrs['gotoLogonScript']))&&(is_array($this->attrs['gotoLogonScript']))){
143       unset($this->attrs['gotoLogonScript']['count']);
144       foreach($this->attrs['gotoLogonScript'] as $device){
145         $tmp = $tmp2 = array();
146         $tmp = split("\|",$device);
147         $tmp2['LogonName']        = $tmp[0]; 
148         $tmp2['LogonPriority']    = $tmp[2]; 
149         if(preg_match("/O/i",$tmp[1])){
150           $tmp2['LogonOverload'] = "O";
151         }else{
152           $tmp2['LogonOverload'] = "";
153         }
154         if(preg_match("/L/i",$tmp[1])){
155           $tmp2['LogonLast'] = "L";
156         }else{
157           $tmp2['LogonLast'] = "";
158         }
159         $tmp2['LogonData']        = base64_decode($tmp[3]); 
160         $tmp2['LogonDescription'] = $tmp[4];
161         $this->gotoLogonScripts[$tmp[0]]=$tmp2;
162       }
163     }
165     /* Prepare Shares */
166     if((isset($this->attrs['gotoShare']))&&(is_array($this->attrs['gotoShare']))){
167       unset($this->attrs['gotoShare']['count']);
168       foreach($this->attrs['gotoShare'] as $share){
169         $tmp = $tmp2 = array();
170         $tmp = split("\|",$share);
171         $tmp2['server']      =$tmp[0];
172         $tmp2['name']        =$tmp[1];
174         /* Decode base64 if needed */
175         if (!preg_match('%/%', $tmp[2])){
176           $tmp2['mountPoint']  =base64_decode($tmp[2]);
177         } else {
178           $tmp2['mountPoint']  =$tmp[2];
179         }
181         if(isset($tmp[3])){
182           $tmp2['PwdHash']  =$tmp[3];
183         }else{
184           $tmp2['PwdHash']  ="";
185         }
186         if(isset($tmp[4])){
187           $tmp2['Username']  =$tmp[4];
188         }else{
189           $tmp2['Username']  ="";
190         }
191         $this->gotoShares[$tmp[1]."|".$tmp[0]]=$tmp2;
192       }
193     }
195     for($i = 0 ; $i < strlen($this->gotoProfileFlags) ; $i ++){
196       $chr = $this->gotoProfileFlags[$i];
197       $name = "gotoProfileFlag".$chr;
198       $this->$name=$chr;
199     }
201     if((!empty($this->gotoProfileServer))||($this->gotoProfileFlagC=="C")){
202       $this->useProfile = true;
203     }else{
204       $this->useProfile = false;
205     }
207     /* Set resolutions */
208     $this->gotoXResolutions = array("auto"=>_("auto"),
209                                     "640x480"   =>  "640x480",
210                                     "800x600"   =>  "800x600",
211                                     "1024x768"  =>  "1024x768",
212                                     "1152x864"  =>  "1152x864",
213                                     "1280x768"  =>  "1280x768",
214                                     "1280x1024" =>  "1280x1024");
216     if(isset($this->config->data['MAIN']['RESOLUTION_HOOK'])){
217       $file = $this->config->data['MAIN']['RESOLUTION_HOOK'];
219       if(is_readable($file)){
220         $str = file_get_contents($file);
221         $lines = split("\n",$str);
222         foreach($lines as $line){
223           $line = trim($line);
224           if(!empty($line)){
225             $this->gotoXResolutions[$line]=$line;
226           }
227         }
228         //natcasesort($this->gotoXResolutions);
229       }else{
230         print_red(sprintf(_("You have specified an external resolution hook which can't be read, please check the permission of the file '%s'."),$file));
231       }
232     }
234     $this->gotoProfileServers= $config->getShareServerList() ;
235     $this->gotoShareSelections= $config->getShareList(true);
236     $this->gotoAvailableShares= $config->getShareList(false);  
238   }
241   /* Detect type of edited object (user|group)*/
242   function detect_grouptype()
243   {
244     if((!isset($this->parent))&&(!$this->is_account)){
245       $this->is_group     = false;
246     }elseif((isset($this->parent))&&(!isset($this->parent->by_object['posixAccount']))){
247       $this->is_group     = true;
248     }else{
249       $this->is_group     = false;
250     }
251   }
254   function execute()
255   {
256     /* Call parent execute */
257     plugin::execute();
259     $this->detect_grouptype();
261     /* Fill templating stuff */
262     $smarty= get_smarty();
263     $display= "";
265     $smarty->assign("is_group",$this->is_group);
267     /* Are we editing from MyAccount and not editing a user */
268     $WriteOnly = (!isset($this->parent)|| !$this->parent) && !isset($_SESSION['edit']);
270     /* Prepare all variables for smarty */
271     foreach($this->attributes as $s_attr){
272       /* Set value*/
273       $smarty->assign($s_attr,$this->$s_attr);
275       /* Set checkbox state*/
276       if(empty($this->$s_attr)){
277         $smarty->assign($s_attr."CHK","");
278       }else{
279         $smarty->assign($s_attr."CHK"," checked ");
280       }
282       /* Prepare ACL settings*/
283       $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
284     }
286     /* Is accout enabled | are we editing from usermenu or admin menu 
287        All these tab management is done here
288      */
291     /* Working from Usermenu an the Account is currently disbled
292      * this->parent :  is only set if we are working in a list of tabs
293      * is_account   :  is only true if the needed objectClass is given
294      */
295     if((!isset($this->parent))&&(!$this->is_account)){
296       /* We are currently editing this tab from usermenu, but this account is not enabled */
297       $smarty->assign("is_account",$this->is_account);
298       /* Load template */
299       $display .= $smarty->fetch(get_template_path('environment.tpl', TRUE));
300       /* Avoid the "You are currently editing ...." message when you leave this tab */
301       $display .= back_to_main(); 
302       /* Display our message to the user */
303       return $display;
306       /* We are currently editing from group tabs, because 
307        * $this->parent is set
308        * posixAccount is not set, so we are not in usertabs.
309        */
310     }elseif((isset($this->parent))&&(!isset($this->parent->by_object['posixAccount']))){
311       $smarty->assign("is_account","true");
312       $this->uid          = $this->cn;
313       $this->attrs['uid'] = $this->cn;
315       /* Change state if needed */
316       if (isset($_POST['modify_state'])){
317         if(($this->acl_is_createable() && !$this->is_account) || 
318             ($this->acl_is_removeable() &&  $this->is_account)){
319           $this->is_account= !$this->is_account;
320         }
321       }
322       /* Group Dialog with enabled environment options */
323       if ($this->is_account){
324         $display= $this->show_enable_header(_("Remove environment extension"),
325             _("Environment extension enabled. You can disable it by clicking below."));
326       } else {
328         /* Environment is disabled 
329            If theres is no posixAccount enabled, you won't be able to enable 
330            environment extensions
331          */
332         if((isset($this->parent->by_object['group']))||(isset($this->attrs['objectClass']))&&((in_array("posixAccount",$this->attrs['objectClass'])))){
333           // 4. There is a PosixAccount
334           $display= $this->show_enable_header(_("Add environment extension"),
335               _("Environment extension disabled. You can enable it by clicking below."));
336           return $display;
337         }else{
338           // 4. There is no PosixAccount
339           $display= $this->show_enable_header(_("Add environment extension"),
340               _("Environment extension disabled. You have to setup a posix account before you can enable this feature."));
341           return $display;
342         }
343       }
344     }else{
345       /* Editing from Usermenu 
346        *  Tell smarty that this accoutn is enabled 
347        */
348       $smarty->assign("is_account","true");
350       /* Change state if needed */
351       if (isset($_POST['modify_state'])){
352         if(($this->acl_is_createable() && !$this->is_account) || 
353             ($this->acl_is_removeable() &&  $this->is_account)){
354           $this->is_account= !$this->is_account;
355         }
356       }
358       if(isset($this->parent)){
360         // 3. Account enabled . Editing from adminmenu
361         if ($this->is_account){
362           $display= $this->show_disable_header(_("Remove environment extension"),
363               _("Environment extension enabled. You can disable it by clicking below."));
364         } else {
366           if($this->parent->by_object['posixAccount']->is_account==true){
367             // 4. There is a PosixAccount
368             $display= $this->show_disable_header(_("Add environment extension"),
369                 _("Environment extension disabled. You can enable it by clicking below."));
370             return $display;
371           }else{
372             // 4. There is a PosixAccount
373             $display= $this->show_disable_header(_("Add environment extension"),
374                 _("Environment extension disabled. You have to setup a posix account before you can enable this feature."),TRUE,TRUE);
375             return $display;
376           }
377         }
378       }
379     }
380     /* Account is Account : is_accounbt=true.
381      * Else we won't reach this. 
382      */
384     /* Prepare all variables for smarty */
385     foreach($this->attributes as $s_attr){
386       /* Set value*/
387       $smarty->assign($s_attr,$this->$s_attr);
389       /* Set checkbox state*/
390       if(empty($this->$s_attr)){
391         $smarty->assign($s_attr."CHK","");
392       }else{
393         $smarty->assign($s_attr."CHK"," checked ");
394       }
396       /* Prepare ACL settings*/
397       $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
398     }
400     foreach(array("gotoHotplugDevice","gotoProfileFlagC","gotoProfileFlagL") as $s_attr){
401       $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
402     }
404     if($WriteOnly) {
405       $smarty->assign("gotoPrinterACL","r");
406     }else{
407       $smarty->assign("gotoPrinterACL","rw");
408     }
410     if(empty($this->useProfile)){
411       $smarty->assign("useProfileCHK","");
412       $smarty->assign("gotoProfileServerACL" , preg_replace("/w/","",$this->getacl("gotoProfileServer",$WriteOnly)));
413       $smarty->assign("gotoProfileQuotaACL" , preg_replace("/w/","",$this->getacl("gotoProfileQuota",$WriteOnly)));
414       $smarty->assign("gotoProfileFlagCACL" , preg_replace("/w/","",$this->getacl("gotoProfileFlagC",$WriteOnly)));
415     }else{
416       $smarty->assign("useProfileCHK"," checked ");
417     }
420     $smarty->assign("gotoProfileACL", $this->getacl("gotoProfileServer",$WriteOnly).$this->getacl("gotoProfileQuota",$WriteOnly));
422     /* HANDLE Profile Settings here 
423      * Assign available Quota and resolution settings
424      * Get all available profile server
425      * Get cache checkbox
426      * Assign this all to Smarty 
427      */
429     if(empty($this->gotoProfileFlagL)){
430       $smarty->assign("gotoProfileFlagLCHK"," ");
431     }else{
432       $smarty->assign("gotoProfileFlagLCHK"," checked ");
433     }
435     if(empty($this->gotoProfileFlagC)){
436       $smarty->assign("gotoProfileFlagCCHK"," ");
437     }else{
438       $smarty->assign("gotoProfileFlagCCHK"," checked ");
439     }
442     $smarty->assign("gotoXResolutions"    , $this->gotoXResolutions);
443     $smarty->assign("gotoXResolutionKeys" , array_flip($this->gotoXResolutions));
445     $smarty->assign("gotoProfileServers",$this->gotoProfileServers);
446     if(!is_array($this->gotoProfileServers)){
447       $this->gotoProfileServers =array();
448     }
449     $smarty->assign("gotoProfileServerKeys",array_flip($this->gotoProfileServers));
451     /* Handle kiosk profiles 
452      * Read available from filesystem
453      * Open management if post is transmitted
454      */
456     /* Save */
457     if(isset($_POST['KioskClose'])){
458       $this->newKioskProfiles = array_merge($this->newKioskProfiles,$this->dialog->save());
460       unset($this->dialog);
461       $this->dialog=NULL;
462       $this->is_dialog = false;
463     }
465     /* Reassign help class */
466     $_SESSION['current_class_for_help'] = get_class($this);
468     /* Open Management Dialog */
469     if(isset($_POST['KioskManagementDialog'])){
470       $this->dialog = new kioskManagementDialog($this->config,$this->dn,$this->newKioskProfiles); 
471       $this->dialog->parent= $this;
472       $this->dialog->acl = $this->acl;
473       $this->is_dialog = true;
474     }
475     $tmp = new kioskManagementDialog($this->config,$this->dn);
476     $list = $tmp->getKioskProfiles($this->newKioskProfiles);
477     $list['none']=_("None");
478     $list = array_reverse($list);
479     $smarty->assign("gotoKioskProfiles",$list);
480     $smarty->assign("gotoKioskProfileKeys",array_flip($list));
482     /* Logonscript Management
483      * Get available LogonScripts (possibly grey out (or mark) these script that are defined for the group) 
484      * Perform add Delete edit Posts 
485      */
487     /* Dialog Save */
488     if(isset($_POST['LogonSave'])){
490       if(!$this->acl_is_writeable("gotoLogonScript")){
491         print_red(_("You are not allowed to write Logon scripts."));
492         unset($this->dialog);
493         $this->dialog=NULL;
494         $this->is_dialog=false;
495       }else{
496         $this->dialog->save_object();
497         if(count($this->dialog->check())!=0){
498           foreach($this->dialog->check() as $msg){
499             print_red($msg);
500           }
501         }else{
502           $tmp = $this->dialog->save();
503           unset($this->dialog);
504           $this->dialog=NULL;
505           $this->is_dialog=false;
506           $this->gotoLogonScripts[$tmp['LogonName']]=$tmp; 
507         }
508       }
509     }
510     
512     /* Dialog Quit without saving */
513     if(isset($_POST['LogonCancel'])){
514       $this->is_dialog= false;
515       unset($this->dialog);
516       $this->dialog= NULL;
517     }
519     /* Check Edit Del New Posts for a selected LogonScript */ 
520     if($this->acl_is_writeable("gotoLogonScript") && 
521         (isset($_POST['gotoLogonScriptNew'])) || isset($_POST['gotoLogonScriptEdit']) ||isset($_POST['gotoLogonScriptDel'])){
523       /* New Logon Script: Open an edit dialog, we don't need a $_POST['gotoLogonScript'] here.
524        * In this case we create a new Logon Script.
525        */
526       if(isset($_POST['gotoLogonScriptNew'])){
527         $this->is_dialog = true;
528         $this->dialog = new logonManagementDialog($this->config,$this->dn);
529       }
531       /* If we receive a Delete request and there is a Script selected in the selectbox, delete this one.
532        * We only can delete if there is an entry selected.
533        */
534       if((isset($_POST['gotoLogonScriptDel']))&&(isset($_POST['gotoLogonScript']))){
535         unset($this->gotoLogonScripts[$_POST['gotoLogonScript']]);
536       }
538       /* In this case we want to edit an existing entry, we open a new Dialog to allow editing.
539        * There must be an entry selected to perform edit request.
540        */
541       if((isset($_POST['gotoLogonScriptEdit']))&&(isset($_POST['gotoLogonScript']))){
542         $is_entry = $this->gotoLogonScripts[$_POST['gotoLogonScript']];
543         $this->is_dialog = true;
544         $this->dialog = new logonManagementDialog($this->config,$this->dn,$is_entry);
545       }
546     }
548     /* Append List to smarty*/
549     $smarty->assign("gotoLogonScripts",   $this->printOutLogonScripts());
550     $smarty->assign("gotoLogonScriptKeys",array_flip($this->printOutLogonScripts()));
552     /* In this section server shares will be defined 
553      * A user can select one of the given shares and a mount point
554      *  and attach this combination to his setup.
555      */
557     $smarty->assign("gotoShareSelections",    $this->gotoShareSelections);
558     if(!is_array($this->gotoShareSelections)){
559       print $this->gotoShareSelections;
560       $this->gotoShareSelections = array();
561     }
562     $smarty->assign("gotoShareSelectionKeys", array_flip($this->gotoShareSelections));
564     /* if $_POST['gotoShareAdd'] is set, we will try to add a new entry 
565      * This entry will be, a combination of mountPoint and sharedefinitions 
566      */
567     if(isset($_POST['gotoShareAdd']) && $this->acl_is_writeable("gotoShare")){
568       /* We assign a share to this user, if we don't know where to mount the share */
569       if((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))||(preg_match("/[\|]/i",$_POST['gotoShareMountPoint']))){
570         print_red(_("You must specify a valid mount point."));
571       }elseif(preg_match('/ /', $_POST['gotoShareMountPoint'])){
572         print_red(_("Spaces are not allowed in the mount path!"));
573       }elseif(!(
574             preg_match("/^\//",$_POST['gotoShareMountPoint'])  ||
575             preg_match("/^~/",$_POST['gotoShareMountPoint']) ||
576             preg_match("/^\$HOME/",$_POST['gotoShareMountPoint']) ||
577             preg_match("/^.HOME/",$_POST['gotoShareMountPoint']) ||
578             preg_match("/^\$USER/",$_POST['gotoShareMountPoint']) ||
579             preg_match("/^.USER/",$_POST['gotoShareMountPoint']) ||
580             preg_match("/^%/",$_POST['gotoShareMountPoint'])
581             )
582           ){
583         print_red(_("You must specify a valid mount point.")); 
584       }else{
585         $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']];
586         $s_mount = $_POST['gotoShareMountPoint'];
587         $s_user  = $_POST['ShareUser'];
588         /* Preparing the new assignment */ 
589         $this->gotoShares[$a_share['name']."|".$a_share['server']]=$a_share;
590         $this->gotoShares[$a_share['name']."|".$a_share['server']]['Username']=$s_user;
591         $this->gotoShares[$a_share['name']."|".$a_share['server']]['PwdHash']="";
592         $this->gotoShares[$a_share['name']."|".$a_share['server']]['mountPoint']=$s_mount;
593       }
594     }  
596     /* if the Post  gotoShareDel is set, someone asked GOsa to delete the selected entry (if there is one selected)
597      * If there is no defined share selected, we will abort the deletion without any message 
598      */
599     $once = true;
600     if($this->acl_is_writeable("gotoShare")){
601       foreach($_POST as $name => $value){
602         if((preg_match("/^gotoShareDel_/",$name)) && ($once)){
603           $once = false;  
604           $key  = preg_replace("/^gotoShareDel_/","",$name);
605           $key  = preg_replace("/_+[xy]$/","",$key);
606           $key  = base64_decode($key);
607           if(isset($this->gotoShares[$key])) {
608             unset($this->gotoShares[$key]);
609           }
611           /* Remove corresponding password entry, too. This is a workaround
612              to get rid of old-style entries. */
613           $key= preg_replace("/\|/", "|!", $key);
614           if(isset($this->gotoShares[$key])) {
615             unset($this->gotoShares[$key]);
616           }
617         }
618         if((preg_match("/^gotoShareResetPwd_/",$name)) && ($once)){
619           $once = false;
620           $key  = preg_replace("/^gotoShareResetPwd_/","",$name);
621           $key  = preg_replace("/_+[xy]$/","",$key);
622           $key  = base64_decode($key);
623           $this->gotoShares[$key]['PwdHash'] = "";
624           if(preg_match("/^!/",$this->gotoShares[$key]['server'])){
625             unset($this->gotoShares[$key]);
626           }
627         }
628       }
629     }
630     $divlistShares = new divSelectBox("gotoShares");
631     $divlistShares->SetHeight(100);
632     $tmp = $this->printOutAssignedShares();
634     foreach($tmp as $key => $value){
635       $img = "";
637       /* Check if entry starts with an ! */
638       if(preg_match("/^!/",$this->gotoShares[$key]['server'])){
640         /* If we are currently editing groups environment, skip those ! entries */ 
641         if($this->is_group) continue;
643         /* Create pwd reset images */
644         if($this->gotoShares[$key]['PwdHash'] != ""){
645           $img.= "<input type='image' name='gotoShareResetPwd_".base64_encode($key)." 'src='images/list_reset_password.png' alt='"._("Reset password hash")."' 
646             title='"._("Reset password hash")."'>";
647         }
648         $field1 = array("string" => "<font style=\"color:#C0C0C0\">".$value."</font>" );
649         $field2 = array("string" => $img   , "attach" => "style='border-right:0px;'");
650       }else{
652         /* Create pwd reset img && delete image */
653         if($this->gotoShares[$key]['PwdHash'] != ""){
654           $img.= "<input type='image' name='gotoShareResetPwd_".base64_encode($key)." 'src='images/list_reset_password.png' alt='"._("Reset password hash")."' 
655             title='"._("Reset password hash")."'>";
656           $img.= "&nbsp;";
657         }
658         $img.= "<input type='image' name='gotoShareDel_".base64_encode($key)." 'src='images/edittrash.png' alt='"._("Delete")."' 
659           title='"._("Delete share entry")."'>";
660         $field1 = array("string" => $value);
661         $field2 = array("string" => $img   , "attach" => "style='border-right:0px;'");
662       }
663       $divlistShares->AddEntry(array($field1,$field2));
664     }
665     $smarty->assign("divlistShares",$divlistShares->DrawList());
667     /* Hotplug devices will be handled here 
668      * There are 3 possible methods for this feature
669      * Create a new Hotplug, A Dialog will open where you can specify some hotplug information
670      * Delete will erase an entry, the entry must be selcted in the ListBox first
671      * Editing an entry will open a dialog where the informations about the selcted entry can be changed
672      */
674     /* If there is a new entry wanted, open a new entry by initilising the dialog */
675     if((isset($_POST['gotoHotplugDeviceNew'])) && ($this->acl_is_writeable("gotoHotplugDevice"))){
676       $this->dialog = new hotplugDialog($this->config,$this->dn);
677       $this->is_dialog = true;
678     }
680     /* We have to delete the selected hotplug from the list*/
681     if((isset($_POST['gotoHotplugDeviceDel']))&&(isset($_POST['gotoHotplugDevice'])) && $this->acl_is_writeable("gotoHotplugDevice")){
682       if($this->acl_is_writeable("gotoHotplugDevice")){
683         foreach($_POST['gotoHotplugDevice'] as $name){
684           unset($this->gotoHotplugDevices[$name]);
685         }
686       }
687     }
689     /* There are already defined hotplugs from other users we could use */
690     if(isset($_POST['gotoHotplugDeviceUse']) && $this->acl_is_writeable("gotoHotplugDevice")){
691       $tmp  =array();
692       foreach($this->gotoHotplugDevices as $plugs){
693         $tmp[] = $plugs['name'];
694       }
695       $this->dialog = new hotplugDialog($this->config,$this->dn,true,$tmp);
696       $this->is_dialog = true;
697     }
699     /* Dialog Aborted */
700     if(isset($_POST['HotPlugCancel'])){
701       unset($this->dialog);
702       $this->dialog= NULL;
703       $this->is_dialog = false;
704     }
706     /* Dialod saved */
707     if(isset($_POST['HotPlugSave'])){
709       $this->dialog->save_object();
710       if(count($this->dialog->check())!=0){
711         foreach($this->dialog->check() as $msg){
712           print_red($msg);
713         }
714       }else{
715         $this->dialog->save_object();
716         $a_tmp = $this->dialog->save();
718         if(is_array($a_tmp)){
719           foreach($a_tmp as $name => $hotplug){
720             $this->gotoHotplugDevices[$name]= $hotplug; 
721           }
722         }
723         unset($this->dialog);
724         $this->dialog= NULL;
725         $this->is_dialog = false;
726       }
727     }
728     $smarty->assign("gotoHotplugDevices",$this->printOutHotPlugDevices());
729     $smarty->assign("gotoHotplugDeviceKeys",array_flip($this->printOutHotPlugDevices()));
731     /* Printer Assignment will managed below 
732      * A printer can be assigned in two different ways and two different types
733      * There are 2 types of users assigned to a printer : user and admin
734      * They only differ in the member attribute they will be assigned to. user: gotoUserPrinter admin: gotoadminPrinter
735      * The different types of assigning a user are : 1 assigning a user to a printer 2. assigning a group to a printer
736      */ 
738     /* First handle Add Post. Open a dialog that allows us to select a printer or two */ 
739     if(isset($_POST['gotoPrinterAdd'])){
741       $this->is_dialog=true;
742       $this->dialog = new selectPrinterDialog($this->config,$this->dn,$this->gotoPrinter);
743     }
745     if(isset($_POST['PrinterCancel'])){
746       $this->is_dialog=false;
747       unset($this->dialog);
748       $this->dialog=NULL;
749     }
751     if(isset($_POST['PrinterSave'])){
752       if(count($this->dialog->check())!=0){
753         $tmp = $this->dialog->check();
754         foreach($tmp as $msg){
755           print_red($msg);
756         } 
757       }else{
758         $this->dialog->save_object();
759         $tmp = $this->dialog->save();
760         $tmp2= $this->dialog->getPrinter(true);
762         foreach($tmp as $pname){
763           $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$tmp2[$pname]['dn'],"printer");
764           $printerObj->set_acl_base($tmp2[$pname]['dn']);
766           $type = false;
768           if($this->is_group){
770             if(isset($this->NewDeletedPrinters[$pname])){
771               $type = "AddGroup";
772             }elseif($printerObj->by_object['printgeneric']->AddMember("AddGroup",$this->dn)){
773               $type = "AddGroup";
774             }
775           }else{
776             if(isset($this->NewDeletedPrinters[$pname])){
777               $type = "AddUser";
778             }elseif($printerObj->by_object['printgeneric']->AddMember("AddUser",$this->dn)){
779               $type = "AddUser";
780             }
781           }
783           if($type){
784             $this->gotoPrinter[$pname]=$tmp2[$pname];
785             $this->gotoPrinter[$pname]['mode']="user";
786             $this->add_del_printer_member_was_called = true;
788             $this->NewAddedPrinters[$pname] = $pname;
789             if(isset($this->NewDeletedPrinters[$pname])){
790               unset($this->NewDeletedPrinters[$pname]);
791             }
792           }
793         }
795         $this->is_dialog=false;
796         unset($this->dialog);
797         $this->dialog   =NULL;
798       }
799     }
801     if((isset($_POST['gotoPrinterDel']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
802       $printer = $_POST['gotoPrinterSel'];
803       foreach($printer as $pname){
805         $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$this->gotoPrinter[$pname]['dn'],"printer");
806         $printerObj->set_acl_base($this->gotoPrinter[$pname]['dn']);
808         $type = false;
809         if($this->is_group){
810           if(isset($this->NewAddedPrinters[$pname])){
811             $type = "Group";
812           }elseif($printerObj->by_object['printgeneric']->DelMember("AddGroup",$this->cn)){
813             $type = "Group";
814           }
815         }else{
816           if(isset($this->NewAddedPrinters[$pname])){
817             $type = "User";
818           }elseif($printerObj->by_object['printgeneric']->DelMember("AddUser",$this->uid)){
819             $type = "User";
820           }
821         }
822         if($type){
823           $this->add_del_printer_member_was_called = true;
824           unset($this->gotoPrinter[$pname]);
826           $this->NewDeletedPrinters[$pname] = $pname;
827           if(isset($this->NewAddedPrinters[$pname])){
828             UNSET($this->NewAddedPrinters[$pname]);
829           }
830         }
831       }
832     }
834     if((isset($_POST['gotoPrinterEdit']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
835       $printers = $_POST['gotoPrinterSel'];
836       $this->add_del_printer_member_was_called = true;
837       foreach($printers as $printer){
838         if($this->gotoPrinter[$printer]['mode']=="user"){
839           $this->gotoPrinter[$printer]['mode']="admin";
840         }else{
841           $this->gotoPrinter[$printer]['mode']="user";
842         }
843       }
844     }
846     if((isset($_POST['gotoPrinterDefault']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
847       if($this->is_group){
848         print_red(_("GOsa default printer flag is not allowed within groups."));
849       }else{
850         if ($this->gosaDefaultPrinter == $_POST['gotoPrinterSel'][0]){
851           $this->gosaDefaultPrinter= "";
852         } else {
853           $this->gosaDefaultPrinter= $_POST['gotoPrinterSel'][0];
854         }
855       }
856     }
858     $smarty->assign("gotoPrinter",$this->printOutPrinterDevices());
859     $smarty->assign("gotoPrinterKeys",array_flip($this->printOutPrinterDevices()));
861     /* General behavior */
862     if($this->acl_is_writeable("gotoKioskProfile")){
863     if((isset($this->dialog))&&($this->dialog!=NULL)&&(!empty($this->dialog))){
864       $this->dialog->save_object();
865       $disp =$this->dialog->execute();
867       $tmp = new kioskManagementDialog($this->config,$this->dn);
868       $list = $tmp->getKioskProfiles($this->newKioskProfiles);
869       $list['none']=_("None");
870       $list = array_reverse($list);
871       if(!isset($list[$this->gotoKioskProfile])){
872         print_red(sprintf(_("The selected kiosk profile '%s' is no longer available, setting current profile to 'none'."),$this->gotoKioskProfile));
873         $this->gotoKioskProfile = 'none';
874       }
875       return($disp);
876       }
877     }
879     /* Als smarty vars are set. Get smarty template and generate output */
880     $display.= $smarty->fetch(get_template_path('environment.tpl', TRUE,dirname(__FILE__)));
881     return($display);
882   }
884   function remove_from_parent()
885   {
886     /* only if it was an account*/
887     if (!$this->initially_was_account){
888       return;
889     }
891     /* include global link_info */
892     $ldap= $this->config->get_ldap_link();
894     /* Remove and write to LDAP */
895     plugin::remove_from_parent();
897     /* Don't save our template variables */
898     $skip = array("uid","gotoLogonScripts","gotoPrinter","gotoShares","gotoKioskProfiles","gotoHotplugDevices" );
900     /* Skip all these attributes */
901     foreach($skip as $del){
902       unset($this->attrs[$del]);
903     }
905     @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,$this->attributes, "Save");
907     $ldap->cd($this->dn);
908     $this->cleanup();
909     $ldap->modify ($this->attrs); 
911     show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/environment account with dn '%s' failed."),$this->dn));
913     /* Optionally execute a command after we're done */
914     $this->handle_post_events("remove",array("uid" => $this->uid));
915   }
918   /* Save data to object */
919   function save_object()
920   {
921     /* Get all Posted vars 
922      * Setup checkboxes 
923      */
924     $WriteOnly = (!isset($this->parent)|| !$this->parent) && !isset($_SESSION['edit']);
925     if(isset($_POST['iamposted'])){
927       $PACL =  $this->getacl("gotoProfileServer",$WriteOnly).$this->getacl("gotoProfileQuota",$WriteOnly);
929       if(preg_match("/w/",$PACL)){
930         if(isset($_POST['useProfile'])){
931           $this->useProfile = true;
932         }else{
933           $this->useProfile = false;
934         }
935       }
937       if($this->acl_is_writeable("gotoProfileFlagC")){
938         if(isset($_POST['gotoProfileFlagC'])){
939           $this->gotoProfileFlagC = $_POST['gotoProfileFlagC'];
940         }else{
941           $this->gotoProfileFlagC = false;
942         }
943       }
945       if($this->acl_is_writeable("gotoProfileFlagL")){
946         if(isset($_POST['gotoProfileFlagL'])){
947           $this->gotoProfileFlagL = $_POST['gotoProfileFlagL'];
948         }else{
949           $this->gotoProfileFlagL = false;
950         }
951       }
953       plugin::save_object();
954       foreach($this->attributes as $s_attr){
955         if((!isset($_POST[$s_attr])) || 
956             in_array($s_attr,array("gosaDefaultPrinter","gotoShares","gotoHotplugDevices","gotoPrinter","gotoLogonScripts","uid"))) continue;
957         if(!$this->acl_is_writeable($s_attr)){
958           continue;
959         }else{ 
960           if(isset($_POST[$s_attr])){
961             $this->$s_attr = $_POST[$s_attr];
962           }else{
963             $this->$s_attr = false;
964           }
965         }
966       }
967     }
968   }
971   /* Check supplied data */
972   function check()
973   {
974     /* Call common method to give check the hook */
975     $message= plugin::check();
977     $this->detect_grouptype();
979     if(preg_match("/[^0-9]/",$this->gotoProfileQuota)) {
980       $message[]=_("Please set a valid profile quota size.");
981     } 
982     if(!isset($this->attrs['objectClass'])){
983       $this->attrs['objectClass']=array();
984     } 
985     if(!$this->is_group){
986       if((!((in_array("posixAccount",$this->attrs['objectClass']))||($this->parent->by_object['posixAccount']->is_account==true)))&&(!$this->is_group)){
987         $message[]=(_("You need to setup a valid posix extension in order to enable evironment features."));  
988       }
989     }
990     return ($message);
991   }
994   /* Save to LDAP */
995   function save()
996   {
997     /* If group was renamed, all printer settings get lost
998      */ 
999     /* only save changed variables ....*/
1000     if ($this->gotoKioskProfile =="none") $this->gotoKioskProfile ="";
1001     if((!empty($this->gotoKioskProfile))&&($this->gotoKioskProfile != "none")){
1002       if(preg_match("/https/i",$_SERVER['HTTP_REFERER'])){
1003         $method="https://";
1004       }else{
1005         $method="http://";
1006       }
1008       $str = $method.str_replace("//","/",$_SERVER['SERVER_NAME']."/kiosk/");
1009       $this->gotoKioskProfile= $str.$this->gotoKioskProfile;
1010     }else{
1011       $this->gotoKioskProfile= array();
1012     }
1014     plugin::save();
1015     $ldap= $this->config->get_ldap_link();
1017     $realyUsedAttrs= array();
1019     $path = search_config($this->config->data,"environment", "KIOSKPATH"); 
1020     /* Creating Kiosk Profiles */
1021     foreach($this->newKioskProfiles as $file){
1022       $contents = $file['contents'];
1023       $fp = @fopen($path."/".$file['name'],"w");
1024       if(!$fp){
1025         print_red(_("Can't save new kiosk profiles, possibly permission denied for folder")." : ",$path);
1026       }else{
1027         fwrite($fp,$contents,strlen($contents));
1028       }
1029       @unlink($file['tmp_name']);
1030     }
1032     /* Save already used objectClasses */
1033     $ocs        = $this->attrs['objectClass'];
1034     unset($ocs['count']);
1035     $this->attrs = array();
1036     $this->attrs['objectClass']= $ocs;
1037     foreach($this->objectclasses as $objc){
1038       if(!in_array($objc,$this->attrs['objectClass'])){
1039         $this->attrs['objectClass'][]=$objc;
1040       }
1041     }
1043     /* 1. Search all printers that have our uid/cn as member 
1044      * 2. Delete this uid/cn from every single entry and save it again.
1045      * 2.1 There are different types of members: Users / Groups, this will be defined in $suffix
1046      * 2.2 And each type has two modes, Admin (e.g. 'gotoUserAdminPrinter') and Normal 
1047      */
1048     
1049     $this->detect_grouptype();
1051     if($this->add_del_printer_member_was_called){
1053       $types = array( "gotoUserPrinter"       => "AddUser",
1054           "gotoGroupPrinter"      => "AddGroup",
1055           "gotoUserAdminPrinter"  => "AddAdminUser",
1056           "gotoGroupAdminPrinter" => "AddAdminGroup");
1058       if($this->is_group){
1059         $s_suffix = "Group";
1060         $useVar   = "cn";
1061       }else{
1062         $useVar   = "uid";
1063         $s_suffix = "User";
1064       }
1066       /* Remove old entries */
1067       $ldap->search("(&(objectClass=gotoPrinter)(goto".$s_suffix."Printer=".$this->$useVar."))",array("*"));
1068       while($attr = $ldap->fetch()){
1069         $printerObj = NULL;
1070         $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$attr['dn'],"printer");
1071         $printerObj->set_acl_base($attr['dn']);
1072         $printerObj->by_object['printgeneric']->DelMember($types["goto".$s_suffix."Printer"],$this->$useVar);
1073         $printerObj->by_object['printgeneric']->save();
1074       }
1076       $ldap->search("(&(objectClass=gotoPrinter)(goto".$s_suffix."AdminPrinter=".$this->$useVar."))",array("*"));
1077       while($attr = $ldap->fetch()){
1078         $printerObj = NULL;
1079         $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$attr['dn'],"printer");
1080         $printerObj->set_acl_base($attr['dn']);
1081         $printerObj->by_object['printgeneric']->DelMember($types["goto".$s_suffix."AdminPrinter"],$this->$useVar);
1082         $printerObj->by_object['printgeneric']->save();
1083       }
1085       foreach($this->gotoPrinter as $printer){
1086         $printerObj = NULL;
1087         $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$printer['dn'],"printer");
1088         $printerObj->set_acl_base($printer['dn']);
1091         if($printer['mode'] == "admin") {
1092           $attribute = "goto".$s_suffix."AdminPrinter";
1093         }else{
1094           $attribute = "goto".$s_suffix."Printer";
1095         }
1097         $printerObj->by_object['printgeneric']->AddMember($types[$attribute],$this->dn);
1098         $printerObj->by_object['printgeneric']->save();
1099       }
1100     }    
1102     /* Prepare HotPlug devices */
1103     $this->attrs['gotoHotplugDevice'] = array();
1104     foreach($this->gotoHotplugDevices as $name => $device){
1105       $this->attrs['gotoHotplugDevice'][] = $device['name']."|".$device['description']."|".$device['id'].
1106         "|".$device['produkt']."|".$device['vendor'];
1107     }
1109     /* Prepare LogonScripts */
1110     $this->attrs['gotoLogonScript'] = array();
1111     foreach($this->gotoLogonScripts as $name => $script){
1112       $this->attrs['gotoLogonScript'][] =   $script['LogonName']."|".
1113         $script['LogonOverload'].$script['LogonLast']."|".
1114         $script['LogonPriority']."|".
1115         base64_encode($script['LogonData'])."|".
1116         $script['LogonDescription'];
1117     }
1119     /* Prepare Shares */
1120     $this->attrs['gotoShare']=array();
1121     foreach($this->gotoShares as $name => $share){
1122       $mntp= $share['mountPoint'];
1123       if (!preg_match('=^[a-z0-9+\._/%-]+$=i', $mntp)){
1124         $mntp= base64_encode($mntp);
1125       }
1126       $this->attrs['gotoShare'][] =$share['server']."|".$share['name']."|".$mntp."|".$share['PwdHash']."|".$share['Username'];
1127     }
1130     if($this->gotoXResolution == "auto") $this->gotoXResolution ="";
1131     $saveThis = array("gotoProfileQuota","gotoXResolution","gotoProfileServer","gotoKioskProfile","gosaDefaultPrinter");
1133     foreach($saveThis as $tosave){
1134       if(!empty($this->$tosave)){
1135         $this->attrs[$tosave]=$this->$tosave;
1136       }else{
1137         $this->attrs[$tosave]=array();
1138       }
1139     }
1141     /* Prepare Flags */
1142     $this->attrs['gotoProfileFlags'] = array($this->gotoProfileFlagC.$this->gotoProfileFlagL);
1143     if(empty($this->attrs['gotoProfileFlags'][0])){
1144       $this->attrs['gotoProfileFlags']=array();
1145     }
1147     if($this->useProfile == false){
1148       $this->attrs['gotoProfileFlags'] = preg_replace("/C/i","",$this->attrs['gotoProfileFlags']);
1149       $this->attrs['gotoProfileServer']= array(); 
1150     }
1152     $ldap->cat ($this->dn, array('dn'));
1153     if ($ldap->fetch()){
1154       $mode= "modify";
1155     } else {
1156       $mode= "add";
1157       $ldap->cd($this->config->current['BASE']);
1158       $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
1159     }
1161     $ldap->cd($this->dn);
1162     $this->cleanup();
1163     $ldap->$mode($this->attrs);
1164     show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/environment account with dn '%s' failed."),$this->dn));
1165     $this->handle_post_events($mode,array("uid"=>$this->uid));
1166   }
1168   /* Generate ListBox frindly output for the defined shares 
1169    * Possibly Add or remove an attribute here, 
1170    */
1171   function printOutAssignedShares()
1172   {
1173     $a_return = array();
1174     if(is_array($this->gotoShares)){
1175       foreach($this->gotoShares as $share){
1176         if(preg_match("/^!/",$share['server'])){
1177           $a_return[$share['name']."|".$share['server']]= preg_replace("/^!/","",$share['server'])."://".$share['name']." - "._("group share"); 
1178         }else{
1179           $a_return[$share['name']."|".$share['server']]= $share['server']."://".$share['name']." on ".$share['mountPoint']." as ".$share['Username'];
1180         }
1181       }
1182       natcasesort($a_return);
1183     }
1184     return($a_return);
1185   }
1187   /* Generate ListBox frindly output for the definedhotplugs 
1188    * Possibly Add or remove an attribute here,
1189    */
1190   function printOutHotPlugDevices()
1191   {
1192     $a_return= array();
1193     if(is_array($this->gotoHotplugDevices)){
1194       foreach($this->gotoHotplugDevices as $key=>$device){
1195         $a_return[$key] = $device['name']." - ".$device['id'];
1196       }
1197     }
1198     return($a_return);
1199   }
1201   /* Generates ListBox frienly output of used printer devices 
1202    * Append ' - admin' if printer is used in admin mode
1203    */
1204   function printOutPrinterDevices()
1205   {
1206     $a_return = array();
1207     if(is_array($this->gotoPrinter)){
1208       foreach($this->gotoPrinter as $printer){
1209         if($printer['mode'] == "admin"){
1210           $a_return[$printer['cn'][0]]= $printer['cn'][0]." - "._("Administrator");
1211         }else{
1212           $a_return[$printer['cn'][0]]= $printer['cn'][0]; 
1213         }
1214         if ($printer['cn'][0] == $this->gosaDefaultPrinter){
1215           $a_return[$printer['cn'][0]].=" - "._("Default printer");
1216         }
1217       }
1218     }
1219     return($a_return);
1220   }
1222   /* Generates ListBox frienly output of used logonscripts 
1223    */
1224   function printOutLogonScripts()
1225   {
1226     $a_return = array();
1227     if(is_array($this->gotoLogonScripts)){
1228       foreach($this->gotoLogonScripts as $script){
1229         $a_return[$script['LogonName']]= $script['LogonPriority']." - ".$script['LogonName']; 
1230       }
1231     }
1232     return($a_return);
1233   }
1236   /* Return plugin informations for acl handling 
1237 #FIXME these ACLs should work for groups too */ 
1238   function plInfo()
1239   {
1240     return (array("plShortName"     => _("Environment"),
1241           "plDescription"   => _("Environment settings"),         // Description
1242           "plSelfModify"    => TRUE,                              
1243           "plDepends"       => array("user", "posixAccount"),     // This plugin depends on 
1244           "plPriority"      => 2,                                 // Position in tabs 
1245           "plSection"       => "personal",                        // This belongs to personal
1246           "plCategory"      => array("users", "groups"),          // Add to following categories 
1247           "plOptions"       => array("resolution_hook" => array("type" => "string",
1248               "description" => _("Command to extend the list of possible screen resolutions"))),
1250           "plProvidedAcls"  => array(
1252             "gotoProfileFlagL"    => _("Resolution changeable during session") ,
1253             "gotoProfileFlagC"    => _("Cache profile localy") ,
1255             "gotoProfileQuota"    => _("Profile quota") ,
1256             "gotoProfileServer"   => _("Profile server") ,
1258             "gotoXResolution"     => _("Resolution") ,
1259             "gotoKioskProfile"    => _("Kiosk profile") ,
1261             "gosaDefaultPrinter"  => _("Default printer") ,
1262             "gotoLogonScript"     => _("Logon script") ,
1263             "gotoHotplugDevice"   => _("Hotplug devices"),
1264             "gotoShare"           => _("Shares"))
1265             ));
1266   }
1269 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
1270 ?>