Code

Updated Device base selection
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 17 Sep 2010 13:39:51 +0000 (13:39 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 17 Sep 2010 13:39:51 +0000 (13:39 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19758 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/Device/DeviceTab.inc
gosa-plugins/goto/admin/systems/goto/Device/class_Device.inc

index 50fdafe6760014084a253bea279462652447f212..4775ed0d697543587312f9b0a6b21bf56b0df076 100644 (file)
@@ -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;
 
index b333c5a42de42f23a0a7529b88716bdd1a7d6151..7995b8b7c509fbfc73cf0fbf76adbf20e738c4b2 100644 (file)
@@ -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
+                            ),
+
+                     )
+                )
+                );
     }
 }