X-Git-Url: https://git.tokkee.org/?p=gosa.git;a=blobdiff_plain;f=trunk%2Fgosa-plugins%2Fgoto%2Fadmin%2Fsystems%2Fgoto%2Fclass_workstationGeneric.inc;h=a9c0d62d8a4644083f60e952df26e573ca487701;hp=8d7748de6c642f4f09e9c15a371161b6864063e0;hb=babd4528edd7a7dd5e52979e5d313df0a097d76a;hpb=f9bebb10680bba78d95143d438124776bd004e0c 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 8d7748de6..a9c0d62d8 100644 --- a/trunk/gosa-plugins/goto/admin/systems/goto/class_workstationGeneric.inc +++ b/trunk/gosa-plugins/goto/admin/systems/goto/class_workstationGeneric.inc @@ -33,6 +33,7 @@ class workgeneric extends plugin var $orig_dn= ""; var $orig_cn= ""; var $orig_base= ""; + var $ogroup=FALSE; /* Plugin side filled */ var $modes= array(); @@ -182,6 +183,12 @@ class workgeneric extends plugin /* Call parent execute */ plugin::execute(); + if ($this->ogroup) { + $this->member_of_ogroup = TRUE; + $this->parent->by_object['workservice']->ogroup = $this->ogroup; + $this->set_everything_to_inherited(); + } + if($this->is_account && !$this->view_logged){ $this->view_logged = TRUE; new log("view","workstation/".get_class($this),$this->dn); @@ -636,6 +643,13 @@ class workgeneric extends plugin } } } + + /* If $this->ogroup is set add the new system to the requested ogroup */ + if ($this->ogroup) { + $og = new ogroup($this->config, $this->ogroup); + $og->AddDelMembership($this->dn); + $og->save(); + } } @@ -721,19 +735,28 @@ class workgeneric extends plugin { /* Find out what is set in the object group as XDriver */ $inherit_xdriver = 0; - if ($this->dn != 'new') { + if ($this->dn != 'new' || $this->ogroup) { $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; + $entry = NULL; + /* If initialized with an object group we need to use this instead of + * an object group we'll become a member in */ + if ($this->ogroup) { + $entry = $ldap->cat($this->ogroup, array("gotoXDriver")); + }else { + $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("gotoXDriver")); + if ($ldap->count() == 1) { + $entry = $ldap->fetch(); } } + if ($entry) { + /* 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";