From 499786c811063a46a322b65d28c19234800e4262 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 18 Jul 2007 12:03:54 +0000 Subject: [PATCH] Added inherit fix. Only display inherit options if system is part of an object group collection. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6908 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/systems/class_terminalGeneric.inc | 13 ++++++-- .../systems/class_workstationGeneric.inc | 9 ++++-- .../systems/class_workstationStartup.inc | 30 +++++++++++++------ plugins/admin/systems/terminal.tpl | 4 +++ plugins/admin/systems/workstation.tpl | 4 +++ 5 files changed, 46 insertions(+), 14 deletions(-) diff --git a/plugins/admin/systems/class_terminalGeneric.inc b/plugins/admin/systems/class_terminalGeneric.inc index 797186de2..ec31c831f 100644 --- a/plugins/admin/systems/class_terminalGeneric.inc +++ b/plugins/admin/systems/class_terminalGeneric.inc @@ -104,6 +104,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){ @@ -128,7 +133,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; @@ -325,7 +330,9 @@ class termgeneric extends plugin if($server != "default"){ $tmp2[$server]= $server; }else{ - $tmp2[$server]="["._("inherited")."]"; + if($this->member_of_ogroup){ + $tmp2[$server]="["._("inherited")."]"; + } } } @@ -410,7 +417,7 @@ class termgeneric extends plugin } if(isset($_POST['termgeneric_posted'])){ - 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 a6984a558..e3900e931 100644 --- a/plugins/admin/systems/class_workstationGeneric.inc +++ b/plugins/admin/systems/class_workstationGeneric.inc @@ -110,6 +110,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(); @@ -133,7 +138,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; @@ -395,7 +400,7 @@ class workgeneric extends plugin /* Set inherit mode */ if((isset($_POST['workgeneric_posted'])) && ($this->acl_is_writeable("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 567fd2f15..0f7f3d37c 100644 --- a/plugins/admin/systems/class_workstationStartup.inc +++ b/plugins/admin/systems/class_workstationStartup.inc @@ -56,6 +56,8 @@ class workstartup extends plugin var $fai_activated = FALSE; + var $member_of_ogroup = FALSE; + function workstartup ($config, $dn= NULL, $parent= NULL) { /* Check if FAI is active */ @@ -69,6 +71,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. */ @@ -290,10 +299,11 @@ class workstartup extends plugin $this->gotoBootKernels= array("default-inherited" => '['._("inherited").']'); /* 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"); @@ -359,10 +369,6 @@ class workstartup extends plugin } } - if(count($this->FAIclass)==0 && $this->FAIrelease == ""){ - $this->FAIdebianMirror = "inherited"; - } - /* Turn to default, if we've nothing to inherit */ if (!isset($this->gotoBootKernels['default-inherited']) && $this->gotoBootKernel == "default-inherited"){ $this->gotoBootKernel= "default"; @@ -832,7 +838,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 a943fc86c..dc088f867 100644 --- a/plugins/admin/systems/terminal.tpl +++ b/plugins/admin/systems/terminal.tpl @@ -94,6 +94,7 @@ diff --git a/plugins/admin/systems/workstation.tpl b/plugins/admin/systems/workstation.tpl index 9caee6e77..ba8489947 100644 --- a/plugins/admin/systems/workstation.tpl +++ b/plugins/admin/systems/workstation.tpl @@ -71,6 +71,7 @@
+{if $member_of_ogroup} {render acl=$gotoNtpServerACL} {t}Inherit time server attributes{/t} {/render} +{else} + {t}Inherit time server attributes{/t} +{/if}
-- 2.30.2
+{if $member_of_ogroup} {render acl=$gotoNtpServerACL} {t}Inherit time server attributes{/t} {/render} +{else} + {t}Inherit time server attributes{/t} +{/if}