From 022668acbab76da7ebcb7ffc0cd563a13c422ae4 Mon Sep 17 00:00:00 2001 From: psc Date: Wed, 21 Oct 2009 13:02:29 +0000 Subject: [PATCH] Followup commit for #3020 - 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 --- .../systems/goto/class_workstationGeneric.inc | 29 +++++++++++++++---- .../systems/goto/class_workstationService.inc | 9 ++++-- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/trunk/gosa-plugins/goto/admin/systems/goto/class_workstationGeneric.inc b/trunk/gosa-plugins/goto/admin/systems/goto/class_workstationGeneric.inc index 7246e5597..8d7748de6 100644 --- a/trunk/gosa-plugins/goto/admin/systems/goto/class_workstationGeneric.inc +++ b/trunk/gosa-plugins/goto/admin/systems/goto/class_workstationGeneric.inc @@ -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"; + } + } } } diff --git a/trunk/gosa-plugins/goto/admin/systems/goto/class_workstationService.inc b/trunk/gosa-plugins/goto/admin/systems/goto/class_workstationService.inc index 1ff57a860..11394020c 100644 --- a/trunk/gosa-plugins/goto/admin/systems/goto/class_workstationService.inc +++ b/trunk/gosa-plugins/goto/admin/systems/goto/class_workstationService.inc @@ -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"), -- 2.30.2