From f4d618cb8362e4f9029929a0a2a6f5f7754ed4b9 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 18 Jul 2007 09:25:37 +0000 Subject: [PATCH] Hide inherit options, if we are not part in an object group. NTP service / FAI startup settings / Root server / Ldap Base git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@6904 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/systems/class_terminalGeneric.inc | 13 ++++++--- .../systems/class_workstationGeneric.inc | 9 +++++-- .../systems/class_workstationStartup.inc | 27 +++++++++++++------ plugins/admin/systems/terminal.tpl | 4 +++ plugins/admin/systems/workstation.tpl | 6 +++++ 5 files changed, 46 insertions(+), 13 deletions(-) diff --git a/plugins/admin/systems/class_terminalGeneric.inc b/plugins/admin/systems/class_terminalGeneric.inc index 598e4fbd4..8f5b2fde3 100644 --- a/plugins/admin/systems/class_terminalGeneric.inc +++ b/plugins/admin/systems/class_terminalGeneric.inc @@ -98,6 +98,11 @@ class termgeneric extends plugin $this->gotoNtpServer=array(); } + /* You can't inherit the NTP service, if we are not member in an object group */ + if(!$this->member_of_ogroup){ + $this->inheritTimeServer = FALSE; + } + /* Create available ntp options */ $this->gotoNtpServers = $this->config->data['SERVERS']['NTP']; foreach($this->gotoNtpServers as $key => $server){ @@ -122,7 +127,7 @@ class termgeneric extends plugin $tmp = $this->config->data['SERVERS']['SYSLOG']; foreach($tmp as $server){ $visible = $server; - if($server == "default") { + if($server == "default" && $this->member_of_ogroup) { $visible = "["._("inherited")."]"; } $this->gotoSyslogServers[$server] = $visible; @@ -294,7 +299,9 @@ class termgeneric extends plugin if($server != "default"){ $tmp2[$server]= $server; }else{ - $tmp2[$server]="["._("inherited")."]"; + if($this->member_of_ogroup){ + $tmp2[$server]="["._("inherited")."]"; + } } } @@ -369,7 +376,7 @@ class termgeneric extends plugin } if(isset($_POST['termgeneric_posted']) && chkacl($this->acl,"gotoNtpServer") == ""){ - if(isset($_POST["inheritTimeServer"])){ + if(isset($_POST["inheritTimeServer"]) && $this->member_of_ogroup){ $this->inheritTimeServer = true; }else{ $this->inheritTimeServer = false; diff --git a/plugins/admin/systems/class_workstationGeneric.inc b/plugins/admin/systems/class_workstationGeneric.inc index 5863ed5f4..78f22f969 100644 --- a/plugins/admin/systems/class_workstationGeneric.inc +++ b/plugins/admin/systems/class_workstationGeneric.inc @@ -106,6 +106,11 @@ class workgeneric extends plugin $this->gotoNtpServer=array(); } + /* You can't inherit the NTP service, if we are not member in an object group */ + if(!$this->member_of_ogroup){ + $this->inheritTimeServer = FALSE; + } + /* Create available ntp options */ $tmp = $this->config->data['SERVERS']['NTP']; $this->gotoNtpServers = array(); @@ -129,7 +134,7 @@ class workgeneric extends plugin $tmp = $this->config->data['SERVERS']['SYSLOG']; foreach($tmp as $server){ $visible = $server; - if($server == "default") { + if($server == "default" && $this->member_of_ogroup) { $visible = "["._("inherited")."]"; } $this->gotoSyslogServers[$server] = $visible; @@ -336,7 +341,7 @@ class workgeneric extends plugin /* Set inherit mode */ if(isset($_POST['workgeneric_posted']) && chkacl($this->acl,"gotoNtpServer") == ""){ - if(isset($_POST["inheritTimeServer"])){ + if(isset($_POST["inheritTimeServer"]) && $this->member_of_ogroup){ $this->inheritTimeServer = true; }else{ $this->inheritTimeServer = false; diff --git a/plugins/admin/systems/class_workstationStartup.inc b/plugins/admin/systems/class_workstationStartup.inc index be645996f..02e5b7ea0 100644 --- a/plugins/admin/systems/class_workstationStartup.inc +++ b/plugins/admin/systems/class_workstationStartup.inc @@ -51,6 +51,7 @@ class workstartup extends plugin var $FAIServRepConfig = array(); var $fai_activated = FALSE; + var $member_of_ogroup = FALSE; function workstartup ($config, $dn= NULL, $parent= NULL) { @@ -65,6 +66,13 @@ class workstartup extends plugin plugin::plugin ($config, $dn, $parent); + if(!isset($this->parent->by_object['ogroup'])){ + $ldap = $this->config->get_ldap_link(); + $ldap->cd ($this->config->current['BASE']); + $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".$this->dn."))",array("cn")); + $this->member_of_ogroup = $ldap->count() >= 1; + } + /* Creating a list of valid Mirrors * none will not be saved to ldap. */ @@ -296,11 +304,11 @@ class workstartup extends plugin /* Load hardware list */ - $ldap= $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); - $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".$this->dn."))"); - if ($ldap->count() == 1){ + if ($this->member_of_ogroup){ + if(count($this->FAIclass)==0 && $this->FAIrelease == ""){ + $this->FAIdebianMirror = "inherited"; + } if($this->fai_activated){ $map= array("gotoLdapServer","FAIclass","FAIdebianMirror","gotoBootKernel"); @@ -376,9 +384,6 @@ class workstartup extends plugin $this->gotoBootKernel= "default"; } - if(count($this->FAIclass)==0 && $this->FAIrelease == ""){ - $this->FAIdebianMirror = "inherited"; - } } @@ -825,7 +830,13 @@ class workstartup extends plugin function getFAIdebianMirrors() { $ret = array(); - $ret['inherited']="["._("inherited")."]"; + + /* Only add inherit option, if we are part in an object group + */ + if($this->member_of_ogroup) { + $ret['inherited']="["._("inherited")."]"; + } + $ret['auto']=_("automatic"); $secs = array(); diff --git a/plugins/admin/systems/terminal.tpl b/plugins/admin/systems/terminal.tpl index 76a7471a3..684fdbe6f 100644 --- a/plugins/admin/systems/terminal.tpl +++ b/plugins/admin/systems/terminal.tpl @@ -83,6 +83,7 @@ diff --git a/plugins/admin/systems/workstation.tpl b/plugins/admin/systems/workstation.tpl index cb84f1a1f..653cb724b 100644 --- a/plugins/admin/systems/workstation.tpl +++ b/plugins/admin/systems/workstation.tpl @@ -62,6 +62,9 @@
+{if $member_of_ogroup} {t}Inherit time server attributes{/t} +{else} + {t}Inherit time server attributes{/t} +{/if}
-- 2.30.2
+ +{if $member_of_ogroup} + {t}Inherit time server attributes{/t} +{else} + {t}Inherit time server attributes{/t} +{/if}