Code

Added inherit fix.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 18 Jul 2007 12:03:54 +0000 (12:03 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 18 Jul 2007 12:03:54 +0000 (12:03 +0000)
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

plugins/admin/systems/class_terminalGeneric.inc
plugins/admin/systems/class_workstationGeneric.inc
plugins/admin/systems/class_workstationStartup.inc
plugins/admin/systems/terminal.tpl
plugins/admin/systems/workstation.tpl

index 797186de2f41404593392d196c1d570f967cd3a5..ec31c831f4db43b114485a9adcceed55111d48ea 100644 (file)
@@ -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;
index a6984a55897608e31398e03f31cdb92e56a259a9..e3900e931c2e1b098d02dd8be6be11886fd7e4c1 100644 (file)
@@ -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;
index 567fd2f15551ed5b4aaec9467632c95a519c7332..0f7f3d37cde59dad074c0a1d37c5a322ea7cc0a0 100644 (file)
@@ -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();
 
index a943fc86c2b5ad0f7be5a182f3dfcdb4d405a7e6..dc088f867a36d5aaaf6eba4d25474b4a45a83174 100644 (file)
@@ -94,6 +94,7 @@
        <table width="100%">
     <tr>
         <td colspan="2">
+{if $member_of_ogroup}
 {render acl=$gotoNtpServerACL}
                <input type="checkbox" value="1" name="inheritTimeServer"
                        {if $inheritTimeServer } checked {/if} 
                                        changeState('addNtpServer');
                                        changeState('delNtpServer');">{t}Inherit time server attributes{/t}
 {/render}
+{else}
+       <input disabled type='checkbox' name='option_disabled'>{t}Inherit time server attributes{/t}
+{/if}
         </td>
        </tr>
        <tr>
index 9caee6e777ee563c6d77a3b6b693f4f6379cea24..ba8489947ed877f0854782d536e2a750019ffdf0 100644 (file)
@@ -71,6 +71,7 @@
    <table width="100%">
     <tr>
      <td colspan="2">
+{if $member_of_ogroup}
 {render acl=$gotoNtpServerACL}
         <input type="checkbox" value="1" name="inheritTimeServer"
             {if $inheritTimeServer } checked {/if}
@@ -80,6 +81,9 @@
                     changeState('addNtpServer');
                     changeState('delNtpServer');">{t}Inherit time server attributes{/t}
 {/render}
+{else}
+       <input disabled type='checkbox' name='option_disabled'>{t}Inherit time server attributes{/t}
+{/if}
      </td>
     </tr>
     <tr>