Code

Updated ACL && Priority
[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);
634     $tmp = array();
635     if($this->acl_is_readable("gotoShares")){
636       $tmp = $this->printOutAssignedShares();
637     }
639     
640     foreach($tmp as $key => $value){
641       $img = "";
643       /* Check if entry starts with an ! */
644       if(preg_match("/^!/",$this->gotoShares[$key]['server'])){
646         /* If we are currently editing groups environment, skip those ! entries */ 
647         if($this->is_group) continue;
649         /* Create pwd reset images */
650         if($this->gotoShares[$key]['PwdHash'] != ""){
651           $img.= "<input type='image' name='gotoShareResetPwd_".base64_encode($key)." 'src='images/list_reset_password.png' alt='"._("Reset password hash")."' 
652             title='"._("Reset password hash")."'>";
653         }
654         $field1 = array("string" => "<font style=\"color:#C0C0C0\">".$value."</font>" );
655         $field2 = array("string" => $img   , "attach" => "style='border-right:0px;'");
656       }else{
658         /* Create pwd reset img && delete image */
659         if($this->gotoShares[$key]['PwdHash'] != ""){
660           $img.= "<input type='image' name='gotoShareResetPwd_".base64_encode($key)." 'src='images/list_reset_password.png' alt='"._("Reset password hash")."' 
661             title='"._("Reset password hash")."'>";
662           $img.= "&nbsp;";
663         }
664         $img.= "<input type='image' name='gotoShareDel_".base64_encode($key)." 'src='images/edittrash.png' alt='"._("Delete")."' 
665           title='"._("Delete share entry")."'>";
666         $field1 = array("string" => $value);
667         $field2 = array("string" => $img   , "attach" => "style='border-right:0px;'");
668       }
669       $divlistShares->AddEntry(array($field1,$field2));
670     }
671     $smarty->assign("divlistShares",$divlistShares->DrawList());
673     /* Hotplug devices will be handled here 
674      * There are 3 possible methods for this feature
675      * Create a new Hotplug, A Dialog will open where you can specify some hotplug information
676      * Delete will erase an entry, the entry must be selcted in the ListBox first
677      * Editing an entry will open a dialog where the informations about the selcted entry can be changed
678      */
680     /* If there is a new entry wanted, open a new entry by initilising the dialog */
681     if((isset($_POST['gotoHotplugDeviceNew'])) && ($this->acl_is_writeable("gotoHotplugDevice"))){
682       $this->dialog = new hotplugDialog($this->config,$this->dn);
683       $this->is_dialog = true;
684     }
686     /* We have to delete the selected hotplug from the list*/
687     if((isset($_POST['gotoHotplugDeviceDel']))&&(isset($_POST['gotoHotplugDevice'])) && $this->acl_is_writeable("gotoHotplugDevice")){
688       if($this->acl_is_writeable("gotoHotplugDevice")){
689         foreach($_POST['gotoHotplugDevice'] as $name){
690           unset($this->gotoHotplugDevices[$name]);
691         }
692       }
693     }
695     /* There are already defined hotplugs from other users we could use */
696     if(isset($_POST['gotoHotplugDeviceUse']) && $this->acl_is_writeable("gotoHotplugDevice")){
697       $tmp  =array();
698       foreach($this->gotoHotplugDevices as $plugs){
699         $tmp[] = $plugs['name'];
700       }
701       $this->dialog = new hotplugDialog($this->config,$this->dn,true,$tmp);
702       $this->is_dialog = true;
703     }
705     /* Dialog Aborted */
706     if(isset($_POST['HotPlugCancel'])){
707       unset($this->dialog);
708       $this->dialog= NULL;
709       $this->is_dialog = false;
710     }
712     /* Dialod saved */
713     if(isset($_POST['HotPlugSave'])){
715       $this->dialog->save_object();
716       if(count($this->dialog->check())!=0){
717         foreach($this->dialog->check() as $msg){
718           print_red($msg);
719         }
720       }else{
721         $this->dialog->save_object();
722         $a_tmp = $this->dialog->save();
724         if(is_array($a_tmp)){
725           foreach($a_tmp as $name => $hotplug){
726             $this->gotoHotplugDevices[$name]= $hotplug; 
727           }
728         }
729         unset($this->dialog);
730         $this->dialog= NULL;
731         $this->is_dialog = false;
732       }
733     }
734     $smarty->assign("gotoHotplugDevices",$this->printOutHotPlugDevices());
735     $smarty->assign("gotoHotplugDeviceKeys",array_flip($this->printOutHotPlugDevices()));
737     /* Printer Assignment will managed below 
738      * A printer can be assigned in two different ways and two different types
739      * There are 2 types of users assigned to a printer : user and admin
740      * They only differ in the member attribute they will be assigned to. user: gotoUserPrinter admin: gotoadminPrinter
741      * The different types of assigning a user are : 1 assigning a user to a printer 2. assigning a group to a printer
742      */ 
744     /* First handle Add Post. Open a dialog that allows us to select a printer or two */ 
745     if(isset($_POST['gotoPrinterAdd'])){
747       $this->is_dialog=true;
748       $this->dialog = new selectPrinterDialog($this->config,$this->dn,$this->gotoPrinter);
749     }
751     if(isset($_POST['PrinterCancel'])){
752       $this->is_dialog=false;
753       unset($this->dialog);
754       $this->dialog=NULL;
755     }
757     if(isset($_POST['PrinterSave'])){
758       if(count($this->dialog->check())!=0){
759         $tmp = $this->dialog->check();
760         foreach($tmp as $msg){
761           print_red($msg);
762         } 
763       }else{
764         $this->dialog->save_object();
765         $tmp = $this->dialog->save();
766         $tmp2= $this->dialog->getPrinter(true);
768         foreach($tmp as $pname){
769           $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$tmp2[$pname]['dn'],"printer");
770           $printerObj->set_acl_base($tmp2[$pname]['dn']);
772           $type = false;
774           if($this->is_group){
776             if(isset($this->NewDeletedPrinters[$pname])){
777               $type = "AddGroup";
778             }elseif($printerObj->by_object['printgeneric']->AddMember("AddGroup",$this->dn)){
779               $type = "AddGroup";
780             }
781           }else{
782             if(isset($this->NewDeletedPrinters[$pname])){
783               $type = "AddUser";
784             }elseif($printerObj->by_object['printgeneric']->AddMember("AddUser",$this->dn)){
785               $type = "AddUser";
786             }
787           }
789           if($type){
790             $this->gotoPrinter[$pname]=$tmp2[$pname];
791             $this->gotoPrinter[$pname]['mode']="user";
792             $this->add_del_printer_member_was_called = true;
794             $this->NewAddedPrinters[$pname] = $pname;
795             if(isset($this->NewDeletedPrinters[$pname])){
796               unset($this->NewDeletedPrinters[$pname]);
797             }
798           }
799         }
801         $this->is_dialog=false;
802         unset($this->dialog);
803         $this->dialog   =NULL;
804       }
805     }
807     if((isset($_POST['gotoPrinterDel']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
808       $printer = $_POST['gotoPrinterSel'];
809       foreach($printer as $pname){
811         $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$this->gotoPrinter[$pname]['dn'],"printer");
812         $printerObj->set_acl_base($this->gotoPrinter[$pname]['dn']);
814         $type = false;
815         if($this->is_group){
816           if(isset($this->NewAddedPrinters[$pname])){
817             $type = "Group";
818           }elseif($printerObj->by_object['printgeneric']->DelMember("AddGroup",$this->cn)){
819             $type = "Group";
820           }
821         }else{
822           if(isset($this->NewAddedPrinters[$pname])){
823             $type = "User";
824           }elseif($printerObj->by_object['printgeneric']->DelMember("AddUser",$this->uid)){
825             $type = "User";
826           }
827         }
828         if($type){
829           $this->add_del_printer_member_was_called = true;
830           unset($this->gotoPrinter[$pname]);
832           $this->NewDeletedPrinters[$pname] = $pname;
833           if(isset($this->NewAddedPrinters[$pname])){
834             UNSET($this->NewAddedPrinters[$pname]);
835           }
836         }
837       }
838     }
840     if((isset($_POST['gotoPrinterEdit']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
841       $printers = $_POST['gotoPrinterSel'];
842       $this->add_del_printer_member_was_called = true;
843       foreach($printers as $printer){
844         if($this->gotoPrinter[$printer]['mode']=="user"){
845           $this->gotoPrinter[$printer]['mode']="admin";
846         }else{
847           $this->gotoPrinter[$printer]['mode']="user";
848         }
849       }
850     }
852     if((isset($_POST['gotoPrinterDefault']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
853       if($this->is_group){
854         print_red(_("GOsa default printer flag is not allowed within groups."));
855       }else{
856         if ($this->gosaDefaultPrinter == $_POST['gotoPrinterSel'][0]){
857           $this->gosaDefaultPrinter= "";
858         } else {
859           $this->gosaDefaultPrinter= $_POST['gotoPrinterSel'][0];
860         }
861       }
862     }
864     $smarty->assign("gotoPrinter",$this->printOutPrinterDevices());
865     $smarty->assign("gotoPrinterKeys",array_flip($this->printOutPrinterDevices()));
867     /* General behavior */
868     if($this->acl_is_writeable("gotoKioskProfile")){
869     if((isset($this->dialog))&&($this->dialog!=NULL)&&(!empty($this->dialog))){
870       $this->dialog->save_object();
871       $disp =$this->dialog->execute();
873       $tmp = new kioskManagementDialog($this->config,$this->dn);
874       $list = $tmp->getKioskProfiles($this->newKioskProfiles);
875       $list['none']=_("None");
876       $list = array_reverse($list);
877       if(!isset($list[$this->gotoKioskProfile])){
878         print_red(sprintf(_("The selected kiosk profile '%s' is no longer available, setting current profile to 'none'."),$this->gotoKioskProfile));
879         $this->gotoKioskProfile = 'none';
880       }
881       return($disp);
882       }
883     }
885     /* Als smarty vars are set. Get smarty template and generate output */
886     $display.= $smarty->fetch(get_template_path('environment.tpl', TRUE,dirname(__FILE__)));
887     return($display);
888   }
890   function remove_from_parent()
891   {
892     /* only if it was an account*/
893     if (!$this->initially_was_account){
894       return;
895     }
897     /* include global link_info */
898     $ldap= $this->config->get_ldap_link();
900     /* Remove and write to LDAP */
901     plugin::remove_from_parent();
903     /* Don't save our template variables */
904     $skip = array("uid","gotoLogonScripts","gotoPrinter","gotoShares","gotoKioskProfiles","gotoHotplugDevices" );
906     /* Skip all these attributes */
907     foreach($skip as $del){
908       unset($this->attrs[$del]);
909     }
911     @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,$this->attributes, "Save");
913     $ldap->cd($this->dn);
914     $this->cleanup();
915     $ldap->modify ($this->attrs); 
917     show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/environment account with dn '%s' failed."),$this->dn));
919     /* Optionally execute a command after we're done */
920     $this->handle_post_events("remove",array("uid" => $this->uid));
921   }
924   /* Save data to object */
925   function save_object()
926   {
927     /* Get all Posted vars 
928      * Setup checkboxes 
929      */
930     $WriteOnly = (!isset($this->parent)|| !$this->parent) && !isset($_SESSION['edit']);
931     if(isset($_POST['iamposted'])){
933       $PACL =  $this->getacl("gotoProfileServer",$WriteOnly).$this->getacl("gotoProfileQuota",$WriteOnly);
935       if(preg_match("/w/",$PACL)){
936         if(isset($_POST['useProfile'])){
937           $this->useProfile = true;
938         }else{
939           $this->useProfile = false;
940         }
941       }
943       if($this->acl_is_writeable("gotoProfileFlagC")){
944         if(isset($_POST['gotoProfileFlagC'])){
945           $this->gotoProfileFlagC = $_POST['gotoProfileFlagC'];
946         }else{
947           $this->gotoProfileFlagC = false;
948         }
949       }
951       if($this->acl_is_writeable("gotoProfileFlagL")){
952         if(isset($_POST['gotoProfileFlagL'])){
953           $this->gotoProfileFlagL = $_POST['gotoProfileFlagL'];
954         }else{
955           $this->gotoProfileFlagL = false;
956         }
957       }
959       plugin::save_object();
960       foreach($this->attributes as $s_attr){
961         if((!isset($_POST[$s_attr])) || 
962             in_array($s_attr,array("gosaDefaultPrinter","gotoShares","gotoHotplugDevices","gotoPrinter","gotoLogonScripts","uid"))) continue;
963         if(!$this->acl_is_writeable($s_attr)){
964           continue;
965         }else{ 
966           if(isset($_POST[$s_attr])){
967             $this->$s_attr = $_POST[$s_attr];
968           }else{
969             $this->$s_attr = false;
970           }
971         }
972       }
973     }
974   }
977   /* Check supplied data */
978   function check()
979   {
980     /* Call common method to give check the hook */
981     $message= plugin::check();
983     $this->detect_grouptype();
985     if(preg_match("/[^0-9]/",$this->gotoProfileQuota)) {
986       $message[]=_("Please set a valid profile quota size.");
987     } 
988     if(!isset($this->attrs['objectClass'])){
989       $this->attrs['objectClass']=array();
990     } 
991     if(!$this->is_group){
992       if((!((in_array("posixAccount",$this->attrs['objectClass']))||($this->parent->by_object['posixAccount']->is_account==true)))&&(!$this->is_group)){
993         $message[]=(_("You need to setup a valid posix extension in order to enable evironment features."));  
994       }
995     }
996     return ($message);
997   }
1000   /* Save to LDAP */
1001   function save()
1002   {
1003     /* If group was renamed, all printer settings get lost
1004      */ 
1005     /* only save changed variables ....*/
1006     if ($this->gotoKioskProfile =="none") $this->gotoKioskProfile ="";
1007     if((!empty($this->gotoKioskProfile))&&($this->gotoKioskProfile != "none")){
1008       if(preg_match("/https/i",$_SERVER['HTTP_REFERER'])){
1009         $method="https://";
1010       }else{
1011         $method="http://";
1012       }
1014       $str = $method.str_replace("//","/",$_SERVER['SERVER_NAME']."/kiosk/");
1015       $this->gotoKioskProfile= $str.$this->gotoKioskProfile;
1016     }else{
1017       $this->gotoKioskProfile= array();
1018     }
1020     plugin::save();
1021     $ldap= $this->config->get_ldap_link();
1023     $realyUsedAttrs= array();
1025     $path = search_config($this->config->data,"environment", "KIOSKPATH"); 
1026     /* Creating Kiosk Profiles */
1027     foreach($this->newKioskProfiles as $file){
1028       $contents = $file['contents'];
1029       $fp = @fopen($path."/".$file['name'],"w");
1030       if(!$fp){
1031         print_red(_("Can't save new kiosk profiles, possibly permission denied for folder")." : ",$path);
1032       }else{
1033         fwrite($fp,$contents,strlen($contents));
1034       }
1035       @unlink($file['tmp_name']);
1036     }
1038     /* Save already used objectClasses */
1039     $ocs        = $this->attrs['objectClass'];
1040     unset($ocs['count']);
1041     $this->attrs = array();
1042     $this->attrs['objectClass']= $ocs;
1043     foreach($this->objectclasses as $objc){
1044       if(!in_array($objc,$this->attrs['objectClass'])){
1045         $this->attrs['objectClass'][]=$objc;
1046       }
1047     }
1049     /* 1. Search all printers that have our uid/cn as member 
1050      * 2. Delete this uid/cn from every single entry and save it again.
1051      * 2.1 There are different types of members: Users / Groups, this will be defined in $suffix
1052      * 2.2 And each type has two modes, Admin (e.g. 'gotoUserAdminPrinter') and Normal 
1053      */
1054     
1055     $this->detect_grouptype();
1057     if($this->add_del_printer_member_was_called){
1059       $types = array( "gotoUserPrinter"       => "AddUser",
1060           "gotoGroupPrinter"      => "AddGroup",
1061           "gotoUserAdminPrinter"  => "AddAdminUser",
1062           "gotoGroupAdminPrinter" => "AddAdminGroup");
1064       if($this->is_group){
1065         $s_suffix = "Group";
1066         $useVar   = "cn";
1067       }else{
1068         $useVar   = "uid";
1069         $s_suffix = "User";
1070       }
1072       /* Remove old entries */
1073       $ldap->search("(&(objectClass=gotoPrinter)(goto".$s_suffix."Printer=".$this->$useVar."))",array("*"));
1074       while($attr = $ldap->fetch()){
1075         $printerObj = NULL;
1076         $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$attr['dn'],"printer");
1077         $printerObj->set_acl_base($attr['dn']);
1078         $printerObj->by_object['printgeneric']->DelMember($types["goto".$s_suffix."Printer"],$this->$useVar);
1079         $printerObj->by_object['printgeneric']->save();
1080       }
1082       $ldap->search("(&(objectClass=gotoPrinter)(goto".$s_suffix."AdminPrinter=".$this->$useVar."))",array("*"));
1083       while($attr = $ldap->fetch()){
1084         $printerObj = NULL;
1085         $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$attr['dn'],"printer");
1086         $printerObj->set_acl_base($attr['dn']);
1087         $printerObj->by_object['printgeneric']->DelMember($types["goto".$s_suffix."AdminPrinter"],$this->$useVar);
1088         $printerObj->by_object['printgeneric']->save();
1089       }
1091       foreach($this->gotoPrinter as $printer){
1092         $printerObj = NULL;
1093         $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$printer['dn'],"printer");
1094         $printerObj->set_acl_base($printer['dn']);
1097         if($printer['mode'] == "admin") {
1098           $attribute = "goto".$s_suffix."AdminPrinter";
1099         }else{
1100           $attribute = "goto".$s_suffix."Printer";
1101         }
1103         $printerObj->by_object['printgeneric']->AddMember($types[$attribute],$this->dn);
1104         $printerObj->by_object['printgeneric']->save();
1105       }
1106     }    
1108     /* Prepare HotPlug devices */
1109     $this->attrs['gotoHotplugDevice'] = array();
1110     foreach($this->gotoHotplugDevices as $name => $device){
1111       $this->attrs['gotoHotplugDevice'][] = $device['name']."|".$device['description']."|".$device['id'].
1112         "|".$device['produkt']."|".$device['vendor'];
1113     }
1115     /* Prepare LogonScripts */
1116     $this->attrs['gotoLogonScript'] = array();
1117     foreach($this->gotoLogonScripts as $name => $script){
1118       $this->attrs['gotoLogonScript'][] =   $script['LogonName']."|".
1119         $script['LogonOverload'].$script['LogonLast']."|".
1120         $script['LogonPriority']."|".
1121         base64_encode($script['LogonData'])."|".
1122         $script['LogonDescription'];
1123     }
1125     /* Prepare Shares */
1126     $this->attrs['gotoShare']=array();
1127     foreach($this->gotoShares as $name => $share){
1128       $mntp= $share['mountPoint'];
1129       if (!preg_match('=^[a-z0-9+\._/%-]+$=i', $mntp)){
1130         $mntp= base64_encode($mntp);
1131       }
1132       $this->attrs['gotoShare'][] =$share['server']."|".$share['name']."|".$mntp."|".$share['PwdHash']."|".$share['Username'];
1133     }
1136     if($this->gotoXResolution == "auto") $this->gotoXResolution ="";
1137     $saveThis = array("gotoProfileQuota","gotoXResolution","gotoProfileServer","gotoKioskProfile","gosaDefaultPrinter");
1139     foreach($saveThis as $tosave){
1140       if(!empty($this->$tosave)){
1141         $this->attrs[$tosave]=$this->$tosave;
1142       }else{
1143         $this->attrs[$tosave]=array();
1144       }
1145     }
1147     /* Prepare Flags */
1148     $this->attrs['gotoProfileFlags'] = array($this->gotoProfileFlagC.$this->gotoProfileFlagL);
1149     if(empty($this->attrs['gotoProfileFlags'][0])){
1150       $this->attrs['gotoProfileFlags']=array();
1151     }
1153     if($this->useProfile == false){
1154       $this->attrs['gotoProfileFlags'] = preg_replace("/C/i","",$this->attrs['gotoProfileFlags']);
1155       $this->attrs['gotoProfileServer']= array(); 
1156     }
1158     $ldap->cat ($this->dn, array('dn'));
1159     if ($ldap->fetch()){
1160       $mode= "modify";
1161     } else {
1162       $mode= "add";
1163       $ldap->cd($this->config->current['BASE']);
1164       $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
1165     }
1167     $ldap->cd($this->dn);
1168     $this->cleanup();
1169     $ldap->$mode($this->attrs);
1170     show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/environment account with dn '%s' failed."),$this->dn));
1171     $this->handle_post_events($mode,array("uid"=>$this->uid));
1172   }
1174   /* Generate ListBox frindly output for the defined shares 
1175    * Possibly Add or remove an attribute here, 
1176    */
1177   function printOutAssignedShares()
1178   {
1179     $a_return = array();
1180     if(is_array($this->gotoShares)){
1181       foreach($this->gotoShares as $share){
1182         if(preg_match("/^!/",$share['server'])){
1183           $a_return[$share['name']."|".$share['server']]= preg_replace("/^!/","",$share['server'])."://".$share['name']." - "._("group share"); 
1184         }else{
1185           $a_return[$share['name']."|".$share['server']]= $share['server']."://".$share['name']." on ".$share['mountPoint']." as ".$share['Username'];
1186         }
1187       }
1188       natcasesort($a_return);
1189     }
1190     return($a_return);
1191   }
1193   /* Generate ListBox frindly output for the definedhotplugs 
1194    * Possibly Add or remove an attribute here,
1195    */
1196   function printOutHotPlugDevices()
1197   {
1198     $a_return= array();
1199     if(is_array($this->gotoHotplugDevices)){
1200       foreach($this->gotoHotplugDevices as $key=>$device){
1201         $a_return[$key] = $device['name']." - ".$device['id'];
1202       }
1203     }
1204     return($a_return);
1205   }
1207   /* Generates ListBox frienly output of used printer devices 
1208    * Append ' - admin' if printer is used in admin mode
1209    */
1210   function printOutPrinterDevices()
1211   {
1212     $a_return = array();
1213     
1214     if($this->acl_is_readable("gotoPrinter")){
1216       if(is_array($this->gotoPrinter)){
1217         foreach($this->gotoPrinter as $printer){
1218           if($printer['mode'] == "admin"){
1219             $a_return[$printer['cn'][0]]= $printer['cn'][0]." - "._("Administrator");
1220           }else{
1221             $a_return[$printer['cn'][0]]= $printer['cn'][0]; 
1222           }
1223           if ($printer['cn'][0] == $this->gosaDefaultPrinter){
1224             $a_return[$printer['cn'][0]].=" - "._("Default printer");
1225           }
1226         }
1227       }
1228     }
1229     return($a_return);
1230   }
1232   /* Generates ListBox frienly output of used logonscripts 
1233    */
1234   function printOutLogonScripts()
1235   {
1236     $a_return = array();
1237     if(is_array($this->gotoLogonScripts)){
1238       foreach($this->gotoLogonScripts as $script){
1239         $a_return[$script['LogonName']]= $script['LogonPriority']." - ".$script['LogonName']; 
1240       }
1241     }
1242     return($a_return);
1243   }
1246   /* Return plugin informations for acl handling 
1247 #FIXME these ACLs should work for groups too */ 
1248   function plInfo()
1249   {
1250     return (array("plShortName"     => _("Environment"),
1251           "plDescription"   => _("Environment settings"),         // Description
1252           "plSelfModify"    => TRUE,                              
1253           "plDepends"       => array("user", "posixAccount"),     // This plugin depends on 
1254           "plPriority"      => 3,                                 // Position in tabs 
1255           "plSection"       => "personal",                        // This belongs to personal
1256           "plCategory"      => array("users", "groups"),          // Add to following categories 
1257           "plOptions"       => array("resolution_hook" => array("type" => "string",
1258               "description" => _("Command to extend the list of possible screen resolutions"))),
1260           "plProvidedAcls"  => array(
1262             "gotoProfileFlagL"    => _("Resolution changeable during session") ,
1263             "gotoProfileFlagC"    => _("Cache profile localy") ,
1265             "gotoProfileQuota"    => _("Profile quota") ,
1266             "gotoProfileServer"   => _("Profile server") ,
1268             "gotoXResolution"     => _("Resolution") ,
1269             "gotoKioskProfile"    => _("Kiosk profile") ,
1271             "gosaDefaultPrinter"  => _("Default printer") ,
1272             "gotoLogonScript"     => _("Logon script") ,
1273             "gotoHotplugDevice"   => _("Hotplug devices"),
1274             "gotoShare"           => _("Shares"))
1275             ));
1276   }
1279 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
1280 ?>