summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7fbe446)
raw | patch | inline | side by side (parent: 7fbe446)
author | psc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 29 Oct 2009 09:56:07 +0000 (09:56 +0000) | ||
committer | psc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 29 Oct 2009 09:56:07 +0000 (09:56 +0000) |
- Use release dn as search base when checking if a given
classname is already used by another administrative unit.
- Remove the unittag from the filter that is used to search
for existing classes. This way every class is found that
has the same name and it can not happen, that the error
may not be shown under some circumstances.
- As a side-effect of the previous change, the error might
also be shown, if the classname is in use in the same
administrative unit. But this is already handled by a
standard duplicate check, so to avoid double error message,
we only check for the classnames, if the previous check didn't
trigger an error message.
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@14703 594d385d-05f5-0310-b6e9-bd551577e9d8
classname is already used by another administrative unit.
- Remove the unittag from the filter that is used to search
for existing classes. This way every class is found that
has the same name and it can not happen, that the error
may not be shown under some circumstances.
- As a side-effect of the previous change, the error might
also be shown, if the classname is in use in the same
administrative unit. But this is already handled by a
standard duplicate check, so to avoid double error message,
we only check for the classnames, if the previous check didn't
trigger an error message.
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@14703 594d385d-05f5-0310-b6e9-bd551577e9d8
trunk/gosa-plugins/fai/admin/fai/class_askClassName.inc | patch | blob | history |
diff --git a/trunk/gosa-plugins/fai/admin/fai/class_askClassName.inc b/trunk/gosa-plugins/fai/admin/fai/class_askClassName.inc
index 6b9c49649e97ad30f53ec4ed00244fe5b4cbd324..de302bd2ad75a5fe0dfd775d99560c2a6ee72483 100644 (file)
if(in_array($this->ClassName,$this->forbidden)){
$message[]= msgPool::duplicated(_("Name"));
}
-
- /* Check if the given ClassName is already used in another administrative unit */
- $parent_tag = $this->get_gosaUnitTag($this->parent->base);
-
- $ldap= $this->config->get_ldap_link();
- $filter = "(&(cn=".$this->ClassName.")(!(gosaUnitTag=".$parent_tag.")))";
- $ldap->search($filter, array("dn","gosaUnitTag"));
-
- if ($ldap->count() > 0) {
- $entry = $ldap->fetch();
-
- /* Find out which administrative unit is using the classname */
- $ldap->cd($this->config->current['BASE']);
- $filter = "(&(objectClass=gosaAdministrativeUnit)(gosaUnitTag=".$entry['gosaUnitTag'][0]."))";
- $ldap->search($filter, array('dn', 'ou'));
+ else {
+ /* Check if the given ClassName is already used in another administrative unit */
+ $ldap= $this->config->get_ldap_link();
+ $filter = "(cn=".$this->ClassName.")";
+ $ldap->cd($this->parent->fai_release);
+ $ldap->search($filter, array("dn","gosaUnitTag"));
if ($ldap->count() > 0) {
$entry = $ldap->fetch();
- $used_by = $entry['ou'][0];
- } else {
- $used_by = $entry['gosaUnitTag'][0];
- }
-
- $message[]= sprintf(_("This FAI class name is already in use by the administrative unit '%s'."), $used_by);
-
- }
+ /* Find out which administrative unit is using the classname */
+ $ldap->cd($this->config->current['BASE']);
+ $filter = "(&(objectClass=gosaAdministrativeUnit)(gosaUnitTag=".$entry['gosaUnitTag'][0]."))";
+ $ldap->search($filter, array('dn', 'ou'));
+
+ if ($ldap->count() > 0) {
+ $entry = $ldap->fetch();
+ $used_by = $entry['ou'][0];
+ } else {
+ $used_by = $entry['gosaUnitTag'][0];
+ }
+
+ $message[]= sprintf(_("This FAI class name is already in use by the administrative unit '%s'."), $used_by);
+ }
+ }
return ($message);
}