Code

Updated event handling
[gosa.git] / gosa-plugins / goto / admin / systems / goto / class_workstationGeneric.inc
1 <?php
3 class workgeneric extends plugin
4 {
5   /* CLI vars */
6   var $cli_summary= "Manage workstation base objects";
7   var $cli_description= "Some longer text\nfor help";
8   var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
10   /* Generic terminal attributes */
11   var $gotoMode= "locked";
12   var $gotoSyslogServer= "";
13   var $gotoSyslogServers= array();
14   var $gotoNtpServer= array();
15   var $gotoNtpServers= array();
16   var $gotoSndModule= "";
17   var $gotoFloppyEnable= "";
18   var $gotoCdromEnable= "";
19   var $description= "";
20   var $ghCpuType= "-";
21   var $ghMemSize= "-";
22   var $ghUsbSupport= "-";
23   var $ghNetNic= array();
24   var $ghIdeDev= array();
25   var $ghScsiDev= array();
26   var $ghGfxAdapter= "-";
27   var $ghSoundAdapter= "-";
28   var $gotoLastUser= "-";
29   var $FAIscript= "";
30   var $didAction= FALSE;
31   var $FAIstate= "";
32   var $view_logged = FALSE;
34   /* Needed values and lists */
35   var $base= "";
36   var $cn= "";
37   var $l= "";
38   var $orig_dn= "";
40   /* Plugin side filled */
41   var $modes= array();
43   var $netConfigDNS;
45   var $inheritTimeServer = true;
47   /* attribute list for save action */
48   var $ignore_account= TRUE;
49   var $attributes= array("gotoMode", "gotoSyslogServer", "gotoNtpServer",
50       "gotoFloppyEnable", "gotoCdromEnable", "cn", "gotoSndModule",
51       "ghCpuType", "ghMemSize", "ghUsbSupport", "description",
52       "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser", "l","FAIscript");
53   var $objectclasses= array("top", "gotoWorkstation", "GOhard");
55   var $mapActions   = array("reboot"          => "",
56                             "localboot"       => "localboot",
57                             "halt"            => "",
58                             "update"          => "softupdate",
59                             "reinstall"       => "install",
60                             "rescan"          => "",
61                             "wake"            => "",
62                             "memcheck"        => "memcheck",
63                             "sysinfo"         => "sysinfo");
65   
66   var $fai_activated = FALSE;
68   var $member_of_ogroup = FALSE;
70   function workgeneric (&$config, $dn= NULL, $parent= NULL)
71   {
72     $tmp= $config->search("faiManagement", "CLASS",array('menu','tabs'));
73     if(!empty($tmp)){
74       $this->fai_activated = TRUE;
75     }
77     plugin::plugin ($config, $dn, $parent);
79     if(!isset($this->parent->by_object['ogroup'])){
80       $ldap = $this->config->get_ldap_link();
81       $ldap->cd ($this->config->current['BASE']);
82       $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".LDAP::prepare4filter($this->dn)."))",array("cn"));
83       $this->member_of_ogroup = $ldap->count() >= 1;
84     }
86     $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses);
88     /* Read arrays */
89     foreach (array("ghNetNic", "ghIdeDev", "ghScsiDev") as $val){
90       if (!isset($this->attrs[$val])){
91         continue;
92       }
93       for ($i= 0; $i<$this->attrs[$val]['count']; $i++){
94         array_push($this->$val, $this->attrs[$val][$i]);
95       }
96     }
98     /* Create used ntp server array */
99     $this->gotoNtpServer= array();
100     if(isset($this->attrs['gotoNtpServer'])){
101       $this->inheritTimeServer = false;
102       unset($this->attrs['gotoNtpServer']['count']);
103       foreach($this->attrs['gotoNtpServer'] as $server){
104         $this->gotoNtpServer[$server] = $server;
105       }
106     }
108     /* Set inherit checkbox state */
109     if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer) == 0)){
110       $this->inheritTimeServer = true;
111       $this->gotoNtpServer=array();
112     }
114     /* You can't inherit the NTP service, if we are not member in an object group */
115     if(!$this->member_of_ogroup){
116       $this->inheritTimeServer = FALSE;
117     }
119     /* Create available ntp options */
120     $tmp = $this->config->data['SERVERS']['NTP'];
121     $this->gotoNtpServers = array();
122     foreach($tmp as $key => $server){
123       if($server == "default") continue;
124       $this->gotoNtpServers[$server] = $server;
125     }
127     $this->modes["active"]= _("Activated");
128     $this->modes["locked"]= _("Locked");
130     /* Set base */
131     if ($this->dn == "new"){
132       $ui= get_userinfo();
133       $this->base= dn2base($ui->dn);
134     } else {
135       $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn);
136     }
138     /* Create an array of all Syslog servers */
139     $tmp = $this->config->data['SERVERS']['SYSLOG'];
140     foreach($tmp as $server){
141       $visible = $server;
142       if($server == "default" && $this->member_of_ogroup) {
143         $visible = "["._("inherited")."]";
144       }
145       $this->gotoSyslogServers[$server] = $visible;
146     }
148     /* Save 'dn' for later referal */
149     $this->orig_dn= $this->dn;
150   }
153   function set_acl_base($base)
154   {
155     plugin::set_acl_base($base);
156     $this->netConfigDNS->set_acl_base($base);
157   }
159   function set_acl_category($cat)
160   {
161     plugin::set_acl_category($cat);
162     $this->netConfigDNS->set_acl_category($cat);
163   }
165   function execute()
166   {
167     /* Call parent execute */
168     plugin::execute();
170     if($this->is_account && !$this->view_logged){
171       $this->view_logged = TRUE;
172       new log("view","workstation/".get_class($this),$this->dn);
173     }
175     /* Do we need to flip is_account state? */
176     if(isset($_POST['modify_state'])){
177       if($this->is_account && $this->acl_is_removeable()){
178         $this->is_account= FALSE;
179       }elseif(!$this->is_account && $this->acl_is_createable()){
180         $this->is_account= TRUE;
181       }
182     }
184     if ((isset($_POST['action'])) && ($this->acl_is_writeable("FAIstate")) && isset($this->mapActions[$_POST['saction']]) ){
186       /* Check given action */
187       $mapEvent = array("wake"           => "wakeup",
188                         "instant_update" => "update");
189       $action = $_POST['saction'];
190       if(isset($mapEvent[$action])){
191         $action = $mapEvent[$action];
192       }
194       /* Check if we have an DaemonEvent for this action */ 
195       if(class_available("DaemonEvent_".$action)){
196         $events = DaemonEvent::get_event_types();
197         if(isset($events['BY_CLASS']["DaemonEvent_".$action])){
198           $evt = $events['BY_CLASS']["DaemonEvent_".$action];
199           $tmp = new $evt['CLASS_NAME']($this->config);
200           $tmp->add_targets(array($this->netConfigDNS->macAddress));
201           $tmp->set_type(TRIGGERED_EVENT);
202           $o_queue = new gosaSupportDaemon();
203           if(!$o_queue->append($tmp)){
204             msg_dialog::display(_("Daemon"),sprintf(_("Something went wrong while talking to the daemon: %s."),
205                   $o_queue->get_error()),ERROR_DIALOG);
206           }
207         }
208       }else{
209   
210         msg_dialog::display(_("Missing Daemon Event"),
211                     sprintf(_("The requested action does not exists '%s' Sending event manually."),"DaemonEvent_".$action),ERROR_DIALOG);
213         /* No event found, send action manually. 
214          */
215         $method= "gosa";
216         $action= $_POST['saction'];
217         if ($action == "reinstall" || $action == "update" || $action == "instant_update"){
218           $method= "job";
219         }
221         gosaSupportDaemon::send("${method}_trigger_action_".$action,
222             $this->netConfigDNS->macAddress,
223             array("macAddress" => $this->netConfigDNS->macAddress));
224       }
227       if ($action != "wake") {
229         /* Set FAIstate */
230         if($this->fai_activated && $this->dn != "new"){
231             $ldap = $this->config->get_ldap_link();
232             $ldap->cd($this->config->current['BASE']);
233             $ldap->cat($this->dn,array("objectClass"));
234             $res = $ldap->fetch();
236             $attrs = array();
237             $attrs['FAIstate'] = $this->FAIstate;
238             if(isset($this->mapActions[$_POST['saction']]) && $this->mapActions[$_POST['saction']] != ""){
239               $attrs['FAIstate'] = $this->mapActions[$_POST ['saction']];
240             }
242             for($i = 0; $i < $res['objectClass']['count'] ; $i ++){
243               $attrs['objectClass'][] = $res['objectClass'][$i];
244             }
246             if(($attrs['FAIstate'] != "") && (!in_array("FAIobject",$attrs['objectClass']))){
247               $attrs['objectClass'][] = "FAIobject";
248             }
250             if($attrs['FAIstate'] == ""){
251               #FIXME we should check if FAIobject is not used anymore
252               $attrs['FAIstate'] = array();
253             }
255             $ldap->cd($this->dn);
256             $ldap->modify($attrs);
257             show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/generic (FAIstate) with dn '%s' failed."),$this->dn));
259           }
260           $this->didAction= TRUE;
261         }
262     }
264     /* Do we represent a valid terminal? */
265     if (!$this->is_account && $this->parent === NULL){
266       $display= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
267         _("This 'dn' has no workstation features.")."</b>";
268       return($display);
269     }
271     /* Base select dialog */
272     $once = true;
273     foreach($_POST as $name => $value){
274       if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_writeable("base")){
275         $once = false;
276         $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
277         $this->dialog->setCurrentBase($this->base);
278       }
279     }
281     /* Dialog handling */
282     if(is_object($this->dialog)){
283       /* Must be called before save_object */
284       $this->dialog->save_object();
286       if($this->dialog->isClosed()){
287         $this->dialog = false;
288       }elseif($this->dialog->isSelected()){
290         /* A new base was selected, check if it is a valid one */
291         $tmp = $this->get_allowed_bases();
292         if(isset($tmp[$this->dialog->isSelected()])){
293           $this->base = $this->dialog->isSelected();
294         }
296         $this->dialog= false;
297       }else{
298         return($this->dialog->execute());
299       }
300     }
302     /* Add new ntp Server to our list */ 
303     if((isset($_POST['addNtpServer'])) && (isset($_POST['gotoNtpServers'])) && $this->acl_is_writeable("gotoNtpServer")){
304       $this->gotoNtpServer[$_POST['gotoNtpServers']] = $_POST['gotoNtpServers'];
305     }
307     /* Delete selected NtpServer for list of used servers  */
308     if((isset($_POST['delNtpServer'])) && (isset($_POST['gotoNtpServerSelected'])) && $this->acl_is_writeable("gotoNtpServer")){
309       foreach($_POST['gotoNtpServerSelected'] as $name){
310         unset($this->gotoNtpServer[$name]);
311       }
312     }
314     /* Fill templating stuff */
315     $smarty= get_smarty();
317     /* Set acls */
318     $tmp = $this->plInfo();
319     foreach($tmp['plProvidedAcls'] as $name => $translation){
320       $smarty->assign($name."ACL",$this->getacl($name));
321     }
323     $smarty->assign("cn", $this->cn);
324     $smarty->assign("description", $this->description);
325     $smarty->assign("l", $this->l);
326     $smarty->assign("bases", $this->get_allowed_bases());
327     $smarty->assign("staticAddress", "");
329     $tmp = array();
330     foreach($this->gotoNtpServers as $server){
331       if(!in_array($server,$this->gotoNtpServer)){
332         $tmp[$server] = $server;
333       }
334     }
335     $smarty->assign("gotoNtpServers",$tmp);
336         
337     /* Check if workstation is online */
338     if (gosaSupportDaemon::ping($this->netConfigDNS->macAddress)){
339       $smarty->assign("actions", array("halt" => _("Switch off"), "reboot" => _("Reboot"),
340                                        "instant_update" => _("Instant update"),
341                                        "update" => _("Scheduled update"),
342                                        "reinstall" => _("Reinstall"),
343                                        "rescan" => _("Rescan hardware"),
344                                        "memcheck" => _("Memory test"),
345                                        "localboot" => _("Force localboot"),
346                                        "sysinfo"  => _("System analysis")));
347     } else {
348       $smarty->assign("actions", array("wake" => _("Wake up"),
349                                        "reinstall" => _("Reinstall"),
350                                        "update" => _("Scheduled update"),
351                                        "memcheck" => _("Memory test"),
352                                        "localboot" => _("Force localboot"),
353                                        "sysinfo"  => _("System analysis")));
354     }
355     /* Arrays */
356     $smarty->assign("modes", $this->modes);
357     $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']);
358     $smarty->assign("syslogservers", $this->gotoSyslogServers);
359     $smarty->assign("fai_activated",$this->fai_activated);
361     $ntpser = array();
362     foreach($this->gotoNtpServers as $server){
363       if(!in_array($server,$this->gotoNtpServer)){
364         $ntpser[$server] = $server;
365       }
366     }
367     $smarty->assign("gotoNtpServers", $ntpser);
369     /* Variables */
370     foreach(array("base", "gotoMode", "gotoSyslogServer", "gotoNtpServer") as $val){
371       $smarty->assign($val."_select", $this->$val);
372     }
374     /* tell smarty the inherit checkbox state */
375     $smarty->assign("inheritTimeServer",$this->inheritTimeServer);
376     $smarty->assign("member_of_ogroup",$this->member_of_ogroup);
378     $str = $this->netConfigDNS->execute();
379     if(is_object($this->netConfigDNS->dialog)){
380       return($str);
381     }
382     $smarty->assign("netconfig", $str);
384     /* Show main page */
385     return($smarty->fetch (get_template_path('workstation.tpl', TRUE, dirname(__FILE__))));
386   }
388   function remove_from_parent()
389   {
390     if($this->acl_is_removeable()){
392       $this->netConfigDNS->remove_from_parent();
393       $ldap= $this->config->get_ldap_link();
394       $ldap->rmdir($this->dn);
395       new log("remove","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
396       show_ldap_error($ldap->get_error(), sprintf(_("Removing of system workstation/generic with dn '%s' failed."),$this->dn));
398       /* Optionally execute a command after we're done */
399       $this->handle_post_events("remove", array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
401       /* Delete references to object groups */
402       $ldap->cd ($this->config->current['BASE']);
403       $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
404       while ($ldap->fetch()){
405         $og= new ogroup($this->config, $ldap->getDN());
406         unset($og->member[$this->dn]);
407         $og->save ();
408       }
409     }
411     if(isset($_POST["inheritAll"])){
412       $this->set_everything_to_inherited();
413     }
414   }
417   /* Save data to object */
418   function save_object()
419   {
421     /* Create a base backup and reset the
422        base directly after calling plugin::save_object();
423        Base will be set seperatly a few lines below */
424     $base_tmp = $this->base;
425     plugin::save_object();
426     $this->base = $base_tmp;
428     /* Save base, since this is no LDAP attribute */
429     $tmp = $this->get_allowed_bases();
430     if(isset($_POST['base'])){
431       if(isset($tmp[$_POST['base']])){
432         $this->base= $_POST['base'];
433       }
434     }
436     $this->netConfigDNS->save_object();
438     /* Set inherit mode */
439     if((isset($_POST['workgeneric_posted'])) && ($this->acl_is_writeable("gotoNtpServer"))){
440       if(isset($_POST["inheritTimeServer"]) && $this->member_of_ogroup){
441         $this->inheritTimeServer = true;
442       }else{
443         $this->inheritTimeServer = false;
444       }
445     }
446     
447     if(isset($_POST["inheritAll"])){
448       $this->set_everything_to_inherited();
449     }
450   }
453   /* Check supplied data */
454   function check()
455   {
456     /* Call common method to give check the hook */
457     $message= plugin::check();
458   
459     /* Skip IP & Mac checks if this is a template */
460     if($this->cn != "wdefault"){
461       $message= array_merge($message, $this->netConfigDNS->check());
462     }
464     $this->dn= "cn=".$this->cn.",".get_ou('workstationou').$this->base;
466     if ($this->cn == ""){
467       $message[]= _("The required field 'Workstation name' is not set.");
468     }
470     /* Check if given name is a valid host/dns name */
471     if(!tests::is_dns_name($this->cn)){
472       $message[] = _("Please specify a valid name for this object.");
473     }
475     if ($this->orig_dn != $this->dn){
476       $ldap= $this->config->get_ldap_link();
477       $ldap->cd ($this->base);
479       if($this->cn == "wdefault"){
480         $ldap->cat($this->dn);
481       }else{
482         $ldap->search ("(&(cn=".$this->cn.")(objectClass=gotoWorkstation))", array("cn"));
483       }
484       if ($ldap->count() != 0){
485         while ($attrs= $ldap->fetch()){
486           if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".get_ou('incomingou')."/", $ldap->getDN())){
487             continue;
488           } else {
489             if ($attrs['dn'] != $this->orig_dn){
490               $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn);
491               break;
492             }
493           }
494         }
495       }
496     }
498     /* Check for valid ntpServer selection */
499     if((!$this->inheritTimeServer) && (!count($this->gotoNtpServer))){
500       $message[]= _("There must be at least one NTP server selected, or the inherit mode activated.");
501     }
503     return ($message);
504   }
507   /* Save to LDAP */
508   function save()
509   {
510     /* Detect mode changes */
511     $activate= (isset($this->saved_attributes['gotoMode']) &&
512         $this->gotoMode != $this->saved_attributes['gotoMode'] &&
513         $this->gotoMode == "active" &&
514         tests::is_ip($this->netConfigDNS->ipHostNumber));
516     plugin::save();
518     /* Strip out 'default' values */
519     foreach (array("gotoSyslogServer") as $val){
521       if (isset($this->attrs[$val]) && $this->attrs[$val] == "default"){
522         $this->attrs[$val]= array();
523       }
524     }
526     /* Add missing arrays */
527     foreach (array("ghScsiDev", "ghIdeDev", "ghNetNic") as $val){
528       if (isset ($this->$val) && count ($this->$val) != 0){
529         $this->attrs["$val"]= $this->$val;
530       }
531     }
533     /* Remove all empty values */
534     if ($this->orig_dn == 'new'){
535       $attrs= array();
536       foreach ($this->attrs as $key => $val){
537         if (is_array($val) && count($val) == 0){
538           continue;
539         }
540         $attrs[$key]= $val;
541       }
542       $this->attrs= $attrs;
543     }
545     /* Update ntp server settings */
546     if($this->inheritTimeServer){
547       if($this->is_new){
548         if(isset($this->attrs['gotoNtpServer'])){
549           unset($this->attrs['gotoNtpServer']);
550         }
551       }else{
552         $this->attrs['gotoNtpServer'] = array();
553       }
554     }else{
555       /* Set ntpServers */
556       $this->attrs['gotoNtpServer'] = array();
557       foreach($this->gotoNtpServer as $server){
558         $this->attrs['gotoNtpServer'][] = $server;
559       }
560     }
562     if(($this->gosaUnitTag) && (!in_array_ics("gosaAdministrativeUnitTag",$this->attrs['objectClass']))){
563       $this->attrs['objectClass'][] = "gosaAdministrativeUnitTag";
564     }
566     /* Write back to ldap */
567     $ldap= $this->config->get_ldap_link();
568     if ($this->orig_dn == 'new'){
569       $ldap->cd($this->config->current['BASE']);
570       $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
571       $ldap->cd($this->dn);
572       $ldap->add($this->attrs);
573       new log("create","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
574       show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/generic with dn '%s' failed."),$this->dn));
575       if(!$this->didAction){
576         $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
577       }
578     } else {
579       if ($this->orig_dn != $this->dn){
580         $this->move($this->orig_dn, $this->dn);
581       }
582       $ldap->cd($this->dn);
583       $this->cleanup();
584       $ldap->modify ($this->attrs); 
585       new log("modify","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
587       if(!$this->didAction){
588         $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
589       }
590     }
592     /* cn=default and macAddress=- indicates that this is a template */
593     if($this->cn == "wdefault"){
594       $this->netConfigDNS->macAddress = "-";
595     }
597     $this->netConfigDNS->cn = $this->cn;
598     $this->netConfigDNS->save();
599     show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/generic with dn '%s' failed."),$this->dn));
601     if ($activate){
603       /* Send installation activation
604        */
605       $events = DaemonEvent::get_event_types();
606       $o_queue = new gosaSupportDaemon();
607       if(isset($events['BY_CLASS']['DaemonEvent_installation_activation'])){
608         $evt = $events['BY_CLASS']['DaemonEvent_installation_activation'];
609         $tmp = new $evt['CLASS_NAME']($this->config);
610         $tmp->set_type(TRIGGERED_EVENT);
611         $tmp->add_targets(array($this->netConfigDNS->macAddress));
612         if(!$o_queue->append($tmp)){
613           msg_dialog::display(_("Daemon"),sprintf(_("Something went wrong while talking to the daemon: %s."),
614                 $o_queue->get_error()),ERROR_DIALOG);
615         }
616       }
617     }
618   }
621   /* Display generic part for server copy & paste */
622   function getCopyDialog()
623   {
624     $vars = array("cn");
625     $smarty = get_smarty();
626     $smarty->assign("cn" ,$this->cn);
627     $smarty->assign("object","workstation");
628     $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
629     $ret = array();
630     $ret['string'] = $str;
631     $ret['status'] = "";
632     return($ret);
633   }
636   function saveCopyDialog()
637   {
638     if(isset($_POST['cn'])){
639       $this->cn = $_POST['cn'];
640     }
641   }
644   function PrepareForCopyPaste($source)
645   {
646     plugin::PrepareForCopyPaste($source);
647     if(isset($source['macAddress'][0])){
648       $this->netConfigDNS->macAddress = $source['macAddress'][0];
649     }
650     if(isset($source['ipHostNumber'][0])){
651       $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
652     }
654     /* Create used ntp server array */
655     $this->gotoNtpServer= array();
656     if(isset($source['gotoNtpServer'])){
657       $this->inheritTimeServer = false;
658       unset($source['gotoNtpServer']['count']);
659       foreach($source['gotoNtpServer'] as $server){
660         $this->gotoNtpServer[$server] = $server;
661       }
662     }
664     /* Set inherit checkbox state */
665     if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer)==0)){
666       $this->inheritTimeServer = true;
667       $this->gotoNtpServer=array();
668     }
669   }
672   /* Return plugin informations for acl handling 
673       #FIXME FAIscript seams to ununsed within this class... */ 
674   static function plInfo()
675   {
676     return (array(  
677           "plShortName"   => _("Generic"),
678           "plDescription" => _("Workstation generic"),
679           "plSelfModify"  => FALSE,
680           "plDepends"     => array(),
681           "plPriority"    => 0,
682           "plSection"     => array("administration"),
683           "plCategory"    => array("workstation" => array("description"  => _("Workstation"),
684                                                           "objectClass"  => "gotoWorkstation")),
685           "plProvidedAcls"=> array(
686             "cn"                  => _("Workstation name"),
687             "description"         => _("Description") ,
688             "l"                   => _("Location") ,
689             "base"                => _("Base") ,
690             "gotoMode"            => _("Goto mode"), 
691             "gotoSyslogServer"    => _("Syslog server"), 
692             "gotoNtpServer"       => _("Ntp server"), 
693             "gotoRootPasswd"      => _("Root password"),
694             "FAIstate"            => _("Action flag"))
695           ));
696   }
698   function set_everything_to_inherited()
699   {
700     $this->gotoSyslogServer  = "default";
701     $this->inheritTimeServer = TRUE;
703     /* Set workstation service attributes to inherited */
704     if($this->member_of_ogroup && isset($this->parent->by_object['workservice'])){
705       foreach(array("gotoXKbLayout","gotoXKbModel","gotoXKbVariant",
706             "gotoXResolution","gotoXColordepth","gotoXMouseType","gotoXMouseport") as $name){
707         $this->parent->by_object['workservice']->$name = "default"; 
708       }
709     }
711     /* Set workstation startup attributes to inherited */
712     if($this->member_of_ogroup && isset($this->parent->by_object['workstartup'])){
713       $this->parent->by_object['workstartup']->gotoBootKernel = "default-inherited";
714       $this->parent->by_object['workstartup']->gotoLdapServer = "default-inherited";
715       $this->parent->by_object['workstartup']->FAIdebianMirror= "inherited";
716     }
717   }
719   // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
720 ?>