1 <?php
3 class workgeneric extends plugin
4 {
5 /* Generic terminal attributes */
6 var $gotoMode= "locked";
7 var $initial_gotoMode= "locked";
8 var $gotoSyslogServer= "";
9 var $gotoSyslogServers= array();
10 var $gotoNtpServer= array();
11 var $gotoNtpServers= array();
12 var $gotoSndModule= "";
13 var $gotoFloppyEnable= "";
14 var $gotoCdromEnable= "";
15 var $description= "";
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 $FAIscript= "";
26 var $view_logged = FALSE;
27 var $auto_activate= FALSE;
29 /* Needed values and lists */
30 var $base= "";
31 var $cn= "";
32 var $l= "";
33 var $orig_dn= "";
34 var $orig_cn= "";
35 var $orig_base= "";
37 /* Plugin side filled */
38 var $modes= array();
40 var $netConfigDNS;
42 var $inheritTimeServer = true;
44 /* attribute list for save action */
45 var $ignore_account= TRUE;
46 var $attributes= array("gotoMode", "gotoSyslogServer", "gotoNtpServer",
47 "gotoFloppyEnable", "gotoCdromEnable", "cn", "gotoSndModule",
48 "ghCpuType", "ghMemSize", "ghUsbSupport", "description",
49 "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser", "l","FAIscript");
50 var $objectclasses= array("top", "gotoWorkstation", "GOhard");
52 var $validActions = array("reboot" => "", "localboot" => "", "halt" => "", "update" => "", "reinstall" => "",
53 "rescan" => "", "wake" => "", "memcheck" => "", "sysinfo" => "");
55 var $fai_activated = FALSE;
57 var $member_of_ogroup = FALSE;
59 var $currently_installing = FALSE;
60 var $currently_installing_warned = FALSE;
62 function workgeneric (&$config, $dn= NULL, $parent= NULL)
63 {
64 $tmp= $config->search("faiManagement", "CLASS",array('menu','tabs'));
65 if(!empty($tmp)){
66 $this->fai_activated = TRUE;
67 }
69 plugin::plugin ($config, $dn, $parent);
71 if(!isset($this->parent->by_object['ogroup'])){
72 $ldap = $this->config->get_ldap_link();
73 $ldap->cd ($this->config->current['BASE']);
74 $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".LDAP::prepare4filter($this->dn)."))",array("cn"));
75 $this->member_of_ogroup = $ldap->count() >= 1;
76 }
78 $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses);
80 /* Check if this host is currently in installation process*/
81 if(class_available("gosaSupportDaemon") && class_available("DaemonEvent")){
82 $o = new gosaSupportDaemon();
83 $e_types = DaemonEvent::get_event_types(USER_EVENT | SYSTEM_EVENT | HIDDEN_EVENT);
84 $evts = $o->get_entries_by_mac(array($this->netConfigDNS->macAddress));
85 foreach($evts as $evt){
86 if(isset($e_types['QUEUED'][$evt['HEADERTAG']]) && $evt['STATUS'] == "processing" &&
87 $e_types['QUEUED'][$evt['HEADERTAG']] == "DaemonEvent_reinstall"){
88 $this->currently_installing =TRUE;
89 }
90 }
91 }
93 /* Read arrays */
94 foreach (array("ghNetNic", "ghIdeDev", "ghScsiDev") as $val){
95 if (!isset($this->attrs[$val])){
96 continue;
97 }
98 for ($i= 0; $i<$this->attrs[$val]['count']; $i++){
99 array_push($this->$val, $this->attrs[$val][$i]);
100 }
101 }
103 /* Create used ntp server array */
104 $this->gotoNtpServer= array();
105 if(isset($this->attrs['gotoNtpServer'])){
106 $this->inheritTimeServer = false;
107 unset($this->attrs['gotoNtpServer']['count']);
108 foreach($this->attrs['gotoNtpServer'] as $server){
109 $this->gotoNtpServer[$server] = $server;
110 }
111 }
113 /* Set inherit checkbox state */
114 if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer) == 0)){
115 $this->inheritTimeServer = true;
116 $this->gotoNtpServer=array();
117 }
119 /* You can't inherit the NTP service, if we are not member in an object group */
120 if(!$this->member_of_ogroup){
121 $this->inheritTimeServer = FALSE;
122 }
124 /* Create available ntp options */
125 $tmp = $this->config->data['SERVERS']['NTP'];
126 $this->gotoNtpServers = array();
127 foreach($tmp as $key => $server){
128 if($server == "default") continue;
129 $this->gotoNtpServers[$server] = $server;
130 }
132 $this->modes["active"]= _("Activated");
133 $this->modes["locked"]= _("Locked");
135 /* Set base */
136 if ($this->dn == "new"){
137 $ui= get_userinfo();
138 $this->base= dn2base($ui->dn);
139 } else {
140 $this->base= preg_replace ("/^[^,]+,".normalizePreg(get_ou("workstationou"))."/i", "", $this->dn);
141 }
143 /* Create an array of all Syslog servers */
144 $tmp = $this->config->data['SERVERS']['SYSLOG'];
145 foreach($tmp as $server){
146 $visible = $server;
147 if($server == "default" && $this->member_of_ogroup) {
148 $visible = "["._("inherited")."]";
149 }
150 $this->gotoSyslogServers[$server] = $visible;
151 }
153 $this->initial_gotoMode = $this->gotoMode;
155 /* Save 'dn' for later referal */
156 $this->orig_dn= $this->dn;
157 $this->orig_cn= $this->cn;
158 $this->orig_base= $this->base;
159 }
162 function set_acl_base($base)
163 {
164 plugin::set_acl_base($base);
165 $this->netConfigDNS->set_acl_base($base);
166 }
168 function set_acl_category($cat)
169 {
170 plugin::set_acl_category($cat);
171 $this->netConfigDNS->set_acl_category($cat);
172 }
174 function execute()
175 {
176 /* Call parent execute */
177 plugin::execute();
179 if($this->is_account && !$this->view_logged){
180 $this->view_logged = TRUE;
181 new log("view","workstation/".get_class($this),$this->dn);
182 }
184 /* Do we need to flip is_account state? */
185 if(isset($_POST['modify_state'])){
186 if($this->is_account && $this->acl_is_removeable()){
187 $this->is_account= FALSE;
188 }elseif(!$this->is_account && $this->acl_is_createable()){
189 $this->is_account= TRUE;
190 }
191 }
193 if ((isset($_POST['action'])) && ($this->acl_is_writeable("FAIstate")) && isset($this->validActions[$_POST['saction']]) ){
194 $action= $_POST['saction'];
196 /* Check if we have an DaemonEvent for this action */
197 if(class_available("DaemonEvent")){
198 $events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);
199 if(isset($events['TRIGGERED']["DaemonEvent_".$action])){
200 $evt = $events['TRIGGERED']["DaemonEvent_".$action];
201 $tmp = new $evt['CLASS_NAME']($this->config);
202 $tmp->add_targets(array($this->netConfigDNS->macAddress));
203 $tmp->set_type(TRIGGERED_EVENT);
204 $o_queue = new gosaSupportDaemon();
205 if(!$o_queue->append($tmp)){
206 msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
207 }
208 }
209 } else {
210 msg_dialog::display(_("Event error"),
211 sprintf(_("Event '%s' is not available!"),$action),ERROR_DIALOG);
212 }
215 }
217 /* Do we represent a valid terminal? */
218 if (!$this->is_account && $this->parent === NULL){
219 $display= "<img alt=\"\" src=\"images/small-error.png\" align=middle> <b>".
220 msgPool::noValidExtension(_("workstation"))."</b>";
221 return($display);
222 }
224 /* Base select dialog */
225 $once = true;
226 foreach($_POST as $name => $value){
227 if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_writeable("base")){
228 $once = false;
229 $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
230 $this->dialog->setCurrentBase($this->base);
231 }
232 }
234 /* Dialog handling */
235 if(is_object($this->dialog)){
236 /* Must be called before save_object */
237 $this->dialog->save_object();
239 if($this->dialog->isClosed()){
240 $this->dialog = false;
241 }elseif($this->dialog->isSelected()){
243 /* A new base was selected, check if it is a valid one */
244 $tmp = $this->get_allowed_bases();
245 if(isset($tmp[$this->dialog->isSelected()])){
246 $this->base = $this->dialog->isSelected();
247 }
249 $this->dialog= false;
250 }else{
251 return($this->dialog->execute());
252 }
253 }
255 /* Add new ntp Server to our list */
256 if((isset($_POST['addNtpServer'])) && (isset($_POST['gotoNtpServers'])) && $this->acl_is_writeable("gotoNtpServer")){
257 $this->gotoNtpServer[$_POST['gotoNtpServers']] = $_POST['gotoNtpServers'];
258 }
260 /* Delete selected NtpServer for list of used servers */
261 if((isset($_POST['delNtpServer'])) && (isset($_POST['gotoNtpServerSelected'])) && $this->acl_is_writeable("gotoNtpServer")){
262 foreach($_POST['gotoNtpServerSelected'] as $name){
263 unset($this->gotoNtpServer[$name]);
264 }
265 }
267 /* Fill templating stuff */
268 $smarty= get_smarty();
270 /* Set acls */
271 $tmp = $this->plInfo();
272 foreach($tmp['plProvidedAcls'] as $name => $translation){
273 $smarty->assign($name."ACL",$this->getacl($name));
274 }
276 $smarty->assign("cn", $this->cn);
277 $smarty->assign("description", $this->description);
278 $smarty->assign("l", $this->l);
279 $smarty->assign("bases", $this->get_allowed_bases());
280 $smarty->assign("staticAddress", "");
282 $tmp = array();
283 foreach($this->gotoNtpServers as $server){
284 if(!in_array($server,$this->gotoNtpServer)){
285 $tmp[$server] = $server;
286 }
287 }
288 $smarty->assign("gotoNtpServers",$tmp);
290 /* Check if workstation is online */
291 if (gosaSupportDaemon::ping($this->netConfigDNS->macAddress)){
292 $smarty->assign("actions", array("halt" => _("Switch off"), "reboot" => _("Reboot"),
293 "update" => _("System update"),
294 "reinstall" => _("Reinstall"),
295 "rescan" => _("Rescan hardware"),
296 "memcheck" => _("Memory test"),
297 "localboot" => _("Force localboot"),
298 "sysinfo" => _("System analysis")));
299 } else {
300 $smarty->assign("actions", array("wake" => _("Wake up"),
301 "reinstall" => _("Reinstall"),
302 "update" => _("System update"),
303 "memcheck" => _("Memory test"),
304 "localboot" => _("Force localboot"),
305 "sysinfo" => _("System analysis")));
306 }
307 /* Arrays */
308 $smarty->assign("modes", $this->modes);
309 $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']);
310 $smarty->assign("syslogservers", $this->gotoSyslogServers);
311 $smarty->assign("fai_activated",$this->fai_activated);
313 $ntpser = array();
314 foreach($this->gotoNtpServers as $server){
315 if(!in_array($server,$this->gotoNtpServer)){
316 $ntpser[$server] = $server;
317 }
318 }
319 $smarty->assign("gotoNtpServers", $ntpser);
321 /* Variables */
322 foreach(array("base", "gotoMode", "gotoSyslogServer", "gotoNtpServer") as $val){
323 $smarty->assign($val."_select", $this->$val);
324 }
326 /* tell smarty the inherit checkbox state */
327 $smarty->assign("inheritTimeServer",$this->inheritTimeServer);
328 $smarty->assign("member_of_ogroup",$this->member_of_ogroup);
330 $str = $this->netConfigDNS->execute();
331 if(is_object($this->netConfigDNS->dialog)){
332 return($str);
333 }
334 $smarty->assign("netconfig", $str);
336 /* Show main page */
337 $smarty->assign("currently_installing", $this->currently_installing);
338 return($smarty->fetch (get_template_path('workstation.tpl', TRUE, dirname(__FILE__))));
339 }
341 function remove_from_parent()
342 {
343 if($this->acl_is_removeable()){
345 $this->netConfigDNS->remove_from_parent();
346 $ldap= $this->config->get_ldap_link();
347 $ldap->rmdir($this->dn);
348 new log("remove","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
349 if (!$ldap->success()){
350 msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class()));
351 }
353 /* Optionally execute a command after we're done */
354 $this->handle_post_events("remove", array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
356 /* Delete references to object groups */
357 $ldap->cd ($this->config->current['BASE']);
358 $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
359 while ($ldap->fetch()){
360 $og= new ogroup($this->config, $ldap->getDN());
361 unset($og->member[$this->dn]);
362 $og->save ();
363 }
365 /* Remove all accessTo/trust dependencies */
366 update_accessTo($this->cn,"");
367 }
369 /* Clean queue form entries with this mac
370 */
371 if(class_available("gosaSupportDaemon") && tests::is_mac($this->netConfigDNS->orig_macAddress)){
372 $q = new gosaSupportDaemon();
373 $q->clean_queue_from_mac($this->netConfigDNS->orig_macAddress);
374 }
376 if(isset($_POST["inheritAll"])){
377 $this->set_everything_to_inherited();
378 }
379 }
382 /* Save data to object */
383 function save_object()
384 {
386 /* Create a base backup and reset the
387 base directly after calling plugin::save_object();
388 Base will be set seperatly a few lines below */
389 $base_tmp = $this->base;
390 plugin::save_object();
391 $this->base = $base_tmp;
393 /* Save base, since this is no LDAP attribute */
394 $tmp = $this->get_allowed_bases();
395 if(isset($_POST['base'])){
396 if(isset($tmp[$_POST['base']])){
397 $this->base= $_POST['base'];
398 }
399 }
401 $this->netConfigDNS->save_object();
403 /* Set inherit mode */
404 if((isset($_POST['workgeneric_posted'])) && ($this->acl_is_writeable("gotoNtpServer"))){
405 if(isset($_POST["inheritTimeServer"]) && $this->member_of_ogroup){
406 $this->inheritTimeServer = true;
407 }else{
408 $this->inheritTimeServer = false;
409 }
410 }
412 if(isset($_POST["inheritAll"])){
413 $this->set_everything_to_inherited();
414 }
415 }
418 /* Check supplied data */
419 function check()
420 {
421 /* Call common method to give check the hook */
422 $message= plugin::check();
424 /* Skip IP & Mac checks if this is a template */
425 if($this->cn != "wdefault"){
426 $message= array_merge($message, $this->netConfigDNS->check());
427 }
429 $this->dn= "cn=".$this->cn.",".get_ou('workstationou').$this->base;
431 if ($this->cn == ""){
432 $message[]= msgPool::required(_("Name"));
433 }
435 /* Check if given name is a valid host/dns name */
436 if(!tests::is_dns_name($this->cn)){
437 $message[] = msgPool::invalid(_("Name"));
438 }
440 if ($this->orig_dn != $this->dn){
441 $ldap= $this->config->get_ldap_link();
442 $ldap->cd ($this->base);
444 if($this->cn == "wdefault"){
445 $ldap->cat($this->dn);
446 }else{
447 $ldap->search ("(&(cn=".$this->cn.")(objectClass=gotoWorkstation))", array("cn"));
448 }
449 if ($ldap->count() != 0){
450 while ($attrs= $ldap->fetch()){
451 if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".get_ou('incomingou')."/", $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 /* Only systems with a valid ldap handle can be activated
469 */
470 if($this->gotoMode == "active" && $this->initial_gotoMode != "active"){
472 if(isset($this->parent->by_object['workstartup']) &&
473 !count($this->parent->by_object['workstartup']->gotoLdapServers) &&
474 !$this->parent->by_object['workstartup']->gotoLdap_inherit){
476 $message[] = _("In order to activate this system a valid ldap handle is required, please select at least one ldap URI in the workstation startup tab.");
477 }
478 }else{
479 /* Warn the user, that this host is currently installing */
480 if($this->currently_installing && !$this->currently_installing_warned &&
481 !preg_match("/".normalizePreg(get_ou("incomingou"))."/",$this->orig_dn)){
483 /* Force aborting without message dialog */
484 $message[] = "";
485 $this->currently_installing_warned = TRUE;
486 msg_dialog::display(_("Software deployment"),
487 _("This host is currently installing, if you really want to save it, press 'OK'."),
488 CONFIRM_DIALOG);
489 }
490 }
492 /* Check if we are allowed to create or move this object
493 */
494 if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){
495 $message[] = msgPool::permCreate();
496 }elseif($this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){
497 $message[] = msgPool::permMove();
498 }
500 return ($message);
501 }
504 /* Save to LDAP */
505 function save()
506 {
507 /* Detect mode changes */
508 $activate= (isset($this->saved_attributes['gotoMode']) &&
509 $this->gotoMode != $this->saved_attributes['gotoMode'] &&
510 $this->gotoMode == "active" &&
511 tests::is_ip($this->netConfigDNS->ipHostNumber)) || $this->auto_activate;
512 plugin::save();
514 /* Strip out 'default' values */
515 foreach (array("gotoSyslogServer") as $val){
517 if (isset($this->attrs[$val]) && $this->attrs[$val] == "default"){
518 $this->attrs[$val]= array();
519 }
520 }
522 /* Add missing arrays */
523 foreach (array("ghScsiDev", "ghIdeDev", "ghNetNic") as $val){
524 if (isset ($this->$val) && count ($this->$val) != 0){
525 $this->attrs["$val"]= $this->$val;
526 }
527 }
529 /* Remove all empty values */
530 if ($this->orig_dn == 'new'){
531 $attrs= array();
532 foreach ($this->attrs as $key => $val){
533 if (is_array($val) && count($val) == 0){
534 continue;
535 }
536 $attrs[$key]= $val;
537 }
538 $this->attrs= $attrs;
539 }
541 /* Update ntp server settings */
542 if($this->inheritTimeServer){
543 if($this->is_new){
544 if(isset($this->attrs['gotoNtpServer'])){
545 unset($this->attrs['gotoNtpServer']);
546 }
547 }else{
548 $this->attrs['gotoNtpServer'] = array();
549 }
550 }else{
551 /* Set ntpServers */
552 $this->attrs['gotoNtpServer'] = array();
553 foreach($this->gotoNtpServer as $server){
554 $this->attrs['gotoNtpServer'][] = $server;
555 }
556 }
558 /* Write back to ldap */
559 $ldap= $this->config->get_ldap_link();
560 if ($this->orig_dn == 'new'){
561 $ldap->cd($this->config->current['BASE']);
562 $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
563 $ldap->cd($this->dn);
564 $ldap->add($this->attrs);
565 new log("create","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
566 if (!$ldap->success()){
567 msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
568 }
569 $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
570 } else {
571 if ($this->orig_dn != $this->dn){
573 /* Remove all accessTo/trust dependencies */
574 update_accessTo($this->orig_cn,$this->cn);
575 }
576 $ldap->cd($this->dn);
577 $this->cleanup();
578 $ldap->modify ($this->attrs);
579 if (!$ldap->success()){
580 msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class()));
581 }
582 new log("modify","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
583 $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
584 }
586 /* cn=default and macAddress=- indicates that this is a template */
587 if($this->cn == "wdefault"){
588 $this->netConfigDNS->macAddress = "-";
589 }
591 $this->netConfigDNS->cn = $this->cn;
592 $this->netConfigDNS->save();
594 if ($activate && class_available("DaemonEvent")){
596 /* Send installation activation
597 */
598 $events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);
599 $o_queue = new gosaSupportDaemon();
600 if(isset($events['TRIGGERED']['DaemonEvent_installation_activation'])){
601 $evt = $events['TRIGGERED']['DaemonEvent_installation_activation'];
602 $tmp = new $evt['CLASS_NAME']($this->config);
603 $tmp->set_type(TRIGGERED_EVENT);
604 $tmp->add_targets(array($this->netConfigDNS->macAddress));
605 if(!$o_queue->append($tmp)){
606 msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
607 }
608 }
609 }
610 }
613 /* Display generic part for server copy & paste */
614 function getCopyDialog()
615 {
616 $vars = array("cn");
617 $smarty = get_smarty();
618 $smarty->assign("cn" ,$this->cn);
619 $smarty->assign("object","workstation");
620 $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
621 $ret = array();
622 $ret['string'] = $str;
623 $ret['status'] = "";
624 return($ret);
625 }
628 function saveCopyDialog()
629 {
630 if(isset($_POST['cn'])){
631 $this->cn = $_POST['cn'];
632 }
633 }
636 function PrepareForCopyPaste($source)
637 {
638 plugin::PrepareForCopyPaste($source);
639 if(isset($source['macAddress'][0])){
640 $this->netConfigDNS->macAddress = $source['macAddress'][0];
641 }
642 if(isset($source['ipHostNumber'][0])){
643 $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
644 }
646 /* Create used ntp server array */
647 $this->gotoNtpServer= array();
648 if(isset($source['gotoNtpServer'])){
649 $this->inheritTimeServer = false;
650 unset($source['gotoNtpServer']['count']);
651 foreach($source['gotoNtpServer'] as $server){
652 $this->gotoNtpServer[$server] = $server;
653 }
654 }
656 /* Set inherit checkbox state */
657 if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer)==0)){
658 $this->inheritTimeServer = true;
659 $this->gotoNtpServer=array();
660 }
661 }
664 /* Return plugin informations for acl handling
665 #FIXME FAIscript seams to ununsed within this class... */
666 static function plInfo()
667 {
668 return (array(
669 "plShortName" => _("Generic"),
670 "plDescription" => _("Workstation generic"),
671 "plSelfModify" => FALSE,
672 "plDepends" => array(),
673 "plPriority" => 0,
674 "plSection" => array("administration"),
675 "plCategory" => array("workstation" => array("description" => _("Workstation"),
676 "objectClass" => "gotoWorkstation")),
677 "plProvidedAcls"=> array(
678 "cn" => _("Workstation name"),
679 "description" => _("Description") ,
680 "l" => _("Location") ,
681 "base" => _("Base") ,
682 "gotoMode" => _("Goto mode"),
683 "gotoSyslogServer" => _("Syslog server"),
684 "gotoNtpServer" => _("Ntp server"),
685 "gotoRootPasswd" => _("Root password"),
686 "FAIstate" => _("Action flag"))
687 ));
688 }
690 function set_everything_to_inherited()
691 {
692 $this->gotoSyslogServer = "default";
693 $this->inheritTimeServer = TRUE;
695 /* Set workstation service attributes to inherited */
696 if($this->member_of_ogroup && isset($this->parent->by_object['workservice'])){
697 foreach(array("gotoXKbLayout","gotoXKbModel","gotoXKbVariant",
698 "gotoXResolution","gotoXColordepth","gotoXMouseType","gotoXMouseport") as $name){
699 $this->parent->by_object['workservice']->$name = "default";
700 }
701 }
703 /* Set workstation startup attributes to inherited */
704 if($this->member_of_ogroup && isset($this->parent->by_object['workstartup'])){
705 $this->parent->by_object['workstartup']->gotoBootKernel = "default-inherited";
706 $this->parent->by_object['workstartup']->gotoLdapServer = "default-inherited";
707 $this->parent->by_object['workstartup']->FAIdebianMirror= "inherited";
708 }
709 }
710 }
711 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
712 ?>