Code

Allow activation of workstations, if ldap settings are inherited.
[gosa.git] / gosa-plugins / goto / admin / systems / goto / class_workstationGeneric.inc
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= "";
36   /* Plugin side filled */
37   var $modes= array();
39   var $netConfigDNS;
41   var $inheritTimeServer = true;
43   /* attribute list for save action */
44   var $ignore_account= TRUE;
45   var $attributes= array("gotoMode", "gotoSyslogServer", "gotoNtpServer",
46       "gotoFloppyEnable", "gotoCdromEnable", "cn", "gotoSndModule",
47       "ghCpuType", "ghMemSize", "ghUsbSupport", "description",
48       "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser", "l","FAIscript");
49   var $objectclasses= array("top", "gotoWorkstation", "GOhard");
51   var $validActions   = array("reboot" => "", "localboot" => "", "halt" => "", "update" => "", "reinstall" => "",
52                             "rescan" => "", "wake" => "", "memcheck" => "", "sysinfo" => "");
53   
54   var $fai_activated = FALSE;
56   var $member_of_ogroup = FALSE;
58   var $currently_installing = FALSE;
59   var $currently_installing_warned = FALSE;
61   function workgeneric (&$config, $dn= NULL, $parent= NULL)
62   {
63     $tmp= $config->search("faiManagement", "CLASS",array('menu','tabs'));
64     if(!empty($tmp)){
65       $this->fai_activated = TRUE;
66     }
68     plugin::plugin ($config, $dn, $parent);
70     if(!isset($this->parent->by_object['ogroup'])){
71       $ldap = $this->config->get_ldap_link();
72       $ldap->cd ($this->config->current['BASE']);
73       $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".LDAP::prepare4filter($this->dn)."))",array("cn"));
74       $this->member_of_ogroup = $ldap->count() >= 1;
75     }
77     $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses);
79     /* Check if this host is currently in installation process*/
80     if(class_available("gosaSupportDaemon") && class_available("DaemonEvent")){
81       $o = new gosaSupportDaemon();
82       $e_types = DaemonEvent::get_event_types(USER_EVENT | SYSTEM_EVENT | HIDDEN_EVENT);
83       $evts = $o->get_entries_by_mac(array($this->netConfigDNS->macAddress));
84       foreach($evts as $evt){
85         if(isset($e_types['QUEUED'][$evt['HEADERTAG']]) && $evt['STATUS'] == "processing" &&
86             $e_types['QUEUED'][$evt['HEADERTAG']] == "DaemonEvent_reinstall"){
87           $this->currently_installing =TRUE;
88         }
89       }
90     }
92     /* Read arrays */
93     foreach (array("ghNetNic", "ghIdeDev", "ghScsiDev") as $val){
94       if (!isset($this->attrs[$val])){
95         continue;
96       }
97       for ($i= 0; $i<$this->attrs[$val]['count']; $i++){
98         array_push($this->$val, $this->attrs[$val][$i]);
99       }
100     }
102     /* Create used ntp server array */
103     $this->gotoNtpServer= array();
104     if(isset($this->attrs['gotoNtpServer'])){
105       $this->inheritTimeServer = false;
106       unset($this->attrs['gotoNtpServer']['count']);
107       foreach($this->attrs['gotoNtpServer'] as $server){
108         $this->gotoNtpServer[$server] = $server;
109       }
110     }
112     /* Set inherit checkbox state */
113     if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer) == 0)){
114       $this->inheritTimeServer = true;
115       $this->gotoNtpServer=array();
116     }
118     /* You can't inherit the NTP service, if we are not member in an object group */
119     if(!$this->member_of_ogroup){
120       $this->inheritTimeServer = FALSE;
121     }
123     /* Create available ntp options */
124     $tmp = $this->config->data['SERVERS']['NTP'];
125     $this->gotoNtpServers = array();
126     foreach($tmp as $key => $server){
127       if($server == "default") continue;
128       $this->gotoNtpServers[$server] = $server;
129     }
131     $this->modes["active"]= _("Activated");
132     $this->modes["locked"]= _("Locked");
134     /* Set base */
135     if ($this->dn == "new"){
136       $ui= get_userinfo();
137       $this->base= dn2base($ui->dn);
138     } else {
139       $this->base= preg_replace ("/^[^,]+,".normalizePreg(get_ou("workstationou"))."/i", "", $this->dn);
140     }
142     /* Create an array of all Syslog servers */
143     $tmp = $this->config->data['SERVERS']['SYSLOG'];
144     foreach($tmp as $server){
145       $visible = $server;
146       if($server == "default" && $this->member_of_ogroup) {
147         $visible = "["._("inherited")."]";
148       }
149       $this->gotoSyslogServers[$server] = $visible;
150     }
152     $this->initial_gotoMode = $this->gotoMode;
154     /* Save 'dn' for later referal */
155     $this->orig_dn= $this->dn;
156     $this->orig_cn= $this->cn;
157   }
160   function set_acl_base($base)
161   {
162     plugin::set_acl_base($base);
163     $this->netConfigDNS->set_acl_base($base);
164   }
166   function set_acl_category($cat)
167   {
168     plugin::set_acl_category($cat);
169     $this->netConfigDNS->set_acl_category($cat);
170   }
172   function execute()
173   {
174     /* Call parent execute */
175     plugin::execute();
177     if($this->is_account && !$this->view_logged){
178       $this->view_logged = TRUE;
179       new log("view","workstation/".get_class($this),$this->dn);
180     }
182     /* Do we need to flip is_account state? */
183     if(isset($_POST['modify_state'])){
184       if($this->is_account && $this->acl_is_removeable()){
185         $this->is_account= FALSE;
186       }elseif(!$this->is_account && $this->acl_is_createable()){
187         $this->is_account= TRUE;
188       }
189     }
191     if ((isset($_POST['action'])) && ($this->acl_is_writeable("FAIstate")) && isset($this->validActions[$_POST['saction']]) ){
192       $action= $_POST['saction'];
194       /* Check if we have an DaemonEvent for this action */ 
195       if(class_available("DaemonEvent")){
196         $events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);
197         if(isset($events['TRIGGERED']["DaemonEvent_".$action])){
198           $evt = $events['TRIGGERED']["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(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
205           }
206         }
207       } else {
208         msg_dialog::display(_("Event error"),
209                     sprintf(_("Event '%s' is not available!"),$action),ERROR_DIALOG);
210       }
213     }
215     /* Do we represent a valid terminal? */
216     if (!$this->is_account && $this->parent === NULL){
217       $display= "<img alt=\"\" src=\"images/small-error.png\" align=middle>&nbsp;<b>".
218         msgPool::noValidExtension(_("workstation"))."</b>";
219       return($display);
220     }
222     /* Base select dialog */
223     $once = true;
224     foreach($_POST as $name => $value){
225       if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_writeable("base")){
226         $once = false;
227         $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
228         $this->dialog->setCurrentBase($this->base);
229       }
230     }
232     /* Dialog handling */
233     if(is_object($this->dialog)){
234       /* Must be called before save_object */
235       $this->dialog->save_object();
237       if($this->dialog->isClosed()){
238         $this->dialog = false;
239       }elseif($this->dialog->isSelected()){
241         /* A new base was selected, check if it is a valid one */
242         $tmp = $this->get_allowed_bases();
243         if(isset($tmp[$this->dialog->isSelected()])){
244           $this->base = $this->dialog->isSelected();
245         }
247         $this->dialog= false;
248       }else{
249         return($this->dialog->execute());
250       }
251     }
253     /* Add new ntp Server to our list */ 
254     if((isset($_POST['addNtpServer'])) && (isset($_POST['gotoNtpServers'])) && $this->acl_is_writeable("gotoNtpServer")){
255       $this->gotoNtpServer[$_POST['gotoNtpServers']] = $_POST['gotoNtpServers'];
256     }
258     /* Delete selected NtpServer for list of used servers  */
259     if((isset($_POST['delNtpServer'])) && (isset($_POST['gotoNtpServerSelected'])) && $this->acl_is_writeable("gotoNtpServer")){
260       foreach($_POST['gotoNtpServerSelected'] as $name){
261         unset($this->gotoNtpServer[$name]);
262       }
263     }
265     /* Fill templating stuff */
266     $smarty= get_smarty();
268     /* Set acls */
269     $tmp = $this->plInfo();
270     foreach($tmp['plProvidedAcls'] as $name => $translation){
271       $smarty->assign($name."ACL",$this->getacl($name));
272     }
274     $smarty->assign("cn", $this->cn);
275     $smarty->assign("description", $this->description);
276     $smarty->assign("l", $this->l);
277     $smarty->assign("bases", $this->get_allowed_bases());
278     $smarty->assign("staticAddress", "");
280     $tmp = array();
281     foreach($this->gotoNtpServers as $server){
282       if(!in_array($server,$this->gotoNtpServer)){
283         $tmp[$server] = $server;
284       }
285     }
286     $smarty->assign("gotoNtpServers",$tmp);
287         
288     /* Check if workstation is online */
289     if (gosaSupportDaemon::ping($this->netConfigDNS->macAddress)){
290       $smarty->assign("actions", array("halt" => _("Switch off"), "reboot" => _("Reboot"),
291                                        "update" => _("System update"),
292                                        "reinstall" => _("Reinstall"),
293                                        "rescan" => _("Rescan hardware"),
294                                        "memcheck" => _("Memory test"),
295                                        "localboot" => _("Force localboot"),
296                                        "sysinfo"  => _("System analysis")));
297     } else {
298       $smarty->assign("actions", array("wake" => _("Wake up"),
299                                        "reinstall" => _("Reinstall"),
300                                        "update" => _("System update"),
301                                        "memcheck" => _("Memory test"),
302                                        "localboot" => _("Force localboot"),
303                                        "sysinfo"  => _("System analysis")));
304     }
305     /* Arrays */
306     $smarty->assign("modes", $this->modes);
307     $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']);
308     $smarty->assign("syslogservers", $this->gotoSyslogServers);
309     $smarty->assign("fai_activated",$this->fai_activated);
311     $ntpser = array();
312     foreach($this->gotoNtpServers as $server){
313       if(!in_array($server,$this->gotoNtpServer)){
314         $ntpser[$server] = $server;
315       }
316     }
317     $smarty->assign("gotoNtpServers", $ntpser);
319     /* Variables */
320     foreach(array("base", "gotoMode", "gotoSyslogServer", "gotoNtpServer") as $val){
321       $smarty->assign($val."_select", $this->$val);
322     }
324     /* tell smarty the inherit checkbox state */
325     $smarty->assign("inheritTimeServer",$this->inheritTimeServer);
326     $smarty->assign("member_of_ogroup",$this->member_of_ogroup);
328     $str = $this->netConfigDNS->execute();
329     if(is_object($this->netConfigDNS->dialog)){
330       return($str);
331     }
332     $smarty->assign("netconfig", $str);
334     /* Show main page */
335     $smarty->assign("currently_installing", $this->currently_installing);
336     return($smarty->fetch (get_template_path('workstation.tpl', TRUE, dirname(__FILE__))));
337   }
339   function remove_from_parent()
340   {
341     if($this->acl_is_removeable()){
343       $this->netConfigDNS->remove_from_parent();
344       $ldap= $this->config->get_ldap_link();
345       $ldap->rmdir($this->dn);
346       new log("remove","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
347       if (!$ldap->success()){
348         msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class()));
349       }
351       /* Optionally execute a command after we're done */
352       $this->handle_post_events("remove", array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
354       /* Delete references to object groups */
355       $ldap->cd ($this->config->current['BASE']);
356       $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
357       while ($ldap->fetch()){
358         $og= new ogroup($this->config, $ldap->getDN());
359         unset($og->member[$this->dn]);
360         $og->save ();
361       }
363       /* Remove all accessTo/trust dependencies */
364       update_accessTo($this->cn,"");
365     }
367     /* Clean queue form entries with this mac 
368      */
369     if(class_available("gosaSupportDaemon") && tests::is_mac($this->netConfigDNS->orig_macAddress)){
370       $q = new gosaSupportDaemon();
371       $q->clean_queue_from_mac($this->netConfigDNS->orig_macAddress);
372     }
374     if(isset($_POST["inheritAll"])){
375       $this->set_everything_to_inherited();
376     }
377   }
380   /* Save data to object */
381   function save_object()
382   {
384     /* Create a base backup and reset the
385        base directly after calling plugin::save_object();
386        Base will be set seperatly a few lines below */
387     $base_tmp = $this->base;
388     plugin::save_object();
389     $this->base = $base_tmp;
391     /* Save base, since this is no LDAP attribute */
392     $tmp = $this->get_allowed_bases();
393     if(isset($_POST['base'])){
394       if(isset($tmp[$_POST['base']])){
395         $this->base= $_POST['base'];
396       }
397     }
399     $this->netConfigDNS->save_object();
401     /* Set inherit mode */
402     if((isset($_POST['workgeneric_posted'])) && ($this->acl_is_writeable("gotoNtpServer"))){
403       if(isset($_POST["inheritTimeServer"]) && $this->member_of_ogroup){
404         $this->inheritTimeServer = true;
405       }else{
406         $this->inheritTimeServer = false;
407       }
408     }
409     
410     if(isset($_POST["inheritAll"])){
411       $this->set_everything_to_inherited();
412     }
413   }
416   /* Check supplied data */
417   function check()
418   {
419     /* Call common method to give check the hook */
420     $message= plugin::check();
421  
422     /* Skip IP & Mac checks if this is a template */
423     if($this->cn != "wdefault"){
424       $message= array_merge($message, $this->netConfigDNS->check());
425     }
427     $this->dn= "cn=".$this->cn.",".get_ou('workstationou').$this->base;
429     if ($this->cn == ""){
430       $message[]= msgPool::required(_("Name"));
431     }
433     /* Check if given name is a valid host/dns name */
434     if(!tests::is_dns_name($this->cn)){
435       $message[] = msgPool::invalid(_("Name"));
436     }
438     if ($this->orig_dn != $this->dn){
439       $ldap= $this->config->get_ldap_link();
440       $ldap->cd ($this->base);
442       if($this->cn == "wdefault"){
443         $ldap->cat($this->dn);
444       }else{
445         $ldap->search ("(&(cn=".$this->cn.")(objectClass=gotoWorkstation))", array("cn"));
446       }
447       if ($ldap->count() != 0){
448         while ($attrs= $ldap->fetch()){
449           if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".get_ou('incomingou')."/", $ldap->getDN())){
450             continue;
451           } else {
452             if ($attrs['dn'] != $this->orig_dn){
453               $message[]= msgPool::duplicated(_("Name"));
454               break;
455             }
456           }
457         }
458       }
459     }
461     /* Check for valid ntpServer selection */
462     if((!$this->inheritTimeServer) && (!count($this->gotoNtpServer))){
463       $message[]= msgPool::required(_("NTP server"));
464     }
466     /* Only systems with a valid ldap handle can be activated 
467      */
468     if($this->gotoMode == "active" && $this->initial_gotoMode != "active"){
470       if(isset($this->parent->by_object['workstartup']) &&
471           !count($this->parent->by_object['workstartup']->gotoLdapServers) && 
472           !$this->parent->by_object['workstartup']->gotoLdap_inherit){
474         $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.");
475       }
476     }else{
477       /* Warn the user, that this host is currently installing */
478       if($this->currently_installing && !$this->currently_installing_warned && 
479           !preg_match("/".normalizePreg(get_ou("incomingou"))."/",$this->orig_dn)){
480       
481         /* Force aborting without message dialog */
482         $message[] = "";
483         $this->currently_installing_warned = TRUE;
484         msg_dialog::display(_("Software deployment"), 
485             _("This host is currently installing, if you really want to save it, press 'OK'."),
486             CONFIRM_DIALOG);
487       }
488     }
489  
490     return ($message);
491   }
494   /* Save to LDAP */
495   function save()
496   {
497     /* Detect mode changes */
498     $activate= (isset($this->saved_attributes['gotoMode']) &&
499         $this->gotoMode != $this->saved_attributes['gotoMode'] &&
500         $this->gotoMode == "active" &&
501         tests::is_ip($this->netConfigDNS->ipHostNumber)) || $this->auto_activate;
502     plugin::save();
504     /* Strip out 'default' values */
505     foreach (array("gotoSyslogServer") as $val){
507       if (isset($this->attrs[$val]) && $this->attrs[$val] == "default"){
508         $this->attrs[$val]= array();
509       }
510     }
512     /* Add missing arrays */
513     foreach (array("ghScsiDev", "ghIdeDev", "ghNetNic") as $val){
514       if (isset ($this->$val) && count ($this->$val) != 0){
515         $this->attrs["$val"]= $this->$val;
516       }
517     }
519     /* Remove all empty values */
520     if ($this->orig_dn == 'new'){
521       $attrs= array();
522       foreach ($this->attrs as $key => $val){
523         if (is_array($val) && count($val) == 0){
524           continue;
525         }
526         $attrs[$key]= $val;
527       }
528       $this->attrs= $attrs;
529     }
531     /* Update ntp server settings */
532     if($this->inheritTimeServer){
533       if($this->is_new){
534         if(isset($this->attrs['gotoNtpServer'])){
535           unset($this->attrs['gotoNtpServer']);
536         }
537       }else{
538         $this->attrs['gotoNtpServer'] = array();
539       }
540     }else{
541       /* Set ntpServers */
542       $this->attrs['gotoNtpServer'] = array();
543       foreach($this->gotoNtpServer as $server){
544         $this->attrs['gotoNtpServer'][] = $server;
545       }
546     }
548     /* Write back to ldap */
549     $ldap= $this->config->get_ldap_link();
550     if ($this->orig_dn == 'new'){
551       $ldap->cd($this->config->current['BASE']);
552       $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
553       $ldap->cd($this->dn);
554       $ldap->add($this->attrs);
555       new log("create","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
556       if (!$ldap->success()){
557         msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
558       }
559       $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
560     } else {
561       if ($this->orig_dn != $this->dn){
563         /* Remove all accessTo/trust dependencies */
564         update_accessTo($this->orig_cn,$this->cn);
565       }
566       $ldap->cd($this->dn);
567       $this->cleanup();
568       $ldap->modify ($this->attrs); 
569       if (!$ldap->success()){
570         msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class()));
571       }
572       new log("modify","workstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
573       $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber));
574     }
576     /* cn=default and macAddress=- indicates that this is a template */
577     if($this->cn == "wdefault"){
578       $this->netConfigDNS->macAddress = "-";
579     }
581     $this->netConfigDNS->cn = $this->cn;
582     $this->netConfigDNS->save();
584     if ($activate && class_available("DaemonEvent")){
586       /* Send installation activation
587        */
588       $events = DaemonEvent::get_event_types(SYSTEM_EVENT | HIDDEN_EVENT);
589       $o_queue = new gosaSupportDaemon();
590       if(isset($events['TRIGGERED']['DaemonEvent_installation_activation'])){
591         $evt = $events['TRIGGERED']['DaemonEvent_installation_activation'];
592         $tmp = new $evt['CLASS_NAME']($this->config);
593         $tmp->set_type(TRIGGERED_EVENT);
594         $tmp->add_targets(array($this->netConfigDNS->macAddress));
595         if(!$o_queue->append($tmp)){
596           msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
597         }
598       }
599     }
600   }
603   /* Display generic part for server copy & paste */
604   function getCopyDialog()
605   {
606     $vars = array("cn");
607     $smarty = get_smarty();
608     $smarty->assign("cn" ,$this->cn);
609     $smarty->assign("object","workstation");
610     $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
611     $ret = array();
612     $ret['string'] = $str;
613     $ret['status'] = "";
614     return($ret);
615   }
618   function saveCopyDialog()
619   {
620     if(isset($_POST['cn'])){
621       $this->cn = $_POST['cn'];
622     }
623   }
626   function PrepareForCopyPaste($source)
627   {
628     plugin::PrepareForCopyPaste($source);
629     if(isset($source['macAddress'][0])){
630       $this->netConfigDNS->macAddress = $source['macAddress'][0];
631     }
632     if(isset($source['ipHostNumber'][0])){
633       $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
634     }
636     /* Create used ntp server array */
637     $this->gotoNtpServer= array();
638     if(isset($source['gotoNtpServer'])){
639       $this->inheritTimeServer = false;
640       unset($source['gotoNtpServer']['count']);
641       foreach($source['gotoNtpServer'] as $server){
642         $this->gotoNtpServer[$server] = $server;
643       }
644     }
646     /* Set inherit checkbox state */
647     if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer)==0)){
648       $this->inheritTimeServer = true;
649       $this->gotoNtpServer=array();
650     }
651   }
654   /* Return plugin informations for acl handling 
655       #FIXME FAIscript seams to ununsed within this class... */ 
656   static function plInfo()
657   {
658     return (array(  
659           "plShortName"   => _("Generic"),
660           "plDescription" => _("Workstation generic"),
661           "plSelfModify"  => FALSE,
662           "plDepends"     => array(),
663           "plPriority"    => 0,
664           "plSection"     => array("administration"),
665           "plCategory"    => array("workstation" => array("description"  => _("Workstation"),
666                                                           "objectClass"  => "gotoWorkstation")),
667           "plProvidedAcls"=> array(
668             "cn"                  => _("Workstation name"),
669             "description"         => _("Description") ,
670             "l"                   => _("Location") ,
671             "base"                => _("Base") ,
672             "gotoMode"            => _("Goto mode"), 
673             "gotoSyslogServer"    => _("Syslog server"), 
674             "gotoNtpServer"       => _("Ntp server"), 
675             "gotoRootPasswd"      => _("Root password"),
676             "FAIstate"            => _("Action flag"))
677           ));
678   }
680   function set_everything_to_inherited()
681   {
682     $this->gotoSyslogServer  = "default";
683     $this->inheritTimeServer = TRUE;
685     /* Set workstation service attributes to inherited */
686     if($this->member_of_ogroup && isset($this->parent->by_object['workservice'])){
687       foreach(array("gotoXKbLayout","gotoXKbModel","gotoXKbVariant",
688             "gotoXResolution","gotoXColordepth","gotoXMouseType","gotoXMouseport") as $name){
689         $this->parent->by_object['workservice']->$name = "default"; 
690       }
691     }
693     /* Set workstation startup attributes to inherited */
694     if($this->member_of_ogroup && isset($this->parent->by_object['workstartup'])){
695       $this->parent->by_object['workstartup']->gotoBootKernel = "default-inherited";
696       $this->parent->by_object['workstartup']->gotoLdapServer = "default-inherited";
697       $this->parent->by_object['workstartup']->FAIdebianMirror= "inherited";
698     }
699   }
701   // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
702 ?>