summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2d0d110)
raw | patch | inline | side by side (parent: 2d0d110)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 29 Sep 2010 09:03:37 +0000 (09:03 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 29 Sep 2010 09:03:37 +0000 (09:03 +0000) |
-
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19843 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19843 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/goto/admin/systems/goto/Device/DeviceTab.inc | patch | blob | history | |
gosa-plugins/goto/admin/systems/goto/Device/class_Device.inc | patch | blob | history |
diff --git a/gosa-plugins/goto/admin/systems/goto/Device/DeviceTab.inc b/gosa-plugins/goto/admin/systems/goto/Device/DeviceTab.inc
index 4775ed0d697543587312f9b0a6b21bf56b0df076..86f09f7922ce0d37825bfdca733feff46f2e72da 100644 (file)
{
// Prepare object DN
$baseobject= $this->by_object['Device'];
- $uuid = preg_replace('/,/', '\,', $baseobject->deviceUUID);
+ $uuid = $baseobject->deviceUUID;
+ $orig_uuid = $baseobject->orig_deviceUUID;
+
$rdn = get_ou('Device','DeviceRDN');
- if(empty($uuid)){
- $cn = preg_replace('/,/', '\,', $baseobject->cn);
- $cn = preg_replace('/"/', '\"', $cn);
- $this->dn= "cn=".$cn.",".$rdn.$baseobject->base;
- }else{
- $this->dn= "deviceUUID=".$uuid.",".$rdn.$baseobject->base;
- }
- $baseobject->dn= $this->dn;
+ $cn = preg_replace('/,/', '\,', $baseobject->cn);
+ $cn = preg_replace('/"/', '\"', $cn);
- // Object moved?
- if($this->dn != $baseobject->orig_dn && $baseobject->orig_dn != "new"){
- $baseobject->update_acls($baseobject->orig_dn,$this->dn);
- $baseobject->move($baseobject->orig_dn,$this->dn);
+ $dnCn = "cn=".$cn.",".$rdn.$baseobject->base;
+ $dnUuid= "deviceUUID=".$uuid.",".$rdn.$baseobject->base;
+
+ // Save object using the 'cn' in the dn and then move it to 'uuid';
+ $moveToUUID = FALSE;
+ if(!empty($uuid) && empty($orig_uuid) && $baseobject->orig_dn != "new"){
+ $moveToUUID = TRUE;
}
+ // Detect target dn
+ $this->dn = (empty($uuid)) ? $dnCn : $dnUuid;
+
+ if($moveToUUID) $this->dn = $dnCn;
+
// Populate values
foreach ($this->by_object as $key => $obj){
$this->by_object[$key]->dn= $this->dn;
$this->by_object[$key]->cn= $baseobject->cn;
}
+ // Object moved?
+ if($this->dn != $baseobject->orig_dn && $baseobject->orig_dn != "new"){
+ $baseobject->update_acls($baseobject->orig_dn,$this->dn);
+ $baseobject->move($baseobject->orig_dn,$this->dn);
+ }
+
// Save now
tabs::save(TRUE);
+
+ if($moveToUUID){
+ $this->dn = (empty($uuid)) ? $dnCn : $dnUuid;
+ $baseobject->update_acls($baseobject->orig_dn,$this->dn);
+ $baseobject->move($baseobject->orig_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 7995b8b7c509fbfc73cf0fbf76adbf20e738c4b2..8f54646bcc727b33e2c95c9ae05d8553040800de 100644 (file)
$this->baseSelector->setSubmitButton(false);
$this->baseSelector->setHeight(300);
$this->baseSelector->update(true);
+
+ $this->orig_deviceUUID = $this->deviceUUID;
}
// 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");
}
$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