cb0220a34a81d1579f594557a5a5d6847f06c0ac
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(class_available("ArpNewDevice") &&
129 preg_match("/".preg_quote(get_ou("ArpNewDevice", "systemIncomingRDN"), '/')."/i", $this->dn)){
130 $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("ArpNewDevice", "systemIncomingRDN"), '/')."/i", "", $this->dn);
131 } else {
132 $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("termgeneric", "terminalRDN"), '/')."/i", "", $this->dn);
133 }
135 /* Create an array of all Syslog servers */
136 $tmp = $this->config->data['SERVERS']['SYSLOG'];
137 foreach($tmp as $server){
138 $visible = $server;
139 if($server == "default" && $this->member_of_ogroup) {
140 $visible = "["._("inherited")."]";
141 }
142 $this->gotoSyslogServers[$server] = $visible;
143 }
145 $this->orig_dn= $this->dn;
146 $this->orig_cn= $this->cn;
147 $this->orig_base= $this->base;
149 /* Instanciate base selector */
150 $this->baseSelector= new baseSelector($this->get_allowed_bases(), $this->base);
151 $this->baseSelector->setSubmitButton(false);
152 $this->baseSelector->setHeight(300);
153 $this->baseSelector->update(true);
154 }
156 function set_acl_base($base)
157 {
158 plugin::set_acl_base($base);
159 $this->netConfigDNS->set_acl_base($base);
160 }
162 function set_acl_category($cat)
163 {
164 plugin::set_acl_category($cat);
165 $this->netConfigDNS->set_acl_category($cat);
166 }
168 function execute()
169 {
170 /* Call parent execute */
171 plugin::execute();
173 if($this->is_account && !$this->view_logged){
174 $this->view_logged = TRUE;
175 new log("view","terminal/".get_class($this),$this->dn);
176 }
178 /* Do we need to flip is_account state? */
179 if (isset($_POST['modify_state'])){
180 $this->is_account= !$this->is_account;
181 }
183 if (isset($_POST['action']) && $this->acl_is_writeable("FAIstate") && isset($this->validActions[$_POST['saction']])){
184 $action = get_post('saction');
186 /* Check if we have an DaemonEvent for this action */
187 if(class_available("DaemonEvent_".$action)){
188 $events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);
189 if(isset($events['TRIGGERED']["DaemonEvent_".$action])){
190 $evt = $events['TRIGGERED']["DaemonEvent_".$action];
191 $tmp = new $evt['CLASS_NAME']($this->config);
192 $tmp->add_targets(array($this->netConfigDNS->macAddress));
193 $tmp->set_type(TRIGGERED_EVENT);
194 $o_queue = new gosaSupportDaemon();
195 if(!$o_queue->append($tmp)){
196 msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
197 }
198 }
199 }else{
200 msg_dialog::display(_("Event error"),
201 sprintf(_("Event '%s' is not available!"),$action),ERROR_DIALOG);
202 }
204 }
206 /* Do we represent a valid terminal? */
207 if (!$this->is_account && $this->parent === NULL){
208 $display= "<img alt=\"\" src=\"images/small-error.png\" align=middle> <b>".
209 msgPool::noValidExtension(_("terminal"))."</b>";
210 return($display);
211 }
213 /* Add new ntp Server to our list */
214 if((isset($_POST['addNtpServer'])) && (isset($_POST['gotoNtpServers'])) && $this->acl_is_writeable("gotoNtpServer")){
215 $this->gotoNtpServer[get_post('gotoNtpServers')] = get_post('gotoNtpServers');
216 }
218 /* Delete selected NtpServer for list of used servers */
219 if((isset($_POST['delNtpServer'])) && (isset($_POST['gotoNtpServerSelected'])) && $this->acl_is_writeable("gotoNtpServer")){
220 foreach(get_post('gotoNtpServerSelected') as $name){
221 unset($this->gotoNtpServer[$name]);
222 }
223 }
225 /* Fill templating stuff */
226 $smarty= get_smarty();
229 $tmp = $this->plInfo();
230 foreach($tmp['plProvidedAcls'] as $name => $translation){
231 $smarty->assign($name."ACL",$this->getacl($name));
232 }
234 $smarty->assign("cn",set_post($this->cn));
235 $smarty->assign("description", set_post($this->description));
237 /* tell smarty the inherit checkbox state */
238 $smarty->assign("inheritTimeServer",$this->inheritTimeServer);
240 /* Check if terminal is online */
241 if (gosaSupportDaemon::ping($this->netConfigDNS->macAddress)){
242 $smarty->assign("actions", set_post(array("halt" => _("Switch off"),"reboot" => _("Reboot"))));
243 } else {
244 $smarty->assign("actions", set_post(array("wake" => _("Wake up"))));
245 }
247 /* Arrays */
248 $smarty->assign("modes", set_post($this->modes));
250 $tmp2 = array();
251 $tmp2['!']= _("Local swap");
252 foreach($this->config->data['SERVERS']['NBD'] as $server){
253 if($server != "default"){
254 $tmp2[$server]= $server;
255 }else{
256 if($this->member_of_ogroup){
257 $tmp2[$server]="["._("inherited")."]";
258 }
259 }
260 }
262 $smarty->assign("swapservers", set_post($tmp2));
263 $tmp2 = array();
264 foreach($this->config->data['SERVERS']['NFS'] as $server){
265 if($server != "default"){
266 $tmp2[$server]= $server;
267 }else{
268 if($this->member_of_ogroup){
269 $tmp2[$server]="["._("inherited")."]";
270 }
271 }
272 }
274 $smarty->assign("nfsservers", set_post($tmp2));
275 $smarty->assign("syslogservers", set_post($this->gotoSyslogServers));
277 $tmp = array();
278 foreach($this->gotoNtpServers as $server){
279 if(!in_array($server,$this->gotoNtpServer)){
280 $tmp[$server] = $server;
281 }
282 }
284 $smarty->assign("ntpservers", set_post($tmp));
285 $smarty->assign("fai_activated",$this->fai_activated);
287 /* Variables */
288 foreach(array("gotoMode", "gotoTerminalPath", "gotoSwapServer","gotoSyslogServer", "gotoNtpServer") as $val){
289 $smarty->assign($val."_select", set_post($this->$val));
290 }
291 $smarty->assign("base", $this->baseSelector->render());
293 $smarty->assign("member_of_ogroup",$this->member_of_ogroup);
295 /* Show main page */
296 $str = $this->netConfigDNS->execute();
297 if(is_object($this->netConfigDNS->dialog)){
298 return($str);
299 }
300 $smarty->assign("netconfig", $str);
302 /* Display kerberos host key options */
303 $smarty->assign("host_key","");
304 if(is_object($this->kerberos_key_service)){
305 $smarty->assign("host_key",$this->kerberos_key_service->execute_by_prefix("host/"));
306 }
308 return($smarty->fetch (get_template_path('terminal.tpl', TRUE, dirname(__FILE__))));
309 }
311 function remove_from_parent()
312 {
313 if($this->acl_is_removeable()){
314 $ldap= $this->config->get_ldap_link();
315 $ldap->cd($this->dn);
316 $ldap->cat($this->dn, array('dn'));
317 if($ldap->count()){
318 $this->netConfigDNS->remove_from_parent();
319 $ldap->rmDir($this->dn);
321 new log("remove","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
323 if (!$ldap->success()){
324 msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class()));
325 }
327 /* Remove kerberos key dependencies too */
328 if(is_object($this->kerberos_key_service)){
329 $this->kerberos_key_service->remove_from_parent_by_prefix("host/");
330 }
332 /* Optionally execute a command after we're done */
333 $this->handle_post_events("remove",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
335 /* Delete references to object groups */
336 $ldap->cd ($this->config->current['BASE']);
337 $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
338 while ($ldap->fetch()){
339 $og= new ogroup($this->config, $ldap->getDN());
340 unset($og->member[$this->dn]);
341 $og->save ();
342 }
344 /* Remove all accessTo/trust dependencies */
345 update_accessTo($this->cn,"");
346 }
348 /* Clean queue form entries with this mac
349 */
350 if(class_available("gosaSupportDaemon") && tests::is_mac($this->netConfigDNS->orig_macAddress)){
351 $q = new gosaSupportDaemon();
352 $q->clean_queue_from_mac($this->netConfigDNS->orig_macAddress);
353 }
354 }
355 }
358 /* Save data to object */
359 function save_object()
360 {
361 /* Create a base backup and reset the
362 base directly after calling plugin::save_object();
363 Base will be set seperatly a few lines below */
364 $base_tmp = $this->base;
365 plugin::save_object();
366 $this->base = $base_tmp;
368 /* Refresh base */
369 if ($this->acl_is_moveable($this->base)){
370 if (!$this->baseSelector->update()) {
371 msg_dialog::display(_("Error"), msgPool::permMove(), ERROR_DIALOG);
372 }
373 if ($this->base != $this->baseSelector->getBase()) {
374 $this->base= $this->baseSelector->getBase();
375 $this->is_modified= TRUE;
376 }
377 }
379 $this->netConfigDNS->save_object();
381 /* Save terminal path to parent since it is used by termstartup, too */
382 if(isset($this->parent->by_object['termstartup'])){
383 $this->parent->by_object['termstartup']->gotoTerminalPath= $this->gotoTerminalPath;
384 }
386 if(isset($_POST['termgeneric_posted'])){
387 if(isset($_POST["inheritTimeServer"]) && $this->member_of_ogroup){
388 $this->inheritTimeServer = true;
389 }else{
390 $this->inheritTimeServer = false;
391 }
392 }
394 if(isset($_POST["inheritAll"])){
395 $this->set_everything_to_inherited();
396 }
398 /* Hanle kerberos host key plugin */
399 if(is_object($this->kerberos_key_service)){
400 $this->kerberos_key_service->save_object_by_prefix("host/");
401 }
402 }
405 /* Check supplied data */
406 function check()
407 {
408 /* Call common method to give check the hook */
409 $message= plugin::check();
411 /* Skip IP & Mac checks if this is a template */
412 if($this->cn != "default"){
413 $message= array_merge($message, $this->netConfigDNS->check());
414 }
416 /* Permissions for that base? */
417 $this->dn= "cn=".$this->cn.",".get_ou("termgeneric", "terminalRDN").$this->base;
419 if ($this->cn == ""){
420 $message[]= msgPool::required(_("Name"));
421 }
423 // Check if a wrong base was supplied
424 if(!$this->baseSelector->checkLastBaseUpdate()){
425 $message[]= msgPool::check_base();
426 }
428 /* Check if given name is a valid host/dns name */
429 if(!tests::is_dns_name($this->cn) ){
430 $message[] = msgPool::invalid(_("Name"));
431 }
433 if ($this->orig_dn == 'new'){
434 $ldap= $this->config->get_ldap_link();
435 $ldap->cd ($this->base);
437 /* It is possible to have a 'default' terminal on every base */
438 if($this->cn == "default"){
439 $ldap->cat($this->dn);
440 }else{
441 $ldap->search ("(&(objectClass=gotoTerminal)(cn=".$this->cn."))", array("cn"));
442 }
443 if ($ldap->count() != 0){
444 while ($attrs= $ldap->fetch()){
446 $matchArp = FALSE;
447 if(class_available("ArpNewDevice") &&
448 preg_match ("/,".preg_quote(get_ou("ArpNewDevice", "systemIncomingRDN"), '/')."/i", $ldap->getDN())){
449 $matchArp = TRUE;
450 }
452 if (preg_match("/cn=dhcp,/",$attrs['dn']) || $matchArp){
453 continue;
454 } else {
455 if ($attrs['dn'] != $this->orig_dn){
456 $message[]= msgPool::duplicated(_("Name"));
457 break;
458 }
459 }
460 }
461 }
462 }
464 /* Check for valid ntpServer selection */
465 if((!$this->inheritTimeServer) && (!count($this->gotoNtpServer))){
466 $message[]= msgPool::required(_("NTP server"));
467 }
469 /* Check if we are allowed to create or move this object
470 */
471 if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){
472 $message[] = msgPool::permCreate();
473 }elseif($this->orig_dn != "new" && $this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){
474 $message[] = msgPool::permMove();
475 }
477 return ($message);
478 }
481 /* Save to LDAP */
482 function save()
483 {
484 /* Detect mode changes */
485 $activate= (isset($this->saved_attributes['gotoMode']) &&
486 $this->gotoMode != $this->saved_attributes['gotoMode'] &&
487 $this->gotoMode == "active" &&
488 tests::is_ip($this->netConfigDNS->ipHostNumber)) || $this->auto_activate;
490 /* Find proper terminal path for tftp configuration
491 FIXME: This is suboptimal when the default has changed to
492 another location! */
493 if ($this->gotoTerminalPath == "default"){
494 $ldap= $this->config->get_ldap_link();
496 /* Strip relevant part from dn, keep trailing ',' */
497 $tmp= preg_replace("/^cn=[^,]+,".preg_quote(get_ou("termgeneric", "terminalRDN"), '/')."/i", "", $this->dn);
498 $tmp= preg_replace("/".$this->config->current['BASE']."$/i", "", $tmp);
500 /* Walk from top to base and try to load default values for
501 'gotoTerminalPath'. Abort when an entry is found. */
502 while (TRUE){
503 $tmp= preg_replace ("/^[^,]+,/", "", $tmp);
505 $ldap->cat("cn=default,".get_ou("termgeneric", "terminalRDN").$tmp.
506 $this->config->current['BASE'], array('gotoTerminalPath'));
507 $attrs= $ldap->fetch();
508 if (isset($attrs['gotoTerminalPath'])){
509 $this->gotoTerminalPath= $attrs['gotoTerminalPath'][0];
510 break;
511 }
513 /* Nothing left? */
514 if ($tmp == ""){
515 break;
516 }
517 }
518 }
520 plugin::save();
522 /* Strip out 'default' values */
523 foreach (array("gotoTerminalPath", "gotoSwapServer", "gotoSyslogServer") as $val){
524 if(isset($this->attrs[$val])){
525 if ($this->attrs[$val] == "default"){
526 $this->attrs[$val]= array();
527 }
528 }
529 }
531 /* Add missing arrays */
532 foreach (array("ghScsiDev", "ghIdeDev", "ghNetNic") as $val){
533 if (isset ($this->$val) && count ($this->$val) != 0){
534 $this->attrs["$val"]= $this->$val;
535 }
536 }
538 /* Remove all empty values */
539 if ($this->orig_dn == 'new'){
540 $attrs= array();
541 foreach ($this->attrs as $key => $val){
542 if (is_array($val) && count($val) == 0){
543 continue;
544 }
545 $attrs[$key]= $val;
546 }
547 $this->attrs= $attrs;
548 }
550 /* Set ntpServers */
551 $this->attrs['gotoNtpServer'] = array();
552 if(!$this->inheritTimeServer){
553 foreach($this->gotoNtpServer as $server){
554 $this->attrs['gotoNtpServer'][] = $server;
555 }
556 }
558 /* cn=default and macAddress=- indicates that this is a template */
559 if($this->cn == "default"){
560 $this->netConfigDNS->macAddress = "-";
561 }
563 /* Write back to ldap */
564 $ldap= $this->config->get_ldap_link();
565 if ($this->orig_dn == 'new'){
566 $ldap->cd($this->config->current['BASE']);
567 $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
568 $ldap->cd($this->dn);
569 if (!count($this->attrs['gotoNtpServer'])){
570 unset($this->attrs['gotoNtpServer']);
571 }
572 $ldap->add($this->attrs);
573 new log("create","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
575 $this->netConfigDNS->cn = $this->cn;
576 $this->netConfigDNS->save();
578 $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
579 } else {
580 $ldap->cd($this->dn);
581 $this->cleanup();
582 $ldap->modify ($this->attrs);
583 new log("modify","terminal/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
585 $this->netConfigDNS->cn = $this->cn;
586 $this->netConfigDNS->save();
588 $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
590 /* Update all accessTo/trust dependencies */
591 if($this->orig_cn != $this->cn){
592 update_accessTo($this->orig_cn,$this->cn);
593 }
594 }
596 if (!$ldap->success()){
597 msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
598 }
600 /* Send installation activation
601 */
602 if ($activate && class_available("DaemonEvent")){
603 $events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);
604 $o_queue = new gosaSupportDaemon();
605 if(isset($events['TRIGGERED']['DaemonEvent_installation_activation'])){
606 $evt = $events['TRIGGERED']['DaemonEvent_installation_activation'];
607 $tmp = new $evt['CLASS_NAME']($this->config);
608 $tmp->set_type(TRIGGERED_EVENT);
609 $tmp->add_targets(array($this->netConfigDNS->macAddress));
610 if(!$o_queue->append($tmp)){
611 msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
612 }
613 }
614 }
615 }
618 /* Display generic part for server copy & paste */
619 function getCopyDialog()
620 {
621 $vars = array("cn");
622 $smarty = get_smarty();
623 $smarty->assign("cn" , set_post($this->cn));
624 $smarty->assign("object","terminal");
625 $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
626 $ret = array();
627 $ret['string'] = $str;
628 $ret['status'] = "";
629 return($ret);
630 }
633 function saveCopyDialog()
634 {
635 if(isset($_POST['cn'])){
636 $this->cn = get_post('cn');
637 }
638 }
641 function PrepareForCopyPaste($source)
642 {
643 plugin::PrepareForCopyPaste($source);
644 if(isset($source['macAddress'][0])){
645 $this->netConfigDNS->macAddress = $source['macAddress'][0];
646 }
647 if(isset($source['ipHostNumber'][0])){
648 $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
649 }
651 /* Create used ntp server array */
652 $this->gotoNtpServer= array();
653 if(isset($source['gotoNtpServer'])){
654 $this->inheritTimeServer = false;
655 unset($source['gotoNtpServer']['count']);
656 foreach($source['gotoNtpServer'] as $server){
657 $this->gotoNtpServer[$server] = $server;
658 }
659 }
661 /* Set inherit checkbox state */
662 if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer)==0)){
663 $this->inheritTimeServer = true;
664 $this->gotoNtpServer=array();
665 }
666 }
669 /* Return plugin informations for acl handling */
670 static function plInfo()
671 {
672 return (array(
673 "plShortName" => _("Terminal"),
674 "plDescription" => _("Terminal generic"),
675 "plSelfModify" => FALSE,
676 "plDepends" => array(),
677 "plPriority" => 1,
678 "plSection" => array("administration"),
679 "plRequirements"=> array(
680 'ldapSchema' => array('gotoTerminal' => '>=2.7'),
681 'onFailureDisablePlugin' => array(get_class())
682 ),
683 "plCategory" => array("terminal" => array( "description" => _("Terminal"),
684 "objectClass" => "gotoTerminal")),
685 "plProperties" =>
686 array(
687 array(
688 "name" => "terminalRDN",
689 "type" => "rdn",
690 "default" => "ou=terminals,ou=systems,",
691 "description" => _("RDN for terminal storage."),
692 "check" => "gosaProperty::isRdn",
693 "migrate" => "migrate_terminalRDN",
694 "group" => "plugin",
695 "mandatory" => FALSE
696 )
697 ),
699 "plProvidedAcls"=> array(
700 "cn" => _("Name"),
701 "description" => _("Description"),
702 "base" => _("Base"),
704 "gotoMode" => _("Mode"),
705 "gotoSyslogServer" => _("Syslog server enabled"),
707 "gotoTerminalPath" => _("Root server"),
708 "gotoSwapServer" => _("Swap server"),
710 "gotoNtpServer" => _("NTP server settings"),
711 "userPassword" => _("Root password"),
713 "FAIstate" => _("Action flag"))
714 ));
715 }
718 function set_everything_to_inherited()
719 {
720 $this->gotoTerminalPath = "default";
721 $this->gotoSwapServer = "default" ;
722 $this->gotoSyslogServer = "default";
723 $this->inheritTimeServer = TRUE;
725 /* Set workstation service attributes to inherited */
726 if($this->member_of_ogroup && isset($this->parent->by_object['termservice'])){
727 foreach(array("gotoXKbLayout","gotoXKbModel","gotoXKbVariant","gotoXDriver",
728 "gotoXResolution","gotoXColordepth","gotoXMouseType","gotoXMouseport") as $name){
729 $this->parent->by_object['termservice']->$name = "default";
730 }
731 }
733 /* Set workstation startup attributes to inherited */
734 if($this->member_of_ogroup && isset($this->parent->by_object['termstartup'])){
735 $this->parent->by_object['termstartup']->gotoBootKernel = "default-inherited";
736 $this->parent->by_object['termstartup']->gotoLdapServer = "default-inherited";
737 $this->parent->by_object['termstartup']->gotoLdap_inherit = TRUE;
738 $this->parent->by_object['termstartup']->gotoLdapServers = array();
739 }
740 }
743 function is_modal_dialog()
744 {
745 return((isset($this->dialog) && $this->dialog) || (isset($this->netConfigDNS->dialog) && $this->netConfigDNS->dialog));
746 }
748 }
750 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
751 ?>