1 |
vip-ire |
1.1 |
--- e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/ldap-delete.update_group_membership_on_delete 2010-10-11 23:39:46.000000000 +0200 |
2 |
|
|
+++ e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/ldap-delete 2010-10-11 23:41:42.000000000 +0200 |
3 |
|
|
@@ -114,6 +114,17 @@ |
4 |
|
|
$ldap->delete($mesg->entry(0)); |
5 |
|
|
} |
6 |
|
|
|
7 |
|
|
+# Remove group membership for the account we are deleting |
8 |
|
|
+$mesg = $ldap->search( base=> "ou=Groups,$base", filter => "(memberUid=$name)", scope => 'one' ); |
9 |
|
|
+if ($mesg->code && $mesg->code != 32) |
10 |
|
|
+{ |
11 |
|
|
+ warn "Failed ldap search memberUid=$name,ou=Groups,$base: ", $mesg->error; |
12 |
|
|
+} |
13 |
|
|
+else |
14 |
|
|
+{ |
15 |
|
|
+ $ldap->delete($_, 'memberUid' => [ $name ] ) foreach $mesg->entries(); |
16 |
|
|
+} |
17 |
|
|
+ |
18 |
|
|
$ldap->unbind; |
19 |
|
|
|
20 |
|
|
exit (0); |