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;
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 = get_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> <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[get_post('gotoNtpServers')] = get_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(get_post('gotoNtpServerSelected') as $name){
220 unset($this->gotoNtpServer[$name]);
221 }
222 }
224 /* Fill templating stuff */
225 $smarty= get_smarty();
228 $tmp = $this->plInfo();
229 foreach($tmp['plProvidedAcls'] as $name => $translation){
230 $smarty->assign($name."ACL",$this->getacl($name));
231 }
233 $smarty->assign("cn",set_post($this->cn));
234 $smarty->assign("description", set_post($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", set_post(array("halt" => _("Switch off"),"reboot" => _("Reboot"))));
242 } else {
243 $smarty->assign("actions", set_post(array("wake" => _("Wake up"))));
244 }
246 /* Arrays */
247 $smarty->assign("modes", set_post($this->modes));
249 $tmp2 = array();
250 $tmp2['!']= _("Local swap");
251 foreach($this->config->data['SERVERS']['NBD'] as $server){
252 if($server != "default"){
253 $tmp2[$server]= $server;
254 }else{
255 if($this->member_of_ogroup){
256 $tmp2[$server]="["._("inherited")."]";
257 }
258 }
259 }
261 $smarty->assign("swapservers", set_post($tmp2));
262 $tmp2 = array();
263 foreach($this->config->data['SERVERS']['NFS'] as $server){
264 if($server != "default"){
265 $tmp2[$server]= $server;
266 }else{
267 if($this->member_of_ogroup){
268 $tmp2[$server]="["._("inherited")."]";
269 }
270 }
271 }
273 $smarty->assign("nfsservers", set_post($tmp2));
274 $smarty->assign("syslogservers", set_post($this->gotoSyslogServers));
276 $tmp = array();
277 foreach($this->gotoNtpServers as $server){
278 if(!in_array($server,$this->gotoNtpServer)){
279 $tmp[$server] = $server;
280 }
281 }
283 $smarty->assign("ntpservers", set_post($tmp));
284 $smarty->assign("fai_activated",$this->fai_activated);
286 /* Variables */
287 foreach(array("gotoMode", "gotoTerminalPath", "gotoSwapServer","gotoSyslogServer", "gotoNtpServer") as $val){
288 $smarty->assign($val."_select", set_post($this->$val));
289 }
290 $smarty->assign("base", $this->baseSelector->render());
292 $smarty->assign("member_of_ogroup",$this->member_of_ogroup);
294 /* Show main page */
295 $str = $this->netConfigDNS->execute();
296 if(is_object($this->netConfigDNS->dialog)){
297 return($str);
298 }
299 $smarty->assign("netconfig", $str);
301 /* Display kerberos host key options */
302 $smarty->assign("host_key","");
303 if(is_object($this->kerberos_key_service)){
304 $smarty->assign("host_key",$this->kerberos_key_service->execute_by_prefix("host/"));
305 }
307 return($smarty->fetch (get_template_path('terminal.tpl', TRUE, dirname(__FILE__))));
308 }
310 function remove_from_parent()
311 {
312 if($this->acl_is_removeable()){
313 $ldap= $this->config->get_ldap_link();
314 $ldap->cd($this->dn);
315 $ldap->cat($this->dn, array('dn'));
316 if($ldap->count()){
317 $this->netConfigDNS->remove_from_parent();
318 $ldap->rmDir($this->dn);
320 new log("remove","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
322 if (!$ldap->success()){
323 msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class()));
324 }
326 /* Remove kerberos key dependencies too */
327 if(is_object($this->kerberos_key_service)){
328 $this->kerberos_key_service->remove_from_parent_by_prefix("host/");
329 }
331 /* Optionally execute a command after we're done */
332 $this->handle_post_events("remove",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
334 /* Delete references to object groups */
335 $ldap->cd ($this->config->current['BASE']);
336 $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
337 while ($ldap->fetch()){
338 $og= new ogroup($this->config, $ldap->getDN());
339 unset($og->member[$this->dn]);
340 $og->save ();
341 }
343 /* Remove all accessTo/trust dependencies */
344 update_accessTo($this->cn,"");
345 }
347 /* Clean queue form entries with this mac
348 */
349 if(class_available("gosaSupportDaemon") && tests::is_mac($this->netConfigDNS->orig_macAddress)){
350 $q = new gosaSupportDaemon();
351 $q->clean_queue_from_mac($this->netConfigDNS->orig_macAddress);
352 }
353 }
354 }
357 /* Save data to object */
358 function save_object()
359 {
360 /* Create a base backup and reset the
361 base directly after calling plugin::save_object();
362 Base will be set seperatly a few lines below */
363 $base_tmp = $this->base;
364 plugin::save_object();
365 $this->base = $base_tmp;
367 /* Refresh base */
368 if ($this->acl_is_moveable($this->base)){
369 if (!$this->baseSelector->update()) {
370 msg_dialog::display(_("Error"), msgPool::permMove(), ERROR_DIALOG);
371 }
372 if ($this->base != $this->baseSelector->getBase()) {
373 $this->base= $this->baseSelector->getBase();
374 $this->is_modified= TRUE;
375 }
376 }
378 $this->netConfigDNS->save_object();
380 /* Save terminal path to parent since it is used by termstartup, too */
381 if(isset($this->parent->by_object['termstartup'])){
382 $this->parent->by_object['termstartup']->gotoTerminalPath= $this->gotoTerminalPath;
383 }
385 if(isset($_POST['termgeneric_posted'])){
386 if(isset($_POST["inheritTimeServer"]) && $this->member_of_ogroup){
387 $this->inheritTimeServer = true;
388 }else{
389 $this->inheritTimeServer = false;
390 }
391 }
393 if(isset($_POST["inheritAll"])){
394 $this->set_everything_to_inherited();
395 }
397 /* Hanle kerberos host key plugin */
398 if(is_object($this->kerberos_key_service)){
399 $this->kerberos_key_service->save_object_by_prefix("host/");
400 }
401 }
404 /* Check supplied data */
405 function check()
406 {
407 /* Call common method to give check the hook */
408 $message= plugin::check();
410 /* Skip IP & Mac checks if this is a template */
411 if($this->cn != "default"){
412 $message= array_merge($message, $this->netConfigDNS->check());
413 }
415 /* Permissions for that base? */
416 $this->dn= "cn=".$this->cn.",".get_ou("termgeneric", "terminalRDN").$this->base;
418 if ($this->cn == ""){
419 $message[]= msgPool::required(_("Name"));
420 }
422 // Check if a wrong base was supplied
423 if(!$this->baseSelector->checkLastBaseUpdate()){
424 $message[]= msgPool::check_base();
425 }
427 /* Check if given name is a valid host/dns name */
428 if(!tests::is_dns_name($this->cn) ){
429 $message[] = msgPool::invalid(_("Name"));
430 }
432 if ($this->orig_dn == 'new'){
433 $ldap= $this->config->get_ldap_link();
434 $ldap->cd ($this->base);
436 /* It is possible to have a 'default' terminal on every base */
437 if($this->cn == "default"){
438 $ldap->cat($this->dn);
439 }else{
440 $ldap->search ("(&(objectClass=gotoTerminal)(cn=".$this->cn."))", array("cn"));
441 }
442 if ($ldap->count() != 0){
443 while ($attrs= $ldap->fetch()){
444 if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".preg_quote(get_ou("ArpNewDevice", "systemIncomingRDN"), '/')."/i", $ldap->getDN())){
445 continue;
446 } else {
447 if ($attrs['dn'] != $this->orig_dn){
448 $message[]= msgPool::duplicated(_("Name"));
449 break;
450 }
451 }
452 }
453 }
454 }
456 /* Check for valid ntpServer selection */
457 if((!$this->inheritTimeServer) && (!count($this->gotoNtpServer))){
458 $message[]= msgPool::required(_("NTP server"));
459 }
461 /* Check if we are allowed to create or move this object
462 */
463 if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){
464 $message[] = msgPool::permCreate();
465 }elseif($this->orig_dn != "new" && $this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){
466 $message[] = msgPool::permMove();
467 }
469 return ($message);
470 }
473 /* Save to LDAP */
474 function save()
475 {
476 /* Detect mode changes */
477 $activate= (isset($this->saved_attributes['gotoMode']) &&
478 $this->gotoMode != $this->saved_attributes['gotoMode'] &&
479 $this->gotoMode == "active" &&
480 tests::is_ip($this->netConfigDNS->ipHostNumber)) || $this->auto_activate;
482 /* Find proper terminal path for tftp configuration
483 FIXME: This is suboptimal when the default has changed to
484 another location! */
485 if ($this->gotoTerminalPath == "default"){
486 $ldap= $this->config->get_ldap_link();
488 /* Strip relevant part from dn, keep trailing ',' */
489 $tmp= preg_replace("/^cn=[^,]+,".preg_quote(get_ou("termgeneric", "terminalRDN"), '/')."/i", "", $this->dn);
490 $tmp= preg_replace("/".$this->config->current['BASE']."$/i", "", $tmp);
492 /* Walk from top to base and try to load default values for
493 'gotoTerminalPath'. Abort when an entry is found. */
494 while (TRUE){
495 $tmp= preg_replace ("/^[^,]+,/", "", $tmp);
497 $ldap->cat("cn=default,".get_ou("termgeneric", "terminalRDN").$tmp.
498 $this->config->current['BASE'], array('gotoTerminalPath'));
499 $attrs= $ldap->fetch();
500 if (isset($attrs['gotoTerminalPath'])){
501 $this->gotoTerminalPath= $attrs['gotoTerminalPath'][0];
502 break;
503 }
505 /* Nothing left? */
506 if ($tmp == ""){
507 break;
508 }
509 }
510 }
512 plugin::save();
514 /* Strip out 'default' values */
515 foreach (array("gotoTerminalPath", "gotoSwapServer", "gotoSyslogServer") as $val){
516 if(isset($this->attrs[$val])){
517 if ($this->attrs[$val] == "default"){
518 $this->attrs[$val]= array();
519 }
520 }
521 }
523 /* Add missing arrays */
524 foreach (array("ghScsiDev", "ghIdeDev", "ghNetNic") as $val){
525 if (isset ($this->$val) && count ($this->$val) != 0){
526 $this->attrs["$val"]= $this->$val;
527 }
528 }
530 /* Remove all empty values */
531 if ($this->orig_dn == 'new'){
532 $attrs= array();
533 foreach ($this->attrs as $key => $val){
534 if (is_array($val) && count($val) == 0){
535 continue;
536 }
537 $attrs[$key]= $val;
538 }
539 $this->attrs= $attrs;
540 }
542 /* Set ntpServers */
543 $this->attrs['gotoNtpServer'] = array();
544 if(!$this->inheritTimeServer){
545 foreach($this->gotoNtpServer as $server){
546 $this->attrs['gotoNtpServer'][] = $server;
547 }
548 }
550 /* cn=default and macAddress=- indicates that this is a template */
551 if($this->cn == "default"){
552 $this->netConfigDNS->macAddress = "-";
553 }
555 /* Write back to ldap */
556 $ldap= $this->config->get_ldap_link();
557 if ($this->orig_dn == 'new'){
558 $ldap->cd($this->config->current['BASE']);
559 $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
560 $ldap->cd($this->dn);
561 if (!count($this->attrs['gotoNtpServer'])){
562 unset($this->attrs['gotoNtpServer']);
563 }
564 $ldap->add($this->attrs);
565 new log("create","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
567 $this->netConfigDNS->cn = $this->cn;
568 $this->netConfigDNS->save();
570 $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
571 } else {
572 $ldap->cd($this->dn);
573 $this->cleanup();
574 $ldap->modify ($this->attrs);
575 new log("modify","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("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
582 /* Update all accessTo/trust dependencies */
583 if($this->orig_cn != $this->cn){
584 update_accessTo($this->orig_cn,$this->cn);
585 }
586 }
588 if (!$ldap->success()){
589 msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
590 }
592 /* Send installation activation
593 */
594 if ($activate && class_available("DaemonEvent")){
595 $events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);
596 $o_queue = new gosaSupportDaemon();
597 if(isset($events['TRIGGERED']['DaemonEvent_installation_activation'])){
598 $evt = $events['TRIGGERED']['DaemonEvent_installation_activation'];
599 $tmp = new $evt['CLASS_NAME']($this->config);
600 $tmp->set_type(TRIGGERED_EVENT);
601 $tmp->add_targets(array($this->netConfigDNS->macAddress));
602 if(!$o_queue->append($tmp)){
603 msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
604 }
605 }
606 }
607 }
610 /* Display generic part for server copy & paste */
611 function getCopyDialog()
612 {
613 $vars = array("cn");
614 $smarty = get_smarty();
615 $smarty->assign("cn" , set_post($this->cn));
616 $smarty->assign("object","terminal");
617 $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
618 $ret = array();
619 $ret['string'] = $str;
620 $ret['status'] = "";
621 return($ret);
622 }
625 function saveCopyDialog()
626 {
627 if(isset($_POST['cn'])){
628 $this->cn = get_post('cn');
629 }
630 }
633 function PrepareForCopyPaste($source)
634 {
635 plugin::PrepareForCopyPaste($source);
636 if(isset($source['macAddress'][0])){
637 $this->netConfigDNS->macAddress = $source['macAddress'][0];
638 }
639 if(isset($source['ipHostNumber'][0])){
640 $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
641 }
643 /* Create used ntp server array */
644 $this->gotoNtpServer= array();
645 if(isset($source['gotoNtpServer'])){
646 $this->inheritTimeServer = false;
647 unset($source['gotoNtpServer']['count']);
648 foreach($source['gotoNtpServer'] as $server){
649 $this->gotoNtpServer[$server] = $server;
650 }
651 }
653 /* Set inherit checkbox state */
654 if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer)==0)){
655 $this->inheritTimeServer = true;
656 $this->gotoNtpServer=array();
657 }
658 }
661 /* Return plugin informations for acl handling */
662 static function plInfo()
663 {
664 return (array(
665 "plShortName" => _("Terminal"),
666 "plDescription" => _("Terminal generic"),
667 "plSelfModify" => FALSE,
668 "plDepends" => array(),
669 "plPriority" => 1,
670 "plSection" => array("administration"),
671 "plRequirements"=> array(
672 'ldapSchema' => array('gotoTerminal' => '>=2.7'),
673 'onFailureDisablePlugin' => array(get_class())
674 ),
675 "plCategory" => array("terminal" => array( "description" => _("Terminal"),
676 "objectClass" => "gotoTerminal")),
677 "plProperties" =>
678 array(
679 array(
680 "name" => "terminalRDN",
681 "type" => "rdn",
682 "default" => "ou=terminals,ou=systems,",
683 "description" => _("The 'terminalRDN' statement defines the location where new terminals will be created. The default is 'ou=terminals,ou=systems,'."),
684 "check" => "gosaProperty::isRdn",
685 "migrate" => "migrate_terminalRDN",
686 "group" => "plugin",
687 "mandatory" => FALSE
688 )
689 ),
691 "plProvidedAcls"=> array(
692 "cn" => _("Name"),
693 "description" => _("Description"),
694 "base" => _("Base"),
696 "gotoMode" => _("Mode"),
697 "gotoSyslogServer" => _("Syslog server enabled"),
699 "gotoTerminalPath" => _("Root server"),
700 "gotoSwapServer" => _("Swap server"),
702 "gotoNtpServer" => _("NTP server settings"),
703 "userPassword" => _("Root password"),
705 "FAIstate" => _("Action flag"))
706 ));
707 }
710 function set_everything_to_inherited()
711 {
712 $this->gotoTerminalPath = "default";
713 $this->gotoSwapServer = "default" ;
714 $this->gotoSyslogServer = "default";
715 $this->inheritTimeServer = TRUE;
717 /* Set workstation service attributes to inherited */
718 if($this->member_of_ogroup && isset($this->parent->by_object['termservice'])){
719 foreach(array("gotoXKbLayout","gotoXKbModel","gotoXKbVariant","gotoXDriver",
720 "gotoXResolution","gotoXColordepth","gotoXMouseType","gotoXMouseport") as $name){
721 $this->parent->by_object['termservice']->$name = "default";
722 }
723 }
725 /* Set workstation startup attributes to inherited */
726 if($this->member_of_ogroup && isset($this->parent->by_object['termstartup'])){
727 $this->parent->by_object['termstartup']->gotoBootKernel = "default-inherited";
728 $this->parent->by_object['termstartup']->gotoLdapServer = "default-inherited";
729 $this->parent->by_object['termstartup']->gotoLdap_inherit = TRUE;
730 $this->parent->by_object['termstartup']->gotoLdapServers = array();
731 }
732 }
735 function is_modal_dialog()
736 {
737 return((isset($this->dialog) && $this->dialog) || (isset($this->netConfigDNS->dialog) && $this->netConfigDNS->dialog));
738 }
740 }
742 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
743 ?>