summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3e54fd8)
raw | patch | inline | side by side (parent: 3e54fd8)
author | psc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 1 Oct 2010 08:42:20 +0000 (08:42 +0000) | ||
committer | psc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 1 Oct 2010 08:42:20 +0000 (08:42 +0000) |
When creating, renaming or copy-pasting a system, no longer allow two
workstations or server of the same name in two different departments.
As an exception, allow them if they are in two different
administrative units and the "honourUnitTags" option is enabled.
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@19882 594d385d-05f5-0310-b6e9-bd551577e9d8
workstations or server of the same name in two different departments.
As an exception, allow them if they are in two different
administrative units and the "honourUnitTags" option is enabled.
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@19882 594d385d-05f5-0310-b6e9-bd551577e9d8
trunk/gosa-plugins/goto/admin/systems/goto/class_workstationGeneric.inc | patch | blob | history | |
trunk/gosa-plugins/systems/admin/systems/class_servGeneric.inc | patch | blob | history |
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 86d1bc105732b471e8f5210f513b23631aa9d8aa..7d516ab70879585ab604401e4a6622fab83c403c 100644 (file)
if ($this->orig_dn != $this->dn){
$ldap= $this->config->get_ldap_link();
- $ldap->cd ($this->base);
+ # Do not allow objects with the same name in other departments, either
+ $ldap->cd ($this->config->current['BASE']);
if($this->cn == "wdefault"){
$ldap->cat($this->dn);
}else{
- $ldap->search ("(&(cn=".$this->cn.")(objectClass=gotoWorkstation))", array("cn"));
+ $ldap->search ("(&(cn=".$this->cn.")(objectClass=gotoWorkstation))", array("cn", "gosaUnitTag"));
}
if ($ldap->count() != 0){
while ($attrs= $ldap->fetch()){
if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".get_ou('systemIncomingRDN')."/", $ldap->getDN())){
continue;
} else {
- if ($attrs['dn'] != $this->orig_dn){
- $message[]= msgPool::duplicated(_("Name"));
- break;
+ if ($attrs['dn'] != $this->orig_dn) {
+ if (isset($this->config->current['HONOURUNITTAGS']) &&
+ preg_match('/true/i', $this->config->current['HONOURUNITTAGS']) &&
+ $attrs['gosaUnitTag'][0] != $this->get_gosaUnitTag()) {
+ # the new/moved object is in a different administrative unit, this is not a duplicate
+ continue;
+ } else {
+ $message[]= msgPool::duplicated(_("Name"));
+ break;
+ }
}
}
}
diff --git a/trunk/gosa-plugins/systems/admin/systems/class_servGeneric.inc b/trunk/gosa-plugins/systems/admin/systems/class_servGeneric.inc
index 1c889b7b9f7705ea49a114cb9f40e63b6418f6b0..4eaeb02180685135d657ad9d800495ab730cad32 100644 (file)
if ($this->orig_dn != $this->dn){
$ldap= $this->config->get_ldap_link();
- $ldap->cd ($this->base);
- $ldap->search ("(cn=".$this->cn.")", array("cn"));
+ # Do not allow objects with the same name in other departments, either
+ $ldap->cd ($this->config->current['BASE']);
+ $ldap->search ("(cn=".$this->cn.")", array("cn", "gosaUnitTag"));
if ($ldap->count() != 0){
while ($attrs= $ldap->fetch()){
if ($attrs['dn'] != $this->orig_dn){
if(!preg_match("/cn=dhcp,/",$attrs['dn']) && !preg_match("/,".get_ou('systemIncomingRDN')."/",$attrs['dn']) && preg_match("/,".get_ou('serverRDN')."/",$attrs['dn'])){
- $message[]= msgPool::duplicated(_("Server name"));
- break;
+ if (isset($this->config->current['HONOURUNITTAGS']) &&
+ preg_match('/true/i', $this->config->current['HONOURUNITTAGS']) &&
+ $attrs['gosaUnitTag'][0] != $this->get_gosaUnitTag()) {
+ # the new/moved object is in a different administrative unit, this is not a duplicate
+ continue;
+ } else {
+ $message[]= msgPool::duplicated(_("Server Name"));
+ break;
+ }
}
}
}