Revision 5c0c9e67
Von Sven Schöling vor etwa 15 Jahren hinzugefügt
bin/mozilla/admin_groups.pl | ||
---|---|---|
32 | 32 |
# |
33 | 33 |
#====================================================================== |
34 | 34 |
|
35 |
use List::MoreUtils qw(uniq); |
|
36 |
|
|
35 | 37 |
sub edit_groups { |
36 | 38 |
$lxdebug->enter_sub(); |
37 | 39 |
|
... | ... | |
114 | 116 |
my %all_users = $auth->read_all_users(); |
115 | 117 |
my %users_by_id = map { $_->{id} => $_ } values %all_users; |
116 | 118 |
|
117 |
my @members = sort { lc $a->{login} cmp lc $b->{login} } @users_by_id{ @{ $group->{members} } }; |
|
119 |
my @members = uniq sort { lc $a->{login} cmp lc $b->{login} } @users_by_id{ @{ $group->{members} } };
|
|
118 | 120 |
|
119 |
my %grouped = map { $_ => 1 } @{ $group->{members} }; |
|
121 |
my %grouped = map { $_ => 1 } uniq @{ $group->{members} };
|
|
120 | 122 |
my @non_members = sort { lc $a->{login} cmp lc $b->{login} } grep { !$grouped{$_->{id}} } values %all_users; |
121 | 123 |
|
122 | 124 |
my @rights = map { |
... | ... | |
173 | 175 |
} |
174 | 176 |
|
175 | 177 |
$group = $groups->{$form->{group_id}}; |
176 |
push @{ $group->{members} }, $form->{user_id_not_in_group};
|
|
178 |
$group->{members} = [ uniq @{ $group->{members} }, $form->{user_id_not_in_group} ];
|
|
177 | 179 |
|
178 | 180 |
$auth->save_group($group); |
179 | 181 |
|
... | ... | |
195 | 197 |
} |
196 | 198 |
|
197 | 199 |
$group = $groups->{$form->{group_id}}; |
198 |
$group->{members} = [ grep { $_ ne $form->{user_id_in_group} } @{ $group->{members} } ]; |
|
200 |
$group->{members} = [ uniq grep { $_ ne $form->{user_id_in_group} } @{ $group->{members} } ];
|
|
199 | 201 |
|
200 | 202 |
$auth->save_group($group); |
201 | 203 |
|
Auch abrufbar als: Unified diff
Mehrere Sanity Checks um zu verhindern, dass $group->{members} Dublikate enthält.
Hoffentlich Fix für Bug 1057.