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 a6a8a42fa46e7bd40fb12855a792fcbc467c0d31..7308ae53d80ddc722e6ffdd68d1958154052242e 100644 (file)
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);
+ $this->baseSelector->setHeight(300);
+ $this->baseSelector->update(true);
+
+ $this->orig_deviceUUID = $this->deviceUUID;
}
// Assign just user names instead of the complete dn.
$smarty->assign("owner_name", $this->getUserName($this->owner));
$smarty->assign("manager_name", $this->getUserName($this->manager));
+ $smarty->assign("base", $this->baseSelector->render());
+ // Assign attribute values
foreach($this->attributes as $attr){
- $smarty->assign($attr, $this->$attr);
+ $smarty->assign($attr, set_post($this->$attr));
}
return($smarty->fetch(get_template_path('goto/Device/Device.tpl', TRUE)));
}
}
// Check mac-address
- if (!empty($this->ipHostNumber) && !tests::is_ip($this->macAddress)){
+ if (!empty($this->macAddress) && !tests::is_mac($this->macAddress)){
$message[]= msgPool::invalid(_("MAC address"), "", "", "00:0C:7F:31:33:F1");
}
// Regenerate a new uuid
if(isset($_POST['reloadUUID'])) $this->deviceUUID = $this->genFakeUuid();
+
+ // Update the base
+ if ($this->acl_is_moveable($this->base)){
+ if (!$this->baseSelector->update()) {
+ msg_dialog::display(_("Error"), msgPool::permMove(), ERROR_DIALOG);
+ }
+ if ($this->base != $this->baseSelector->getBase()) {
+ $this->base= $this->baseSelector->getBase();
+ $this->is_modified= TRUE;
+ }
+ }
+
}
$this->cleanup();
$ldap=$this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
+ $ldap->create_missing_trees(preg_replace("/^[^,]*+,/","",$this->dn));
$ldap->cd($this->dn);
// Perform action modify/create
"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"),
"seeAlso" => _("See also"),
"l" => _("Location"),
"description" => _("Description"),
"manager" => _("Manager"),
- "deviceUUID" => _("Uuid"),
+ "deviceUUID" => _("UUID"),
"deviceStatus" => _("Status"),
"deviceType" => _("Type"),
"macAddress" => _("MAC address"),
"ipHostNumber" => _("IP address")
- )
- )
- );
+ ),
+ "plProperties" =>
+ array(
+ array(
+ "name" => "DeviceRDN",
+ "type" => "rdn",
+ "default" => "ou=devices,ou=systems,",
+ "description" => _("RDN for device storage."),
+ "check" => "gosaProperty::isRdn",
+ "migrate" => "migrate_deviceRDN",
+ "group" => "plugin",
+ "mandatory" => FALSE
+ ),
+
+ )
+ )
+ );
}
}