Code

Hide php errors
[gosa.git] / plugins / admin / applications / class_applicationGeneric.inc
index 27cf79eb1084ccbf5b2b05857364cfb76b732f73..351d6e458cb1234aa8183e055ddd26173d6a8903 100644 (file)
@@ -44,8 +44,12 @@ class application extends plugin
        $this->is_account= TRUE;
 
        if ($this->dn == "new"){
-               $ui= get_userinfo();
-               $this->base= dn2base($ui->dn);
+               if(isset($_SESSION['appfilter']['depselect'])){
+                       $this->base=$_SESSION['appfilter']['depselect'];
+               }else{
+                       $ui= get_userinfo();
+                       $this->base= dn2base($ui->dn);
+               }
        } else {
                $this->base= preg_replace ("/^[^,]+,[^,]+,/", "", $this->dn);
        }
@@ -98,6 +102,7 @@ class application extends plugin
        return($smarty->fetch (get_template_path('generic.tpl', TRUE)));
   }
 
+
   function remove_from_parent()
   {
        $ldap= $this->config->get_ldap_link();
@@ -114,6 +119,12 @@ class application extends plugin
                unset($og->member[$this->dn]);
                $og->save ();
        }
+       $ldap->search ("(&(objectClass=posixGroup)(gosaMemberApplication=".$this->cn."))", array("cn"));
+       while ($attrs= $ldap->fetch()){
+               $ag= new appgroup($this->config, $ldap->getDN());
+               $ag->removeApp($this->cn);
+               $ag->save ();
+       }
 
   }