From c947ee43b2d4f1224b1dbcf8f63d841d7a342acf Mon Sep 17 00:00:00 2001 From: cajus Date: Mon, 26 Jun 2006 12:47:22 +0000 Subject: [PATCH] Fixed department creation with already existing ou's git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@3911 594d385d-05f5-0310-b6e9-bd551577e9d8 --- Changelog | 1 + plugins/admin/departments/class_departmentGeneric.inc | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Changelog b/Changelog index ee58e8032..5d2bc8d09 100644 --- a/Changelog +++ b/Changelog @@ -14,6 +14,7 @@ GOsa2 changelog - Fixed problems when moving around departments including a comma - Unified bool values in gosa.conf. true/yes and false/no are valid now in upper and lower case. + - Avoid the try of creating already existing ou's * gosa 2.5.1 - Fixed problems with NFS shares and terminals diff --git a/plugins/admin/departments/class_departmentGeneric.inc b/plugins/admin/departments/class_departmentGeneric.inc index e7bdf678d..5205da944 100644 --- a/plugins/admin/departments/class_departmentGeneric.inc +++ b/plugins/admin/departments/class_departmentGeneric.inc @@ -221,8 +221,8 @@ class department extends plugin /* Check for presence of this department */ $ldap= $this->config->get_ldap_link(); - $attrs= $ldap->cat ($this->dn, array('dn')); - if ($this->orig_dn == "new" && !($attrs === FALSE)){ + $ldap->ls ("(&(ou=".$this->ou.")(objectClass=organizationalUnit))", $this->base, array('dn')); + if ($this->orig_dn == "new" && $ldap->count()){ $message[]= _("Department with that 'Name' already exists."); } elseif ($this->orig_dn != $this->dn && !($attrs === FALSE)){ $message[]= _("Department with that 'Name' already exists."); -- 2.30.2