Code

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