foreach $g ($rv->all_entries) {
local @mems = $g->get_value("memberUid");
local $gname = $g->get_value("cn");
+ local $ldap_group_id = $g->get_value("gidNumber");
if ($renaming) {
local $idx = &indexof($olduser, @mems);
if ($ingroup{$gname} && $idx<0) {
# Need to add to the group
push(@mems, $user);
+ push(@sgids, $ldap_group_id);
}
elsif (!$ingroup{$gname} && $idx>=0) {
# Need to remove from the group
elsif ($idx >= 0) {
# Need to rename in group
$mems[$idx] = $user;
+ push(@sgids, $ldap_group_id);
}
else { next; }
}
if ($ingroup{$gname} && $idx<0) {
# Need to add to the group
push(@mems, $user);
+ push(@sgids, $ldap_group_id);
}
elsif (!$ingroup{$gname} && $idx>=0) {
# Need to remove from the group
splice(@mems, $idx, 1);
}
+ elsif ($ingroup{$gname} && $idx >=0) {
+ # already in this group
+ push(@sgids, $ldap_group_id);
+ next;
+ }
else { next; }
}
# Run post-change script
&set_user_envs(\%user, $in{'new'} ? 'CREATE_USER' : 'MODIFY_USER',
- $in{'passmode'} == 3 ? $in{'pass'} : "", undef);
+ $in{'passmode'} == 3 ? $in{'pass'} : "", \@sgids);
&made_changes();
# Run other modules' scripts