From 989339543f5227aae4ced5ef7d422a4b9f211997 Mon Sep 17 00:00:00 2001 From: psc Date: Tue, 7 Sep 2010 08:49:19 +0000 Subject: [PATCH] Apply patch for #5210 Fix a problem with the deletion of fai classes: The query weither a class is associated to a profile matched classes, which contained the name of a to-be-deleted class as a substring of their own name. The query was changed in a way that the list of associated classes is compared exactly with the class to be deleted. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@19542 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../gosa-plugins/fai/admin/fai/class_FAI.inc | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/trunk/gosa-plugins/fai/admin/fai/class_FAI.inc b/trunk/gosa-plugins/fai/admin/fai/class_FAI.inc index 2b3d1a0b5..ef27ae6ff 100644 --- a/trunk/gosa-plugins/fai/admin/fai/class_FAI.inc +++ b/trunk/gosa-plugins/fai/admin/fai/class_FAI.inc @@ -249,17 +249,22 @@ class FAI /* Check if this Profile uses the source class ($cn) */ - if(preg_match("/".preg_quote($cn, '/')."/",$attrs['FAIclass'])){ - $attrs['FAIclass'] = preg_replace("/[ ]*".preg_quote($cn, '/')."[ ]*/i"," ",$attrs['FAIclass']); - if(empty($attrs['FAIclass'])){ - $attrs['FAIclass'] = array(); - } - $ldap->cd($dn['dn']); - $ldap->modify($attrs); - - if (!$ldap->success()){ - msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class())); - } + $classlist = split(" ", $attrs['FAIclass']); + $new_classlist = ""; + foreach($classlist as $class){ + if($class != $cn){ + $new_classlist = $new_classlist." ".$class; + } + } + $attrs['FAIclass'] = $new_classlist; + if(empty($attrs['FAIclass'])){ + $attrs['FAIclass'] = array(); + } + $ldap->cd($dn['dn']); + $ldap->modify($attrs); + + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class())); } } } -- 2.30.2