Code

Bugfix for #4263
[gosa.git] / trunk / gosa-plugins / goto / admin / systems / goto / class_terminalGeneric.inc
1 <?php
3 class termgeneric extends plugin
4 {
5   /* Generic terminal attributes */
6   var $gotoMode= "locked";
7   var $gotoTerminalPath= "";
8   var $gotoSwapServer= "";
9   var $gotoSyslogServer= "";
10   var $gotoSyslogServers = array();
11   var $gotoNtpServer= array();
12   var $gotoNtpServers= array();
13   var $gotoSndModule= "";
14   var $gotoFloppyEnable= "";
15   var $gotoCdromEnable= "";
16   var $ghCpuType= "-";
17   var $ghMemSize= "-";
18   var $ghUsbSupport= "-";
19   var $ghNetNic= array();
20   var $ghIdeDev= array();
21   var $ghScsiDev= array();
22   var $ghGfxAdapter= "-";
23   var $ghSoundAdapter= "-";
24   var $gotoHardwareChecksum = "";
25   var $gotoSysStatus = "";
26   var $gotoLastUser= "-";
27   var $netConfigDNS;
28   var $auto_activate= FALSE;
29   
30   /* Needed values and lists */
31   var $base= "";
32   var $cn= "";
33   var $description= "";
34   var $orig_dn= "";
35   var $orig_cn= "";
36   var $orig_base= "";
38   var $inheritTimeServer = true;
40   /* Plugin side filled */
41   var $modes= array();
43   /* attribute list for save action */
44   var $ignore_account= TRUE;
45   var $attributes= array("gotoMode", "gotoTerminalPath", 
46       "gotoSwapServer", "gotoSyslogServer", "gotoNtpServer",
47       "gotoFloppyEnable", "gotoCdromEnable", "cn", "gotoSndModule",
48       "ghCpuType", "ghMemSize","ghUsbSupport", "description",
49       "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser", 'gotoHardwareChecksum', 'gotoSysStatus');
50   var $objectclasses= array("top", "gotoTerminal", "GOhard");
52   var $validActions   = array("reboot" => "", "rescan" => "", "wake" => "", "memcheck" => "", "sysinfo" => "");
54   var $fai_activated = FALSE;
55   var $view_logged = FALSE;
57   var $member_of_ogroup = FALSE;
59   var $kerberos_key_service = NULL;
62   function termgeneric (&$config, $dn= NULL, $parent= NULL)
63   {
64     /* Check if FAI is activated */
65     $tmp= $config->search("faiManagement", "CLASS",array('menu','tabs'));
66     if(!empty($tmp)){
67       $this->fai_activated = TRUE;
68     }
70     plugin::plugin ($config, $dn, $parent);
72     if(class_available("krbHostKeys")){
73       $this->kerberos_key_service = new krbHostKeys($this->config,$this);
74     }
76     if(!isset($this->parent->by_object['ogroup'])){
77       $ldap = $this->config->get_ldap_link();
78       $ldap->cd ($this->config->current['BASE']);
79       $ldap->search("(&(|(objectClass=gotoTerminalTemplate)(objectClass=gotoWorkstationTemplate))(member=".LDAP::prepare4filter($this->dn)."))",array("cn"));
80       $this->member_of_ogroup = $ldap->count() >= 1;
81     }
83     $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses);
84     /* Read arrays */
85     foreach (array("ghNetNic", "ghIdeDev", "ghScsiDev") as $val){
86       if (!isset($this->attrs[$val])){
87         continue;
88       }
89       for ($i= 0; $i<$this->attrs[$val]['count']; $i++){
90         array_push($this->$val, $this->attrs[$val][$i]);
91       }
92     }
94     /* Create used ntp server array */
95     $this->gotoNtpServer= array();
96     if(isset($this->attrs['gotoNtpServer'])){
97       $this->inheritTimeServer = false;
98       for($i = 0 ; $i < $this->attrs['gotoNtpServer']['count']; $i++ ){
99         $server = $this->attrs['gotoNtpServer'][$i];
100         $this->gotoNtpServer[$server] = $server;
101       }
102     }
104     /* Set inherit checkbox state */
105     if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer)==0)){
106       $this->inheritTimeServer = true;
107       $this->gotoNtpServer=array();
108     }
110     /* You can't inherit the NTP service, if we are not member in an object group */
111     if(!$this->member_of_ogroup){
112       $this->inheritTimeServer = FALSE;
113     }
115     /* Create available ntp options */
116     $this->gotoNtpServers = $this->config->data['SERVERS']['NTP'];
117     foreach($this->gotoNtpServers as $key => $server){
118       if($server == "default"){
119         unset($this->gotoNtpServers[$key]);
120       }
121     }
123     $this->modes["locked"]= _("Locked");
124     $this->modes["active"]= _("Activated");
126     /* Set base */
127     if ($this->dn == "new"){
128       $ui= get_userinfo();
129       $this->base= dn2base($ui->dn);
130     } else {
131       $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("terminalRDN"), '/')."/", "", $this->dn);
132     }
134     /* Create an array of all Syslog servers */
135     $tmp = $this->config->data['SERVERS']['SYSLOG'];
136     foreach($tmp as $server){
137       $visible = $server;
138       if($server == "default" && $this->member_of_ogroup) {
139         $visible = "["._("inherited")."]";
140       }
141       $this->gotoSyslogServers[$server] = $visible;
142     }
144     $this->orig_dn= $this->dn;
145     $this->orig_cn= $this->cn;
146     $this->orig_base= $this->base;
147   }
149   function set_acl_base($base)
150   {
151     plugin::set_acl_base($base);
152     $this->netConfigDNS->set_acl_base($base);
153   }
155   function set_acl_category($cat)
156   {
157     plugin::set_acl_category($cat);
158     $this->netConfigDNS->set_acl_category($cat);
159   }
161   function execute()
162   {
163     /* Call parent execute */
164     plugin::execute();
166     if($this->is_account && !$this->view_logged){
167       $this->view_logged = TRUE;
168       new log("view","terminal/".get_class($this),$this->dn);
169     }
171     /* Do we need to flip is_account state? */
172     if (isset($_POST['modify_state'])){
173       $this->is_account= !$this->is_account;
174     }
176     if (isset($_POST['action']) && $this->acl_is_writeable("FAIstate") && isset($this->validActions[$_POST['saction']])){
177       $action = $_POST['saction'];
179       /* Check if we have an DaemonEvent for this action */
180       if(class_available("DaemonEvent_".$action)){
181         $events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);
182         if(isset($events['TRIGGERED']["DaemonEvent_".$action])){
183           $evt = $events['TRIGGERED']["DaemonEvent_".$action];
184           $tmp = new $evt['CLASS_NAME']($this->config);
185           $tmp->add_targets(array($this->netConfigDNS->macAddress));
186           $tmp->set_type(TRIGGERED_EVENT);
187           $o_queue = new gosaSupportDaemon();
188           if(!$o_queue->append($tmp)){
189             msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
190           }
191         }
192       }else{
193         msg_dialog::display(_("Event error"),
194                     sprintf(_("Event '%s' is not available!"),$action),ERROR_DIALOG);
195       }
197     }
199     /* Base select dialog */
200     $once = true;
201     foreach($_POST as $name => $value){
202       if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_moveable()){
203         $once = false;
204         $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
205         $this->dialog->setCurrentBase($this->base);
206       }
207     }
209     /* Dialog handling */
210     if(is_object($this->dialog)){
211       /* Must be called before save_object */
212       $this->dialog->save_object();
214       if($this->dialog->isClosed()){
215         $this->dialog = false;
216       }elseif($this->dialog->isSelected()){
218         /* A new base was selected, check if it is a valid one */
219         $tmp = $this->get_allowed_bases();
220         if(isset($tmp[$this->dialog->isSelected()])){
221           $this->base = $this->dialog->isSelected();
222         }
223         $this->dialog= false;
224       }else{
225         return($this->dialog->execute());
226       }
227     }
229     /* Do we represent a valid terminal? */
230     if (!$this->is_account && $this->parent === NULL){
231       $display= "<img alt=\"\" src=\"images/small-error.png\" align=middle>&nbsp;<b>".
232         msgPool::noValidExtension(_("terminal"))."</b>";
233       return($display);
234     }
236     /* Add new ntp Server to our list */
237     if((isset($_POST['addNtpServer'])) && (isset($_POST['gotoNtpServers'])) && $this->acl_is_writeable("gotoNtpServer")){
238       $this->gotoNtpServer[$_POST['gotoNtpServers']] = $_POST['gotoNtpServers'];
239     }
241     /* Delete selected NtpServer for list of used servers  */
242     if((isset($_POST['delNtpServer'])) && (isset($_POST['gotoNtpServerSelected'])) && $this->acl_is_writeable("gotoNtpServer")){
243       foreach($_POST['gotoNtpServerSelected'] as $name){
244         unset($this->gotoNtpServer[$name]);
245       } 
246     }
248     /* Fill templating stuff */
249     $smarty= get_smarty();
250     
251     $tmp = $this->plInfo();
252     foreach($tmp['plProvidedAcls'] as $name => $translation){
253       $smarty->assign($name."ACL",$this->getacl($name));
254     }
256     $smarty->assign("cn", $this->cn);
257     $smarty->assign("description", $this->description);
258     $smarty->assign("staticAddress", "");
260     $smarty->assign("bases", $this->get_allowed_bases());
262     /* tell smarty the inherit checkbox state */
263     $smarty->assign("inheritTimeServer",$this->inheritTimeServer);
265     /* Check if terminal is online */
266     if (gosaSupportDaemon::ping($this->netConfigDNS->macAddress)){
267       $smarty->assign("actions", array( "halt" => _("Switch off"), 
268                                         "reboot" => _("Reboot"),
269                                         #"memcheck" => _("Memory test"),
270                                         #"sysinfo"  => _("System analysis")
271                                         ));
272     } else {
273       $smarty->assign("actions", array("wake" => _("Wake up"),
274                                        #"memcheck" => _("Memory test"),
275                                        #"sysinfo"  => _("System analysis")
276                                         ));
277     }
279     /* Arrays */
280     $smarty->assign("modes", $this->modes);
282     $tmp2 = array(); 
283     $tmp2['!']= _("Local swap");
284     foreach($this->config->data['SERVERS']['NBD'] as $server){
285       if($server != "default"){
286         $tmp2[$server]= $server;
287       }else{
288         if($this->member_of_ogroup){
289           $tmp2[$server]="["._("inherited")."]";
290         }
291       }
292     }
293   
294     $smarty->assign("swapservers",     $tmp2);
295     $tmp2 = array(); 
296     foreach($this->config->data['SERVERS']['NFS'] as $server){
297       if($server != "default"){
298         $tmp2[$server]= $server;
299       }else{
300         if($this->member_of_ogroup){
301           $tmp2[$server]="["._("inherited")."]";
302         }
303       }
304     }
305   
306     $smarty->assign("nfsservers",     $tmp2);
307     $smarty->assign("syslogservers",  $this->gotoSyslogServers);
309     $tmp = array();
310     foreach($this->gotoNtpServers as $server){
311       if(!in_array($server,$this->gotoNtpServer)){
312         $tmp[$server] = $server;
313       }
314     }
315     
316     $smarty->assign("ntpservers",     $tmp);
317     $smarty->assign("fai_activated",$this->fai_activated);
319     /* Variables */
320     foreach(array("base", "gotoMode", "gotoTerminalPath", "gotoSwapServer","gotoSyslogServer", "gotoNtpServer") as $val){
321       $smarty->assign($val."_select", $this->$val);
322     }
324     $smarty->assign("member_of_ogroup",$this->member_of_ogroup);
326     /* Show main page */
327     $str = $this->netConfigDNS->execute();
328     if(is_object($this->netConfigDNS->dialog)){
329       return($str);
330     }
331     $smarty->assign("netconfig", $str);
333     /* Display kerberos host key options */  
334     $smarty->assign("host_key","");
335     if(is_object($this->kerberos_key_service)){
336       $smarty->assign("host_key",$this->kerberos_key_service->execute_by_prefix("host/"));
337     }
339     return($smarty->fetch (get_template_path('terminal.tpl', TRUE, dirname(__FILE__))));
340   }
342   function remove_from_parent()
343   {
344     if($this->acl_is_removeable()){   
345       $ldap= $this->config->get_ldap_link();
346       $ldap->cd($this->dn);
347       $ldap->cat($this->dn, array('dn'));
348       if($ldap->count()){
349         $this->netConfigDNS->remove_from_parent();
350         $ldap->rmDir($this->dn);
351   
352         new log("remove","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
353   
354         if (!$ldap->success()){
355           msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class()));
356         }
358         /* Remove kerberos key dependencies too */
359         if(is_object($this->kerberos_key_service)){
360           $this->kerberos_key_service->remove_from_parent_by_prefix("host/");
361         }
363         /* Optionally execute a command after we're done */
364         $this->handle_post_events("remove",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
366         /* Delete references to object groups */
367         $ldap->cd ($this->config->current['BASE']);
368         $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
369         while ($ldap->fetch()){
370           $og= new ogroup($this->config, $ldap->getDN());
371           unset($og->member[$this->dn]);
372           $og->save ();
373         }
375         /* Remove all accessTo/trust dependencies */
376         update_accessTo($this->cn,"");
377       }
379       /* Clean queue form entries with this mac 
380        */
381       if(class_available("gosaSupportDaemon") && tests::is_mac($this->netConfigDNS->orig_macAddress)){
382         $q = new gosaSupportDaemon();
383         $q->clean_queue_from_mac($this->netConfigDNS->orig_macAddress);
384       }
385     }
386   }
389   /* Save data to object */
390   function save_object()
391   {
392     /* Create a base backup and reset the
393        base directly after calling plugin::save_object();
394        Base will be set seperatly a few lines below */
395     $base_tmp = $this->base;
396     plugin::save_object();
397     $this->base = $base_tmp;
399     /* Set new base if allowed */
400     $tmp = $this->get_allowed_bases();
401     if(isset($_POST['base'])){
402       if(isset($tmp[$_POST['base']])){
403         $this->base= $_POST['base'];
404       }
405     }
406     
407     $this->netConfigDNS->save_object();
409     /* Save terminal path to parent since it is used by termstartup, too */
410     if(isset($this->parent->by_object['termstartup'])){
411       $this->parent->by_object['termstartup']->gotoTerminalPath= $this->gotoTerminalPath;
412     }
413     
414     if(isset($_POST['termgeneric_posted'])){
415       if(isset($_POST["inheritTimeServer"]) && $this->member_of_ogroup){
416         $this->inheritTimeServer = true;
417       }else{
418         $this->inheritTimeServer = false;
419       }
420     }  
422     if(isset($_POST["inheritAll"])){
423       $this->set_everything_to_inherited();
424     }
426     /* Hanle kerberos host key plugin */
427     if(is_object($this->kerberos_key_service)){
428       $this->kerberos_key_service->save_object_by_prefix("host/");
429     }
430   }
433   /* Check supplied data */
434   function check()
435   {
436     /* Call common method to give check the hook */
437     $message= plugin::check();
439     /* Skip IP & Mac checks if this is a template */
440     if($this->cn != "default"){
441       $message= array_merge($message, $this->netConfigDNS->check());
442     }
444     /* Permissions for that base? */
445     $this->dn= "cn=".$this->cn.",".get_ou('terminalRDN').$this->base;
447     if ($this->cn == ""){
448       $message[]= msgPool::required(_("Name"));
449     }
451     /* Check if given name is a valid host/dns name */
452     if(!tests::is_dns_name($this->cn) ){
453       $message[] = msgPool::invalid(_("Name"));
454     }
456     if ($this->orig_dn == 'new'){
457       $ldap= $this->config->get_ldap_link();
458       $ldap->cd ($this->base);
460       /* It is possible to have a 'default' terminal on every base */
461       if($this->cn == "default"){
462         $ldap->cat($this->dn);
463       }else{
464         $ldap->search ("(&(objectClass=gotoTerminal)(cn=".$this->cn."))", array("cn"));
465       }
466       if ($ldap->count() != 0){
467         while ($attrs= $ldap->fetch()){
468           if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".preg_quote(get_ou('systemIncomingRDN'), '/')."/", $ldap->getDN())){
469             continue;
470           } else {
471             if ($attrs['dn'] != $this->orig_dn){
472               $message[]= msgPool::duplicated(_("Name"));
473               break;
474             }
475           }
476         }
477       }
478     }
480     /* Check for valid ntpServer selection */
481     if((!$this->inheritTimeServer) && (!count($this->gotoNtpServer))){
482       $message[]= msgPool::required(_("NTP server"));
483     }
485     /* Check if we are allowed to create or move this object
486      */
487     if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){
488       $message[] = msgPool::permCreate();
489     }elseif($this->orig_dn != "new" && $this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){
490       $message[] = msgPool::permMove();
491     }
493     return ($message);
494   }
497   /* Save to LDAP */
498   function save()
499   {
500     /* Detect mode changes */
501     $activate= (isset($this->saved_attributes['gotoMode']) &&
502         $this->gotoMode != $this->saved_attributes['gotoMode'] &&
503         $this->gotoMode == "active" &&
504         tests::is_ip($this->netConfigDNS->ipHostNumber)) || $this->auto_activate;
505     plugin::save();
507     /* Strip out 'default' values */
508     foreach (array("gotoTerminalPath", "gotoSwapServer", "gotoSyslogServer") as $val){
509       if(isset($this->attrs[$val])){
510         if ($this->attrs[$val] == "default"){
511           $this->attrs[$val]= array();
512         }
513       }
514     }
516     /* Add missing arrays */
517     foreach (array("ghScsiDev", "ghIdeDev", "ghNetNic") as $val){
518       if (isset ($this->$val) && count ($this->$val) != 0){
519         $this->attrs["$val"]= $this->$val;
520       }
521     }
523     /* Remove all empty values */
524     if ($this->orig_dn == 'new'){
525       $attrs= array();
526       foreach ($this->attrs as $key => $val){
527         if (is_array($val) && count($val) == 0){
528           continue;
529         }
530         $attrs[$key]= $val;
531       }
532       $this->attrs= $attrs;
533     }
535     /* Set ntpServers */
536     $this->attrs['gotoNtpServer'] = array();
537     if(!$this->inheritTimeServer){
538       foreach($this->gotoNtpServer as $server){
539         $this->attrs['gotoNtpServer'][] = $server;
540       }
541     }
543     /* cn=default and macAddress=- indicates that this is a template */
544     if($this->cn == "default"){
545       $this->netConfigDNS->macAddress = "-";
546     }
548     /* Write back to ldap */
549     $ldap= $this->config->get_ldap_link();
550     if ($this->orig_dn == 'new'){
551       $ldap->cd($this->config->current['BASE']);
552       $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
553       $ldap->cd($this->dn);
554       if (!count($this->attrs['gotoNtpServer'])){
555         unset($this->attrs['gotoNtpServer']);
556       }
557       $ldap->add($this->attrs);
558       new log("create","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
560       $this->netConfigDNS->cn = $this->cn;
561       $this->netConfigDNS->save();
563       $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
564     } else {
565       $ldap->cd($this->dn);
566       $this->cleanup();
567       $ldap->modify ($this->attrs); 
568       new log("modify","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
570       $this->netConfigDNS->cn = $this->cn;
571       $this->netConfigDNS->save();
573       $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
575       /* Update all accessTo/trust dependencies */
576       if($this->orig_cn != $this->cn){
577         update_accessTo($this->orig_cn,$this->cn);
578       }
579     }
580     
581     if (!$ldap->success()){
582       msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
583     }
585     /* Send installation activation
586      */
587     if ($activate && class_available("DaemonEvent")){
588       $events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);
589       $o_queue = new gosaSupportDaemon();
590       if(isset($events['TRIGGERED']['DaemonEvent_installation_activation'])){
591         $evt = $events['TRIGGERED']['DaemonEvent_installation_activation'];
592         $tmp = new $evt['CLASS_NAME']($this->config);
593         $tmp->set_type(TRIGGERED_EVENT);
594         $tmp->add_targets(array($this->netConfigDNS->macAddress));
595         if(!$o_queue->append($tmp)){
596           msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
597         }
598       }
599     }
600   }
603   /* Display generic part for server copy & paste */
604   function getCopyDialog()
605   {
606     $vars = array("cn");
607     $smarty = get_smarty();
608     $smarty->assign("cn" ,$this->cn);
609     $smarty->assign("object","terminal");
610     $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
611     $ret = array();
612     $ret['string'] = $str;
613     $ret['status'] = "";
614     return($ret);
615   }
618   function saveCopyDialog()
619   {
620     if(isset($_POST['cn'])){
621       $this->cn = $_POST['cn'];
622     }
623   }
626   function PrepareForCopyPaste($source)
627   {
628     plugin::PrepareForCopyPaste($source);
629     if(isset($source['macAddress'][0])){
630       $this->netConfigDNS->macAddress = $source['macAddress'][0];
631     }
632     if(isset($source['ipHostNumber'][0])){
633       $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
634     }
636     /* Create used ntp server array */
637     $this->gotoNtpServer= array();
638     if(isset($source['gotoNtpServer'])){
639       $this->inheritTimeServer = false;
640       unset($source['gotoNtpServer']['count']);
641       foreach($source['gotoNtpServer'] as $server){
642         $this->gotoNtpServer[$server] = $server;
643       }
644     }
646     /* Set inherit checkbox state */
647     if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer)==0)){
648       $this->inheritTimeServer = true;
649       $this->gotoNtpServer=array();
650     }
652     $source_o = new termgeneric($this->config, $source['dn']);
653     foreach (array('ghIdeDev', 'ghNetNic', 'ghScsiDev') as $attr) {
654       if (isset($source_o->$attr)) {
655         $this->$attr = $source_o->$attr;
656       }
657     }
659     $ldap = $this->config->get_ldap_link();
660     $res = $ldap->cat($source['dn'], array('gotoHardwareChecksum', 'gotoSysStatus'));
661     if ($res) {
662       $attrs = $ldap->fetch();
663       foreach(array('gotoHardwareChecksum', 'gotoSysStatus') as $attr) {
664         if (isset($attrs[$attrs])) {
665             $this->$attr = $attrs[$attr][0];
666         }
667       }
668     }
669   }
672   /* Return plugin informations for acl handling */
673   static function plInfo()
674   {
675     return (array(
676           "plShortName"   => _("Terminal"),
677           "plDescription" => _("Terminal generic"),
678           "plSelfModify"  => FALSE,
679           "plDepends"     => array(),
680           "plPriority"    => 1,
681           "plSection"     => array("administration"),
682           "plCategory"    => array("terminal" => array( "description"  => _("Terminal"),
683               "objectClass"  => "gotoTerminal")),
684           "plProvidedAcls"=> array(
685             "cn"                  => _("Name"),
686             "description"         => _("Description"),
687             "base"                => _("Base"),
689             "gotoMode"            => _("Mode"),
690             "gotoSyslogServer"    => _("Syslog server enabled"),
692             "gotoTerminalPath"    => _("Root server"),
693             "gotoSwapServer"      => _("Swap server"),
695             "gotoNtpServer"       => _("Ntp server settings"),
696             "userPassword"      => _("Root password"),
698             "FAIstate"            => _("Action flag"))
699           ));
700   }
703   function set_everything_to_inherited()
704   {
705     $this->gotoTerminalPath  = "default";
706     $this->gotoSwapServer    = "default" ;
707     $this->gotoSyslogServer  = "default";
708     $this->inheritTimeServer = TRUE;
710     /* Set workstation service attributes to inherited */
711     if($this->member_of_ogroup && isset($this->parent->by_object['termservice'])){
712       foreach(array("gotoXKbLayout","gotoXKbModel","gotoXKbVariant",
713             "gotoXResolution","gotoXColordepth","gotoXMouseType","gotoXMouseport") as $name){
714         $this->parent->by_object['termservice']->$name = "default";
715       }
716     }
718     /* Set workstation startup attributes to inherited */
719     if($this->member_of_ogroup && isset($this->parent->by_object['termstartup'])){
720       $this->parent->by_object['termstartup']->gotoBootKernel = "default-inherited";
721       $this->parent->by_object['termstartup']->gotoLdapServer = "default-inherited";
723       $this->parent->by_object['workstartup']->gotoLdap_inherit = TRUE;
724       $this->parent->by_object['workstartup']->gotoLdapServers = array();
725     }
726   }
729 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
730 ?>