Code

Removed group/app releases settings too, if a fai release was removed.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 25 Apr 2008 13:22:29 +0000 (13:22 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 25 Apr 2008 13:22:29 +0000 (13:22 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10695 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/fai/admin/fai/class_faiManagement.inc

index 7fea76a93cb40e335d20310d9d1be8831a9c403d..3215b18f245e8152438502d57d781080c748bb69 100644 (file)
@@ -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();