From d8c4ece930b8cd66e10c5193d9d7824485d9864e Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 17 Sep 2010 13:39:51 +0000 Subject: [PATCH] Updated Device base selection git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19758 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/systems/goto/Device/DeviceTab.inc | 5 ++- .../systems/goto/Device/class_Device.inc | 38 +++++++++++++++---- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/gosa-plugins/goto/admin/systems/goto/Device/DeviceTab.inc b/gosa-plugins/goto/admin/systems/goto/Device/DeviceTab.inc index 50fdafe67..4775ed0d6 100644 --- a/gosa-plugins/goto/admin/systems/goto/Device/DeviceTab.inc +++ b/gosa-plugins/goto/admin/systems/goto/Device/DeviceTab.inc @@ -8,12 +8,13 @@ class DeviceTab extends tabs $baseobject= $this->by_object['Device']; $uuid = preg_replace('/,/', '\,', $baseobject->deviceUUID); + $rdn = get_ou('Device','DeviceRDN'); if(empty($uuid)){ $cn = preg_replace('/,/', '\,', $baseobject->cn); $cn = preg_replace('/"/', '\"', $cn); - $this->dn= "cn=".$cn.",ou=systems,".$baseobject->base; + $this->dn= "cn=".$cn.",".$rdn.$baseobject->base; }else{ - $this->dn= "deviceUUID=".$uuid.",ou=systems,".$baseobject->base; + $this->dn= "deviceUUID=".$uuid.",".$rdn.$baseobject->base; } $baseobject->dn= $this->dn; diff --git a/gosa-plugins/goto/admin/systems/goto/Device/class_Device.inc b/gosa-plugins/goto/admin/systems/goto/Device/class_Device.inc index b333c5a42..7995b8b7c 100644 --- a/gosa-plugins/goto/admin/systems/goto/Device/class_Device.inc +++ b/gosa-plugins/goto/admin/systems/goto/Device/class_Device.inc @@ -40,9 +40,16 @@ class Device extends plugin function __construct(&$config, $dn) { plugin::plugin($config, $dn); - $this->base = $this->config->current['BASE']; $this->orig_dn = $this->dn; + // Initialize the object base + if ($this->dn == "new"){ + $ui= get_userinfo(); + $this->base= dn2base(session::global_is_set("CurrentMainBase")?"cn=dummy,".session::global_get("CurrentMainBase"):$ui->dn); + } else { + $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("Device", "DeviceRDN"), '/')."/i", "", $this->dn); + } + // Prepare the base selector $this->baseSelector= new baseSelector($this->get_allowed_bases(), $this->base); $this->baseSelector->setSubmitButton(false); @@ -268,11 +275,14 @@ class Device extends plugin "plDepends" => array(), "plPriority" => 1, "plSection" => array("administration"), - "plCategory" => array( + "plCategory" => + array( "Device" => array( "description" => _("Device"), - "objectClass" => "Device")), - "plProvidedAcls" => array( + "objectClass" => "Device") + ), + "plProvidedAcls" => + array( "base" => _("Base"), "cn" => _("Name"), "serialNumber" => _("Serial number"), @@ -288,9 +298,23 @@ class Device extends plugin "deviceType" => _("Type"), "macAddress" => _("MAC address"), "ipHostNumber" => _("IP address") - ) - ) - ); + ), + "plProperties" => + array( + array( + "name" => "DeviceRDN", + "type" => "rdn", + "default" => "ou=devices,ou=systems,", + "description" => _("The 'deviceRDN' statement defines the location where new devices will be created. The default is 'ou=device,ou=systems,'."), + "check" => "gosaProperty::isRdn", + "migrate" => "migrate_deviceRDN", + "group" => "plugin", + "mandatory" => FALSE + ), + + ) + ) + ); } } -- 2.30.2