Code

added migration classes for RDN properties
[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     $this->fai_activated = $config->pluginEnabled("faiManagement");
66     plugin::plugin ($config, $dn, $parent);
68     if(class_available("krbHostKeys")){
69       $this->kerberos_key_service = new krbHostKeys($this->config,$this);
70     }
72     if(!isset($this->parent->by_object['ogroup'])){
73       $ldap = $this->config->get_ldap_link();
74       $ldap->cd ($this->config->current['BASE']);
75       $ldap->search("(&(|(objectClass=gotoTerminalTemplate)(objectClass=gotoWorkstationTemplate))(member=".LDAP::prepare4filter($this->dn)."))",array("cn"));
76       $this->member_of_ogroup = $ldap->count() >= 1;
77     }
79     $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses);
80     $this->netConfigDNS->MACisMust =TRUE;
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(session::global_is_set("CurrentMainBase")?"cn=dummy,".session::global_get("CurrentMainBase"):$ui->dn);
128     } elseif(preg_match("/".preg_quote(get_ou("ArpNewDevice", "systemIncomingRDN"), '/')."/i", $this->dn)){
129       $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("ArpNewDevice", "systemIncomingRDN"), '/')."/i", "", $this->dn);
130     } else {
131       $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("termgeneric", "terminalRDN"), '/')."/i", "", $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;
148     /* Instanciate base selector */
149     $this->baseSelector= new baseSelector($this->get_allowed_bases(), $this->base);
150     $this->baseSelector->setSubmitButton(false);
151     $this->baseSelector->setHeight(300);
152     $this->baseSelector->update(true);
153   }
155   function set_acl_base($base)
156   {
157     plugin::set_acl_base($base);
158     $this->netConfigDNS->set_acl_base($base);
159   }
161   function set_acl_category($cat)
162   {
163     plugin::set_acl_category($cat);
164     $this->netConfigDNS->set_acl_category($cat);
165   }
167   function execute()
168   {
169     /* Call parent execute */
170     plugin::execute();
172     if($this->is_account && !$this->view_logged){
173       $this->view_logged = TRUE;
174       new log("view","terminal/".get_class($this),$this->dn);
175     }
177     /* Do we need to flip is_account state? */
178     if (isset($_POST['modify_state'])){
179       $this->is_account= !$this->is_account;
180     }
182     if (isset($_POST['action']) && $this->acl_is_writeable("FAIstate") && isset($this->validActions[$_POST['saction']])){
183       $action = $_POST['saction'];
185       /* Check if we have an DaemonEvent for this action */
186       if(class_available("DaemonEvent_".$action)){
187         $events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);
188         if(isset($events['TRIGGERED']["DaemonEvent_".$action])){
189           $evt = $events['TRIGGERED']["DaemonEvent_".$action];
190           $tmp = new $evt['CLASS_NAME']($this->config);
191           $tmp->add_targets(array($this->netConfigDNS->macAddress));
192           $tmp->set_type(TRIGGERED_EVENT);
193           $o_queue = new gosaSupportDaemon();
194           if(!$o_queue->append($tmp)){
195             msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
196           }
197         }
198       }else{
199         msg_dialog::display(_("Event error"),
200                     sprintf(_("Event '%s' is not available!"),$action),ERROR_DIALOG);
201       }
203     }
205     /* Do we represent a valid terminal? */
206     if (!$this->is_account && $this->parent === NULL){
207       $display= "<img alt=\"\" src=\"images/small-error.png\" align=middle>&nbsp;<b>".
208         msgPool::noValidExtension(_("terminal"))."</b>";
209       return($display);
210     }
212     /* Add new ntp Server to our list */
213     if((isset($_POST['addNtpServer'])) && (isset($_POST['gotoNtpServers'])) && $this->acl_is_writeable("gotoNtpServer")){
214       $this->gotoNtpServer[$_POST['gotoNtpServers']] = $_POST['gotoNtpServers'];
215     }
217     /* Delete selected NtpServer for list of used servers  */
218     if((isset($_POST['delNtpServer'])) && (isset($_POST['gotoNtpServerSelected'])) && $this->acl_is_writeable("gotoNtpServer")){
219       foreach($_POST['gotoNtpServerSelected'] as $name){
220         unset($this->gotoNtpServer[$name]);
221       } 
222     }
224     /* Fill templating stuff */
225     $smarty= get_smarty();
227     
228     $tmp = $this->plInfo();
229     foreach($tmp['plProvidedAcls'] as $name => $translation){
230       $smarty->assign($name."ACL",$this->getacl($name));
231     }
233     $smarty->assign("cn", $this->cn);
234     $smarty->assign("description", $this->description);
236     /* tell smarty the inherit checkbox state */
237     $smarty->assign("inheritTimeServer",$this->inheritTimeServer);
239     /* Check if terminal is online */
240     if (gosaSupportDaemon::ping($this->netConfigDNS->macAddress)){
241       $smarty->assign("actions", array( "halt" => _("Switch off"), 
242                                         "reboot" => _("Reboot"),
243                                         #"memcheck" => _("Memory test"),
244                                         #"sysinfo"  => _("System analysis")
245                                         ));
246     } else {
247       $smarty->assign("actions", array("wake" => _("Wake up"),
248                                        #"memcheck" => _("Memory test"),
249                                        #"sysinfo"  => _("System analysis")
250                                         ));
251     }
253     /* Arrays */
254     $smarty->assign("modes", $this->modes);
256     $tmp2 = array(); 
257     $tmp2['!']= _("Local swap");
258     foreach($this->config->data['SERVERS']['NBD'] as $server){
259       if($server != "default"){
260         $tmp2[$server]= $server;
261       }else{
262         if($this->member_of_ogroup){
263           $tmp2[$server]="["._("inherited")."]";
264         }
265       }
266     }
267   
268     $smarty->assign("swapservers",     $tmp2);
269     $tmp2 = array(); 
270     foreach($this->config->data['SERVERS']['NFS'] as $server){
271       if($server != "default"){
272         $tmp2[$server]= $server;
273       }else{
274         if($this->member_of_ogroup){
275           $tmp2[$server]="["._("inherited")."]";
276         }
277       }
278     }
279   
280     $smarty->assign("nfsservers",     $tmp2);
281     $smarty->assign("syslogservers",  $this->gotoSyslogServers);
283     $tmp = array();
284     foreach($this->gotoNtpServers as $server){
285       if(!in_array($server,$this->gotoNtpServer)){
286         $tmp[$server] = $server;
287       }
288     }
289     
290     $smarty->assign("ntpservers",     $tmp);
291     $smarty->assign("fai_activated",$this->fai_activated);
293     /* Variables */
294     foreach(array("gotoMode", "gotoTerminalPath", "gotoSwapServer","gotoSyslogServer", "gotoNtpServer") as $val){
295       $smarty->assign($val."_select", $this->$val);
296     }
297     $smarty->assign("base", $this->baseSelector->render());
299     $smarty->assign("member_of_ogroup",$this->member_of_ogroup);
301     /* Show main page */
302     $str = $this->netConfigDNS->execute();
303     if(is_object($this->netConfigDNS->dialog)){
304       return($str);
305     }
306     $smarty->assign("netconfig", $str);
308     /* Display kerberos host key options */  
309     $smarty->assign("host_key","");
310     if(is_object($this->kerberos_key_service)){
311       $smarty->assign("host_key",$this->kerberos_key_service->execute_by_prefix("host/"));
312     }
314     return($smarty->fetch (get_template_path('terminal.tpl', TRUE, dirname(__FILE__))));
315   }
317   function remove_from_parent()
318   {
319     if($this->acl_is_removeable()){   
320       $ldap= $this->config->get_ldap_link();
321       $ldap->cd($this->dn);
322       $ldap->cat($this->dn, array('dn'));
323       if($ldap->count()){
324         $this->netConfigDNS->remove_from_parent();
325         $ldap->rmDir($this->dn);
326   
327         new log("remove","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
328   
329         if (!$ldap->success()){
330           msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class()));
331         }
333         /* Remove kerberos key dependencies too */
334         if(is_object($this->kerberos_key_service)){
335           $this->kerberos_key_service->remove_from_parent_by_prefix("host/");
336         }
338         /* Optionally execute a command after we're done */
339         $this->handle_post_events("remove",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
341         /* Delete references to object groups */
342         $ldap->cd ($this->config->current['BASE']);
343         $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
344         while ($ldap->fetch()){
345           $og= new ogroup($this->config, $ldap->getDN());
346           unset($og->member[$this->dn]);
347           $og->save ();
348         }
350         /* Remove all accessTo/trust dependencies */
351         update_accessTo($this->cn,"");
352       }
354       /* Clean queue form entries with this mac 
355        */
356       if(class_available("gosaSupportDaemon") && tests::is_mac($this->netConfigDNS->orig_macAddress)){
357         $q = new gosaSupportDaemon();
358         $q->clean_queue_from_mac($this->netConfigDNS->orig_macAddress);
359       }
360     }
361   }
364   /* Save data to object */
365   function save_object()
366   {
367     /* Create a base backup and reset the
368        base directly after calling plugin::save_object();
369        Base will be set seperatly a few lines below */
370     $base_tmp = $this->base;
371     plugin::save_object();
372     $this->base = $base_tmp;
374     /* Refresh base */
375     if ($this->acl_is_moveable($this->base)){
376       if (!$this->baseSelector->update()) {
377         msg_dialog::display(_("Error"), msgPool::permMove(), ERROR_DIALOG);
378       }
379       if ($this->base != $this->baseSelector->getBase()) {
380         $this->base= $this->baseSelector->getBase();
381         $this->is_modified= TRUE;
382       }
383     }
384     
385     $this->netConfigDNS->save_object();
387     /* Save terminal path to parent since it is used by termstartup, too */
388     if(isset($this->parent->by_object['termstartup'])){
389       $this->parent->by_object['termstartup']->gotoTerminalPath= $this->gotoTerminalPath;
390     }
391     
392     if(isset($_POST['termgeneric_posted'])){
393       if(isset($_POST["inheritTimeServer"]) && $this->member_of_ogroup){
394         $this->inheritTimeServer = true;
395       }else{
396         $this->inheritTimeServer = false;
397       }
398     }  
400     if(isset($_POST["inheritAll"])){
401       $this->set_everything_to_inherited();
402     }
404     /* Hanle kerberos host key plugin */
405     if(is_object($this->kerberos_key_service)){
406       $this->kerberos_key_service->save_object_by_prefix("host/");
407     }
408   }
411   /* Check supplied data */
412   function check()
413   {
414     /* Call common method to give check the hook */
415     $message= plugin::check();
417     /* Skip IP & Mac checks if this is a template */
418     if($this->cn != "default"){
419       $message= array_merge($message, $this->netConfigDNS->check());
420     }
422     /* Permissions for that base? */
423     $this->dn= "cn=".$this->cn.",".get_ou("termgeneric", "terminalRDN").$this->base;
425     if ($this->cn == ""){
426       $message[]= msgPool::required(_("Name"));
427     }
429     // Check if a wrong base was supplied
430     if(!$this->baseSelector->checkLastBaseUpdate()){
431       $message[]= msgPool::check_base();
432     }
434     /* Check if given name is a valid host/dns name */
435     if(!tests::is_dns_name($this->cn) ){
436       $message[] = msgPool::invalid(_("Name"));
437     }
439     if ($this->orig_dn == 'new'){
440       $ldap= $this->config->get_ldap_link();
441       $ldap->cd ($this->base);
443       /* It is possible to have a 'default' terminal on every base */
444       if($this->cn == "default"){
445         $ldap->cat($this->dn);
446       }else{
447         $ldap->search ("(&(objectClass=gotoTerminal)(cn=".$this->cn."))", array("cn"));
448       }
449       if ($ldap->count() != 0){
450         while ($attrs= $ldap->fetch()){
451           if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".preg_quote(get_ou("ArpNewDevice", "systemIncomingRDN"), '/')."/i", $ldap->getDN())){
452             continue;
453           } else {
454             if ($attrs['dn'] != $this->orig_dn){
455               $message[]= msgPool::duplicated(_("Name"));
456               break;
457             }
458           }
459         }
460       }
461     }
463     /* Check for valid ntpServer selection */
464     if((!$this->inheritTimeServer) && (!count($this->gotoNtpServer))){
465       $message[]= msgPool::required(_("NTP server"));
466     }
468     /* Check if we are allowed to create or move this object
469      */
470     if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){
471       $message[] = msgPool::permCreate();
472     }elseif($this->orig_dn != "new" && $this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){
473       $message[] = msgPool::permMove();
474     }
476     return ($message);
477   }
480   /* Save to LDAP */
481   function save()
482   {
483     /* Detect mode changes */
484     $activate= (isset($this->saved_attributes['gotoMode']) &&
485         $this->gotoMode != $this->saved_attributes['gotoMode'] &&
486         $this->gotoMode == "active" &&
487         tests::is_ip($this->netConfigDNS->ipHostNumber)) || $this->auto_activate;
489     /* Find proper terminal path for tftp configuration
490        FIXME: This is suboptimal when the default has changed to
491        another location! */
492     if ($this->gotoTerminalPath == "default"){
493       $ldap= $this->config->get_ldap_link();
495       /* Strip relevant part from dn, keep trailing ',' */
496       $tmp= preg_replace("/^cn=[^,]+,".preg_quote(get_ou("termgeneric", "terminalRDN"), '/')."/i", "", $this->dn);
497       $tmp= preg_replace("/".$this->config->current['BASE']."$/i", "", $tmp);
499       /* Walk from top to base and try to load default values for
500          'gotoTerminalPath'. Abort when an entry is found. */
501       while (TRUE){
502         $tmp= preg_replace ("/^[^,]+,/", "", $tmp);
504         $ldap->cat("cn=default,".get_ou("termgeneric", "terminalRDN").$tmp.
505             $this->config->current['BASE'], array('gotoTerminalPath'));
506         $attrs= $ldap->fetch();
507         if (isset($attrs['gotoTerminalPath'])){
508           $this->gotoTerminalPath= $attrs['gotoTerminalPath'][0];
509           break;
510         }
512         /* Nothing left? */
513         if ($tmp == ""){
514           break;
515         }
516       }
517     }
519     plugin::save();
521     /* Strip out 'default' values */
522     foreach (array("gotoTerminalPath", "gotoSwapServer", "gotoSyslogServer") as $val){
523       if(isset($this->attrs[$val])){
524         if ($this->attrs[$val] == "default"){
525           $this->attrs[$val]= array();
526         }
527       }
528     }
530     /* Add missing arrays */
531     foreach (array("ghScsiDev", "ghIdeDev", "ghNetNic") as $val){
532       if (isset ($this->$val) && count ($this->$val) != 0){
533         $this->attrs["$val"]= $this->$val;
534       }
535     }
537     /* Remove all empty values */
538     if ($this->orig_dn == 'new'){
539       $attrs= array();
540       foreach ($this->attrs as $key => $val){
541         if (is_array($val) && count($val) == 0){
542           continue;
543         }
544         $attrs[$key]= $val;
545       }
546       $this->attrs= $attrs;
547     }
549     /* Set ntpServers */
550     $this->attrs['gotoNtpServer'] = array();
551     if(!$this->inheritTimeServer){
552       foreach($this->gotoNtpServer as $server){
553         $this->attrs['gotoNtpServer'][] = $server;
554       }
555     }
557     /* cn=default and macAddress=- indicates that this is a template */
558     if($this->cn == "default"){
559       $this->netConfigDNS->macAddress = "-";
560     }
562     /* Write back to ldap */
563     $ldap= $this->config->get_ldap_link();
564     if ($this->orig_dn == 'new'){
565       $ldap->cd($this->config->current['BASE']);
566       $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
567       $ldap->cd($this->dn);
568       if (!count($this->attrs['gotoNtpServer'])){
569         unset($this->attrs['gotoNtpServer']);
570       }
571       $ldap->add($this->attrs);
572       new log("create","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
574       $this->netConfigDNS->cn = $this->cn;
575       $this->netConfigDNS->save();
577       $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
578     } else {
579       $ldap->cd($this->dn);
580       $this->cleanup();
581       $ldap->modify ($this->attrs); 
582       new log("modify","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
584       $this->netConfigDNS->cn = $this->cn;
585       $this->netConfigDNS->save();
587       $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
589       /* Update all accessTo/trust dependencies */
590       if($this->orig_cn != $this->cn){
591         update_accessTo($this->orig_cn,$this->cn);
592       }
593     }
594     
595     if (!$ldap->success()){
596       msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
597     }
599     /* Send installation activation
600      */
601     if ($activate && class_available("DaemonEvent")){
602       $events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);
603       $o_queue = new gosaSupportDaemon();
604       if(isset($events['TRIGGERED']['DaemonEvent_installation_activation'])){
605         $evt = $events['TRIGGERED']['DaemonEvent_installation_activation'];
606         $tmp = new $evt['CLASS_NAME']($this->config);
607         $tmp->set_type(TRIGGERED_EVENT);
608         $tmp->add_targets(array($this->netConfigDNS->macAddress));
609         if(!$o_queue->append($tmp)){
610           msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
611         }
612       }
613     }
614   }
617   /* Display generic part for server copy & paste */
618   function getCopyDialog()
619   {
620     $vars = array("cn");
621     $smarty = get_smarty();
622     $smarty->assign("cn" ,$this->cn);
623     $smarty->assign("object","terminal");
624     $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
625     $ret = array();
626     $ret['string'] = $str;
627     $ret['status'] = "";
628     return($ret);
629   }
632   function saveCopyDialog()
633   {
634     if(isset($_POST['cn'])){
635       $this->cn = $_POST['cn'];
636     }
637   }
640   function PrepareForCopyPaste($source)
641   {
642     plugin::PrepareForCopyPaste($source);
643     if(isset($source['macAddress'][0])){
644       $this->netConfigDNS->macAddress = $source['macAddress'][0];
645     }
646     if(isset($source['ipHostNumber'][0])){
647       $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
648     }
650     /* Create used ntp server array */
651     $this->gotoNtpServer= array();
652     if(isset($source['gotoNtpServer'])){
653       $this->inheritTimeServer = false;
654       unset($source['gotoNtpServer']['count']);
655       foreach($source['gotoNtpServer'] as $server){
656         $this->gotoNtpServer[$server] = $server;
657       }
658     }
660     /* Set inherit checkbox state */
661     if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer)==0)){
662       $this->inheritTimeServer = true;
663       $this->gotoNtpServer=array();
664     }
665   }
668   /* Return plugin informations for acl handling */
669   static function plInfo()
670   {
671     return (array(
672           "plShortName"   => _("Terminal"),
673           "plDescription" => _("Terminal generic"),
674           "plSelfModify"  => FALSE,
675           "plDepends"     => array(),
676           "plPriority"    => 1,
677           "plSection"     => array("administration"),
678           "plCategory"    => array("terminal" => array( "description"  => _("Terminal"),
679                   "objectClass"  => "gotoTerminal")),
680           "plProperties" =>
681           array(
682               array(
683                   "name"          => "terminalRDN",
684                   "type"          => "rdn",
685                   "default"       => "ou=terminals,ou=systems,",
686                   "description"   => "The 'terminalRDN' statement defines the location where new terminals will be created. The default is 'ou=terminals,ou=systems,'.",
687                   "check"         => "gosaProperty::isRdn",
688                   "migrate"       => "migrate_terminalRDN",
689                   "group"         => "plugin",
690                   "mandatory"     => FALSE
691                   )
692               ),
694           "plProvidedAcls"=> array(
695             "cn"                  => _("Name"),
696             "description"         => _("Description"),
697             "base"                => _("Base"),
699             "gotoMode"            => _("Mode"),
700             "gotoSyslogServer"    => _("Syslog server enabled"),
702             "gotoTerminalPath"    => _("Root server"),
703             "gotoSwapServer"      => _("Swap server"),
705             "gotoNtpServer"       => _("Ntp server settings"),
706             "userPassword"      => _("Root password"),
708             "FAIstate"            => _("Action flag"))
709           ));
710   }
713   function set_everything_to_inherited()
714   {
715     $this->gotoTerminalPath  = "default";
716     $this->gotoSwapServer    = "default" ;
717     $this->gotoSyslogServer  = "default";
718     $this->inheritTimeServer = TRUE;
720     /* Set workstation service attributes to inherited */
721     if($this->member_of_ogroup && isset($this->parent->by_object['termservice'])){
722       foreach(array("gotoXKbLayout","gotoXKbModel","gotoXKbVariant","gotoXDriver",
723             "gotoXResolution","gotoXColordepth","gotoXMouseType","gotoXMouseport") as $name){
724         $this->parent->by_object['termservice']->$name = "default";
725       }
726     }
728     /* Set workstation startup attributes to inherited */
729     if($this->member_of_ogroup && isset($this->parent->by_object['termstartup'])){
730       $this->parent->by_object['termstartup']->gotoBootKernel = "default-inherited";
731       $this->parent->by_object['termstartup']->gotoLdapServer = "default-inherited";
732       $this->parent->by_object['termstartup']->gotoLdap_inherit = TRUE;
733       $this->parent->by_object['termstartup']->gotoLdapServers = array();
734     }
735   }
738   function is_modal_dialog()
739   {
740     return((isset($this->dialog) && $this->dialog) || (isset($this->netConfigDNS->dialog) && $this->netConfigDNS->dialog));
741   }
745 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
746 ?>