Code

Remove user acls too, if user is removed
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 5 Jun 2007 11:53:49 +0000 (11:53 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 5 Jun 2007 11:53:49 +0000 (11:53 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6548 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/personal/generic/class_user.inc

index 724ed900772748ffe060ac7fb6d7a5b13a0d0f03..c2f6a2f0910bb916821de6649094c6b021ea11a0 100644 (file)
@@ -653,6 +653,23 @@ class user extends plugin
       kadm5_destroy($handle);
     }
 
+    /* Remove ACL dependencies too, 
+     */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(&(objectClass=gosaAcl)(gosaAclEntry=*".base64_encode($this->dn)."*))",array("gosaAclEntry","dn"));
+    while($attrs = $ldap->fetch()){
+      $acl = new acl($this->config,$this->parent,$attrs['dn']);
+      foreach($acl->gosaAclEntry as $id => $entry){
+        foreach($entry['members'] as $m_id => $member){
+          if($m_id == "U:".$this->dn){
+            unset($acl->gosaAclEntry[$id]['members'][$m_id]); 
+            gosa_log("modify","users/acl",$attrs['dn'],array(),sprintf("Removed acl for %s on object %s.",$this->dn,$attrs['dn'])); 
+          }
+        }
+      }  
+      $acl -> save();
+    }
 
     /* Optionally execute a command after we're done */
     $this->handle_post_events("remove",array("uid" => $this->uid));