From 1efbdfc42cd979984b5479b4b2fd5cdcfbdbfbd3 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 25 Apr 2008 13:22:29 +0000 Subject: [PATCH] Removed group/app releases settings too, if a fai release was removed. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10695 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../fai/admin/fai/class_faiManagement.inc | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/gosa-plugins/fai/admin/fai/class_faiManagement.inc b/gosa-plugins/fai/admin/fai/class_faiManagement.inc index 7fea76a93..3215b18f2 100644 --- a/gosa-plugins/fai/admin/fai/class_faiManagement.inc +++ b/gosa-plugins/fai/admin/fai/class_faiManagement.inc @@ -502,9 +502,45 @@ class faiManagement extends plugin $ldap->recursive_remove(); $ldap->cd(preg_replace('/,'.normalizePreg(get_ou('faiou')).'/', ','.get_ou('mimetypeou'), $bb)); $ldap->recursive_remove(); - $this->fai_release = $this->fai_base; + + /* Search for all groups with configured application menus. + - First search all groups, to ensure that we only remove entries form whithin groups. + - The search für menu configuration for the specified release and collect all those dns. + - Remove entries + */ + $release_ou = preg_replace("/".normalizePreg(get_ou("faiou")).".*$/","",$bb); + $ldap->cd($this->config->current['BASE']); + $ldap->search("(objectClass=posixGroup)",array("dn")); + + /* Collect all group dns + */ + $groups = array(); + while($attrs = $ldap->fetch()){ + $groups[] = $attrs['dn']; + } + + /* Collect all group menu release dns that match the release we have removed + */ + $dns = array(); + foreach($groups as $dn){ + $ldap->cd($dn); + $ldap->search("(objectClass=FAIbranch)",array("dn")); + while($attrs = $ldap->fetch()){ + if(preg_match("/^".normalizePreg($release_ou)."/",$attrs['dn'])){ + $dns[] = $attrs['dn']; + } + } + } + + /* Finally remove collected release dns + */ + foreach($dns as $dn){ + $ldap->cd($dn); + $ldap->recursive_remove(); + } /* Post remove */ + $this->fai_release = $this->fai_base; $this->lock_name = $name; $this->lock_dn = $bb; $this->postremove(); -- 2.30.2