Code

updated templates
[gosa.git] / 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 $gotoLastUser= "-";
25   var $netConfigDNS;
26   var $auto_activate= FALSE;
27   
28   /* Needed values and lists */
29   var $base= "";
30   var $cn= "";
31   var $description= "";
32   var $orig_dn= "";
33   var $orig_cn= "";
34   var $orig_base= "";
36   var $inheritTimeServer = true;
38   /* Plugin side filled */
39   var $modes= array();
40   var $baseSelector;
42   /* attribute list for save action */
43   var $ignore_account= TRUE;
44   var $attributes= array("gotoMode", "gotoTerminalPath", 
45       "gotoSwapServer", "gotoSyslogServer", "gotoNtpServer",
46       "gotoFloppyEnable", "gotoCdromEnable", "cn", "gotoSndModule",
47       "ghCpuType", "ghMemSize","ghUsbSupport", "description",
48       "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser");
49   var $objectclasses= array("top", "gotoTerminal", "GOhard");
51   var $validActions   = array("reboot" => "", "rescan" => "", "wake" => "", "memcheck" => "", "sysinfo" => "");
53   var $fai_activated = FALSE;
54   var $view_logged = FALSE;
56   var $member_of_ogroup = FALSE;
58   var $kerberos_key_service = NULL;
61   function termgeneric (&$config, $dn= NULL, $parent= NULL)
62   {
63     /* Check if FAI is activated */
64     $tmp= $config->search("faiManagement", "CLASS",array('menu','tabs'));
65     if(!empty($tmp)){
66       $this->fai_activated = TRUE;
67     }
69     plugin::plugin ($config, $dn, $parent);
71     if(class_available("krbHostKeys")){
72       $this->kerberos_key_service = new krbHostKeys($this->config,$this);
73     }
75     if(!isset($this->parent->by_object['ogroup'])){
76       $ldap = $this->config->get_ldap_link();
77       $ldap->cd ($this->config->current['BASE']);
78       $ldap->search("(&(|(objectClass=gotoTerminalTemplate)(objectClass=gotoWorkstationTemplate))(member=".LDAP::prepare4filter($this->dn)."))",array("cn"));
79       $this->member_of_ogroup = $ldap->count() >= 1;
80     }
82     $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses);
83     $this->netConfigDNS->MACisMust =TRUE;
85     /* Read arrays */
86     foreach (array("ghNetNic", "ghIdeDev", "ghScsiDev") as $val){
87       if (!isset($this->attrs[$val])){
88         continue;
89       }
90       for ($i= 0; $i<$this->attrs[$val]['count']; $i++){
91         array_push($this->$val, $this->attrs[$val][$i]);
92       }
93     }
95     /* Create used ntp server array */
96     $this->gotoNtpServer= array();
97     if(isset($this->attrs['gotoNtpServer'])){
98       $this->inheritTimeServer = false;
99       for($i = 0 ; $i < $this->attrs['gotoNtpServer']['count']; $i++ ){
100         $server = $this->attrs['gotoNtpServer'][$i];
101         $this->gotoNtpServer[$server] = $server;
102       }
103     }
105     /* Set inherit checkbox state */
106     if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer)==0)){
107       $this->inheritTimeServer = true;
108       $this->gotoNtpServer=array();
109     }
111     /* You can't inherit the NTP service, if we are not member in an object group */
112     if(!$this->member_of_ogroup){
113       $this->inheritTimeServer = FALSE;
114     }
116     /* Create available ntp options */
117     $this->gotoNtpServers = $this->config->data['SERVERS']['NTP'];
118     foreach($this->gotoNtpServers as $key => $server){
119       if($server == "default"){
120         unset($this->gotoNtpServers[$key]);
121       }
122     }
124     $this->modes["locked"]= _("Locked");
125     $this->modes["active"]= _("Activated");
127     /* Set base */
128     if ($this->dn == "new"){
129       $ui= get_userinfo();
130       $this->base= dn2base(session::global_is_set("CurrentMainBase")?"cn=dummy,".session::global_get("CurrentMainBase"):$ui->dn);
131     } elseif(preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/i", $this->dn)){
132       $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("systemIncomingRDN"), '/')."/i", "", $this->dn);
133     } else {
134       $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("terminalRDN"), '/')."/i", "", $this->dn);
135     }
137     /* Create an array of all Syslog servers */
138     $tmp = $this->config->data['SERVERS']['SYSLOG'];
139     foreach($tmp as $server){
140       $visible = $server;
141       if($server == "default" && $this->member_of_ogroup) {
142         $visible = "["._("inherited")."]";
143       }
144       $this->gotoSyslogServers[$server] = $visible;
145     }
147     $this->orig_dn= $this->dn;
148     $this->orig_cn= $this->cn;
149     $this->orig_base= $this->base;
151     /* Instanciate base selector */
152     $this->baseSelector= new baseSelector($this->get_allowed_bases(), $this->base);
153     $this->baseSelector->setSubmitButton(false);
154     $this->baseSelector->setHeight(300);
155     $this->baseSelector->update(true);
156   }
158   function set_acl_base($base)
159   {
160     plugin::set_acl_base($base);
161     $this->netConfigDNS->set_acl_base($base);
162   }
164   function set_acl_category($cat)
165   {
166     plugin::set_acl_category($cat);
167     $this->netConfigDNS->set_acl_category($cat);
168   }
170   function execute()
171   {
172     /* Call parent execute */
173     plugin::execute();
175     if($this->is_account && !$this->view_logged){
176       $this->view_logged = TRUE;
177       new log("view","terminal/".get_class($this),$this->dn);
178     }
180     /* Do we need to flip is_account state? */
181     if (isset($_POST['modify_state'])){
182       $this->is_account= !$this->is_account;
183     }
185     if (isset($_POST['action']) && $this->acl_is_writeable("FAIstate") && isset($this->validActions[$_POST['saction']])){
186       $action = $_POST['saction'];
188       /* Check if we have an DaemonEvent for this action */
189       if(class_available("DaemonEvent_".$action)){
190         $events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);
191         if(isset($events['TRIGGERED']["DaemonEvent_".$action])){
192           $evt = $events['TRIGGERED']["DaemonEvent_".$action];
193           $tmp = new $evt['CLASS_NAME']($this->config);
194           $tmp->add_targets(array($this->netConfigDNS->macAddress));
195           $tmp->set_type(TRIGGERED_EVENT);
196           $o_queue = new gosaSupportDaemon();
197           if(!$o_queue->append($tmp)){
198             msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
199           }
200         }
201       }else{
202         msg_dialog::display(_("Event error"),
203                     sprintf(_("Event '%s' is not available!"),$action),ERROR_DIALOG);
204       }
206     }
208     /* Do we represent a valid terminal? */
209     if (!$this->is_account && $this->parent === NULL){
210       $display= "<img alt=\"\" src=\"images/small-error.png\" align=middle>&nbsp;<b>".
211         msgPool::noValidExtension(_("terminal"))."</b>";
212       return($display);
213     }
215     /* Add new ntp Server to our list */
216     if((isset($_POST['addNtpServer'])) && (isset($_POST['gotoNtpServers'])) && $this->acl_is_writeable("gotoNtpServer")){
217       $this->gotoNtpServer[$_POST['gotoNtpServers']] = $_POST['gotoNtpServers'];
218     }
220     /* Delete selected NtpServer for list of used servers  */
221     if((isset($_POST['delNtpServer'])) && (isset($_POST['gotoNtpServerSelected'])) && $this->acl_is_writeable("gotoNtpServer")){
222       foreach($_POST['gotoNtpServerSelected'] as $name){
223         unset($this->gotoNtpServer[$name]);
224       } 
225     }
227     /* Fill templating stuff */
228     $smarty= get_smarty();
229     $smarty->assign("usePrototype", "true");
230     
231     $tmp = $this->plInfo();
232     foreach($tmp['plProvidedAcls'] as $name => $translation){
233       $smarty->assign($name."ACL",$this->getacl($name));
234     }
236     $smarty->assign("cn", $this->cn);
237     $smarty->assign("description", $this->description);
239     /* tell smarty the inherit checkbox state */
240     $smarty->assign("inheritTimeServer",$this->inheritTimeServer);
242     /* Check if terminal is online */
243     if (gosaSupportDaemon::ping($this->netConfigDNS->macAddress)){
244       $smarty->assign("actions", array( "halt" => _("Switch off"), 
245                                         "reboot" => _("Reboot"),
246                                         #"memcheck" => _("Memory test"),
247                                         #"sysinfo"  => _("System analysis")
248                                         ));
249     } else {
250       $smarty->assign("actions", array("wake" => _("Wake up"),
251                                        #"memcheck" => _("Memory test"),
252                                        #"sysinfo"  => _("System analysis")
253                                         ));
254     }
256     /* Arrays */
257     $smarty->assign("modes", $this->modes);
259     $tmp2 = array(); 
260     $tmp2['!']= _("Local swap");
261     foreach($this->config->data['SERVERS']['NBD'] as $server){
262       if($server != "default"){
263         $tmp2[$server]= $server;
264       }else{
265         if($this->member_of_ogroup){
266           $tmp2[$server]="["._("inherited")."]";
267         }
268       }
269     }
270   
271     $smarty->assign("swapservers",     $tmp2);
272     $tmp2 = array(); 
273     foreach($this->config->data['SERVERS']['NFS'] as $server){
274       if($server != "default"){
275         $tmp2[$server]= $server;
276       }else{
277         if($this->member_of_ogroup){
278           $tmp2[$server]="["._("inherited")."]";
279         }
280       }
281     }
282   
283     $smarty->assign("nfsservers",     $tmp2);
284     $smarty->assign("syslogservers",  $this->gotoSyslogServers);
286     $tmp = array();
287     foreach($this->gotoNtpServers as $server){
288       if(!in_array($server,$this->gotoNtpServer)){
289         $tmp[$server] = $server;
290       }
291     }
292     
293     $smarty->assign("ntpservers",     $tmp);
294     $smarty->assign("fai_activated",$this->fai_activated);
296     /* Variables */
297     foreach(array("gotoMode", "gotoTerminalPath", "gotoSwapServer","gotoSyslogServer", "gotoNtpServer") as $val){
298       $smarty->assign($val."_select", $this->$val);
299     }
300     $smarty->assign("base", $this->baseSelector->render());
302     $smarty->assign("member_of_ogroup",$this->member_of_ogroup);
304     /* Show main page */
305     $str = $this->netConfigDNS->execute();
306     if(is_object($this->netConfigDNS->dialog)){
307       return($str);
308     }
309     $smarty->assign("netconfig", $str);
311     /* Display kerberos host key options */  
312     $smarty->assign("host_key","");
313     if(is_object($this->kerberos_key_service)){
314       $smarty->assign("host_key",$this->kerberos_key_service->execute_by_prefix("host/"));
315     }
317     return($smarty->fetch (get_template_path('terminal.tpl', TRUE, dirname(__FILE__))));
318   }
320   function remove_from_parent()
321   {
322     if($this->acl_is_removeable()){   
323       $ldap= $this->config->get_ldap_link();
324       $ldap->cd($this->dn);
325       $ldap->cat($this->dn, array('dn'));
326       if($ldap->count()){
327         $this->netConfigDNS->remove_from_parent();
328         $ldap->rmDir($this->dn);
329   
330         new log("remove","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
331   
332         if (!$ldap->success()){
333           msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class()));
334         }
336         /* Remove kerberos key dependencies too */
337         if(is_object($this->kerberos_key_service)){
338           $this->kerberos_key_service->remove_from_parent_by_prefix("host/");
339         }
341         /* Optionally execute a command after we're done */
342         $this->handle_post_events("remove",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
344         /* Delete references to object groups */
345         $ldap->cd ($this->config->current['BASE']);
346         $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
347         while ($ldap->fetch()){
348           $og= new ogroup($this->config, $ldap->getDN());
349           unset($og->member[$this->dn]);
350           $og->save ();
351         }
353         /* Remove all accessTo/trust dependencies */
354         update_accessTo($this->cn,"");
355       }
357       /* Clean queue form entries with this mac 
358        */
359       if(class_available("gosaSupportDaemon") && tests::is_mac($this->netConfigDNS->orig_macAddress)){
360         $q = new gosaSupportDaemon();
361         $q->clean_queue_from_mac($this->netConfigDNS->orig_macAddress);
362       }
363     }
364   }
367   /* Save data to object */
368   function save_object()
369   {
370     /* Create a base backup and reset the
371        base directly after calling plugin::save_object();
372        Base will be set seperatly a few lines below */
373     $base_tmp = $this->base;
374     plugin::save_object();
375     $this->base = $base_tmp;
377     /* Refresh base */
378     if ($this->acl_is_moveable($this->base)){
379       if (!$this->baseSelector->update()) {
380         msg_dialog::display(_("Error"), msgPool::permMove(), ERROR_DIALOG);
381       }
382       if ($this->base != $this->baseSelector->getBase()) {
383         $this->base= $this->baseSelector->getBase();
384         $this->is_modified= TRUE;
385       }
386     }
387     
388     $this->netConfigDNS->save_object();
390     /* Save terminal path to parent since it is used by termstartup, too */
391     if(isset($this->parent->by_object['termstartup'])){
392       $this->parent->by_object['termstartup']->gotoTerminalPath= $this->gotoTerminalPath;
393     }
394     
395     if(isset($_POST['termgeneric_posted'])){
396       if(isset($_POST["inheritTimeServer"]) && $this->member_of_ogroup){
397         $this->inheritTimeServer = true;
398       }else{
399         $this->inheritTimeServer = false;
400       }
401     }  
403     if(isset($_POST["inheritAll"])){
404       $this->set_everything_to_inherited();
405     }
407     /* Hanle kerberos host key plugin */
408     if(is_object($this->kerberos_key_service)){
409       $this->kerberos_key_service->save_object_by_prefix("host/");
410     }
411   }
414   /* Check supplied data */
415   function check()
416   {
417     /* Call common method to give check the hook */
418     $message= plugin::check();
420     /* Skip IP & Mac checks if this is a template */
421     if($this->cn != "default"){
422       $message= array_merge($message, $this->netConfigDNS->check());
423     }
425     /* Permissions for that base? */
426     $this->dn= "cn=".$this->cn.",".get_ou('terminalRDN').$this->base;
428     if ($this->cn == ""){
429       $message[]= msgPool::required(_("Name"));
430     }
432     // Check if a wrong base was supplied
433     if(!$this->baseSelector->checkLastBaseUpdate()){
434       $message[]= msgPool::check_base();
435     }
437     /* Check if given name is a valid host/dns name */
438     if(!tests::is_dns_name($this->cn) ){
439       $message[] = msgPool::invalid(_("Name"));
440     }
442     if ($this->orig_dn == 'new'){
443       $ldap= $this->config->get_ldap_link();
444       $ldap->cd ($this->base);
446       /* It is possible to have a 'default' terminal on every base */
447       if($this->cn == "default"){
448         $ldap->cat($this->dn);
449       }else{
450         $ldap->search ("(&(objectClass=gotoTerminal)(cn=".$this->cn."))", array("cn"));
451       }
452       if ($ldap->count() != 0){
453         while ($attrs= $ldap->fetch()){
454           if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".preg_quote(get_ou('systemIncomingRDN'), '/')."/i", $ldap->getDN())){
455             continue;
456           } else {
457             if ($attrs['dn'] != $this->orig_dn){
458               $message[]= msgPool::duplicated(_("Name"));
459               break;
460             }
461           }
462         }
463       }
464     }
466     /* Check for valid ntpServer selection */
467     if((!$this->inheritTimeServer) && (!count($this->gotoNtpServer))){
468       $message[]= msgPool::required(_("NTP server"));
469     }
471     /* Check if we are allowed to create or move this object
472      */
473     if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){
474       $message[] = msgPool::permCreate();
475     }elseif($this->orig_dn != "new" && $this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){
476       $message[] = msgPool::permMove();
477     }
479     return ($message);
480   }
483   /* Save to LDAP */
484   function save()
485   {
486     /* Detect mode changes */
487     $activate= (isset($this->saved_attributes['gotoMode']) &&
488         $this->gotoMode != $this->saved_attributes['gotoMode'] &&
489         $this->gotoMode == "active" &&
490         tests::is_ip($this->netConfigDNS->ipHostNumber)) || $this->auto_activate;
492     /* Find proper terminal path for tftp configuration
493        FIXME: This is suboptimal when the default has changed to
494        another location! */
495     if ($this->gotoTerminalPath == "default"){
496       $ldap= $this->config->get_ldap_link();
498       /* Strip relevant part from dn, keep trailing ',' */
499       $tmp= preg_replace("/^cn=[^,]+,".preg_quote(get_ou('terminalRDN'), '/')."/i", "", $this->dn);
500       $tmp= preg_replace("/".$this->config->current['BASE']."$/i", "", $tmp);
502       /* Walk from top to base and try to load default values for
503          'gotoTerminalPath'. Abort when an entry is found. */
504       while (TRUE){
505         $tmp= preg_replace ("/^[^,]+,/", "", $tmp);
507         $ldap->cat("cn=default,".get_ou('terminalRDN').$tmp.
508             $this->config->current['BASE'], array('gotoTerminalPath'));
509         $attrs= $ldap->fetch();
510         if (isset($attrs['gotoTerminalPath'])){
511           $this->gotoTerminalPath= $attrs['gotoTerminalPath'][0];
512           break;
513         }
515         /* Nothing left? */
516         if ($tmp == ""){
517           break;
518         }
519       }
520     }
522     plugin::save();
524     /* Strip out 'default' values */
525     foreach (array("gotoTerminalPath", "gotoSwapServer", "gotoSyslogServer") as $val){
526       if(isset($this->attrs[$val])){
527         if ($this->attrs[$val] == "default"){
528           $this->attrs[$val]= array();
529         }
530       }
531     }
533     /* Add missing arrays */
534     foreach (array("ghScsiDev", "ghIdeDev", "ghNetNic") as $val){
535       if (isset ($this->$val) && count ($this->$val) != 0){
536         $this->attrs["$val"]= $this->$val;
537       }
538     }
540     /* Remove all empty values */
541     if ($this->orig_dn == 'new'){
542       $attrs= array();
543       foreach ($this->attrs as $key => $val){
544         if (is_array($val) && count($val) == 0){
545           continue;
546         }
547         $attrs[$key]= $val;
548       }
549       $this->attrs= $attrs;
550     }
552     /* Set ntpServers */
553     $this->attrs['gotoNtpServer'] = array();
554     if(!$this->inheritTimeServer){
555       foreach($this->gotoNtpServer as $server){
556         $this->attrs['gotoNtpServer'][] = $server;
557       }
558     }
560     /* cn=default and macAddress=- indicates that this is a template */
561     if($this->cn == "default"){
562       $this->netConfigDNS->macAddress = "-";
563     }
565     /* Write back to ldap */
566     $ldap= $this->config->get_ldap_link();
567     if ($this->orig_dn == 'new'){
568       $ldap->cd($this->config->current['BASE']);
569       $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
570       $ldap->cd($this->dn);
571       if (!count($this->attrs['gotoNtpServer'])){
572         unset($this->attrs['gotoNtpServer']);
573       }
574       $ldap->add($this->attrs);
575       new log("create","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
577       $this->netConfigDNS->cn = $this->cn;
578       $this->netConfigDNS->save();
580       $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
581     } else {
582       $ldap->cd($this->dn);
583       $this->cleanup();
584       $ldap->modify ($this->attrs); 
585       new log("modify","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
587       $this->netConfigDNS->cn = $this->cn;
588       $this->netConfigDNS->save();
590       $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
592       /* Update all accessTo/trust dependencies */
593       if($this->orig_cn != $this->cn){
594         update_accessTo($this->orig_cn,$this->cn);
595       }
596     }
597     
598     if (!$ldap->success()){
599       msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
600     }
602     /* Send installation activation
603      */
604     if ($activate && class_available("DaemonEvent")){
605       $events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);
606       $o_queue = new gosaSupportDaemon();
607       if(isset($events['TRIGGERED']['DaemonEvent_installation_activation'])){
608         $evt = $events['TRIGGERED']['DaemonEvent_installation_activation'];
609         $tmp = new $evt['CLASS_NAME']($this->config);
610         $tmp->set_type(TRIGGERED_EVENT);
611         $tmp->add_targets(array($this->netConfigDNS->macAddress));
612         if(!$o_queue->append($tmp)){
613           msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
614         }
615       }
616     }
617   }
620   /* Display generic part for server copy & paste */
621   function getCopyDialog()
622   {
623     $vars = array("cn");
624     $smarty = get_smarty();
625     $smarty->assign("cn" ,$this->cn);
626     $smarty->assign("object","terminal");
627     $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
628     $ret = array();
629     $ret['string'] = $str;
630     $ret['status'] = "";
631     return($ret);
632   }
635   function saveCopyDialog()
636   {
637     if(isset($_POST['cn'])){
638       $this->cn = $_POST['cn'];
639     }
640   }
643   function PrepareForCopyPaste($source)
644   {
645     plugin::PrepareForCopyPaste($source);
646     if(isset($source['macAddress'][0])){
647       $this->netConfigDNS->macAddress = $source['macAddress'][0];
648     }
649     if(isset($source['ipHostNumber'][0])){
650       $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
651     }
653     /* Create used ntp server array */
654     $this->gotoNtpServer= array();
655     if(isset($source['gotoNtpServer'])){
656       $this->inheritTimeServer = false;
657       unset($source['gotoNtpServer']['count']);
658       foreach($source['gotoNtpServer'] as $server){
659         $this->gotoNtpServer[$server] = $server;
660       }
661     }
663     /* Set inherit checkbox state */
664     if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer)==0)){
665       $this->inheritTimeServer = true;
666       $this->gotoNtpServer=array();
667     }
668   }
671   /* Return plugin informations for acl handling */
672   static function plInfo()
673   {
674     return (array(
675           "plShortName"   => _("Terminal"),
676           "plDescription" => _("Terminal generic"),
677           "plSelfModify"  => FALSE,
678           "plDepends"     => array(),
679           "plPriority"    => 1,
680           "plSection"     => array("administration"),
681           "plCategory"    => array("terminal" => array( "description"  => _("Terminal"),
682               "objectClass"  => "gotoTerminal")),
683           "plProvidedAcls"=> array(
684             "cn"                  => _("Name"),
685             "description"         => _("Description"),
686             "base"                => _("Base"),
688             "gotoMode"            => _("Mode"),
689             "gotoSyslogServer"    => _("Syslog server enabled"),
691             "gotoTerminalPath"    => _("Root server"),
692             "gotoSwapServer"      => _("Swap server"),
694             "gotoNtpServer"       => _("Ntp server settings"),
695             "userPassword"      => _("Root password"),
697             "FAIstate"            => _("Action flag"))
698           ));
699   }
702   function set_everything_to_inherited()
703   {
704     $this->gotoTerminalPath  = "default";
705     $this->gotoSwapServer    = "default" ;
706     $this->gotoSyslogServer  = "default";
707     $this->inheritTimeServer = TRUE;
709     /* Set workstation service attributes to inherited */
710     if($this->member_of_ogroup && isset($this->parent->by_object['termservice'])){
711       foreach(array("gotoXKbLayout","gotoXKbModel","gotoXKbVariant","gotoXDriver",
712             "gotoXResolution","gotoXColordepth","gotoXMouseType","gotoXMouseport") as $name){
713         $this->parent->by_object['termservice']->$name = "default";
714       }
715     }
717     /* Set workstation startup attributes to inherited */
718     if($this->member_of_ogroup && isset($this->parent->by_object['termstartup'])){
719       $this->parent->by_object['termstartup']->gotoBootKernel = "default-inherited";
720       $this->parent->by_object['termstartup']->gotoLdapServer = "default-inherited";
721       $this->parent->by_object['termstartup']->gotoLdap_inherit = TRUE;
722       $this->parent->by_object['termstartup']->gotoLdapServers = array();
723     }
724   }
727   function is_modal_dialog()
728   {
729     return((isset($this->dialog) && $this->dialog) || (isset($this->netConfigDNS->dialog) && $this->netConfigDNS->dialog));
730   }
734 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
735 ?>