Code

Followup commit for #3020
authorpsc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 21 Oct 2009 13:02:29 +0000 (13:02 +0000)
committerpsc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 21 Oct 2009 13:02:29 +0000 (13:02 +0000)
- Allow inheritance of XDriver if the object group sets a valid
  driver and only if the possible inheritance is unambigious
  (e.g. the object is not a member of several object groups)
- Show the text 'manual/auto' only when working with object groups
  and stick with unknown for workstation objects.

git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@14614 594d385d-05f5-0310-b6e9-bd551577e9d8

trunk/gosa-plugins/goto/admin/systems/goto/class_workstationGeneric.inc
trunk/gosa-plugins/goto/admin/systems/goto/class_workstationService.inc

index 7246e559782671d88870fd27aa25bafab71a8fb7..8d7748de6c642f4f09e9c15a371161b6864063e0 100644 (file)
@@ -719,16 +719,35 @@ class workgeneric extends plugin
 
   function set_everything_to_inherited()
   {
+    /* Find out what is set in the object group as XDriver */
+    $inherit_xdriver = 0;
+    if ($this->dn != 'new') {
+        $ldap = $this->config->get_ldap_link();
+        $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("gotoXDriver"));
+        if ($ldap->count() == 1) {
+          $entry = $ldap->fetch();
+          /* Get list of valid XDrivers */
+          $xdrivers = $this->parent->by_object['workservice']->getListOfXDrivers();
+          /* Only inherit if driver in object group is set to something in the list of
+           * valid XDrivers */
+          if (in_array($entry['gotoXDriver'][0], $xdrivers)) {
+            $inherit_xdriver = 1;
+          }
+        }
+    }
+
     $this->gotoSyslogServer  = "default";
     $this->inheritTimeServer = TRUE;
 
     /* Set workstation service attributes to inherited */
     if($this->member_of_ogroup && isset($this->parent->by_object['workservice'])){
-      foreach(array("gotoXKbLayout","gotoXKbModel","gotoXKbVariant",
-            "gotoXResolution","gotoXColordepth","gotoXMouseType","gotoXMouseport") as $name){
-        if($this->parent->by_object['workservice']->acl_is_writeable($name)){
-          $this->parent->by_object['workservice']->$name = "default"; 
-        }
+      foreach(array("gotoXKbLayout","gotoXKbModel","gotoXKbVariant", "gotoXDriver",
+        "gotoXResolution","gotoXColordepth","gotoXMouseType","gotoXMouseport") as $name){
+          if(!(($name == 'gotoXDriver') && ($inherit_xdriver == 0))) {
+              if($this->parent->by_object['workservice']->acl_is_writeable($name)){
+                $this->parent->by_object['workservice']->$name = "default"; 
+              }
+          }
       }
     }
 
index 1ff57a860b139071e16e74a58377fbc6da81beb9..11394020cb07940417786a3ab4acb400a7635757 100644 (file)
@@ -84,8 +84,13 @@ class workservice extends plugin
       $this->XDrivers[$xdriver] = $xdriver;
     }
 
-    array_unshift($this->XDrivers, "["._("manual/auto")."]");
+    if (isset($this->attrs['gosaGroupObjects'])) {
+      array_unshift($this->XDrivers, "["._("manual/auto")."]");
+    }
+    else {
+      array_unshift($this->XDrivers, "["._("unknown")."]");
+    }
+     
     $this->XColordepths= array( 
         "8"        => "8 " ._("bit"), 
         "15"       => "15 "._("bit"),