From: Koosha Khajeh Moogahi Date: Thu, 4 Oct 2012 08:00:04 +0000 (+0800) Subject: Bug 794125: Make User.get ignore duplicate groups for membership look ups X-Git-Tag: bugzilla-4.5.1~376 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=341d9da398c18bb508ebeaeb9e415d844285c7a0;p=thirdparty%2Fbugzilla.git Bug 794125: Make User.get ignore duplicate groups for membership look ups r=glob, a=LpSolit --- diff --git a/Bugzilla/WebService/User.pm b/Bugzilla/WebService/User.pm index 5b54285c61..d49ad24a0a 100644 --- a/Bugzilla/WebService/User.pm +++ b/Bugzilla/WebService/User.pm @@ -308,10 +308,12 @@ sub _filter_users_by_group { @{ $group_ids || [] }; my @name_groups = map { Bugzilla::Group->check($_) } @{ $group_names || [] }; - push(@groups, @name_groups); - + my %unique_groups; + foreach my $group (@groups, @name_groups) { + $unique_groups{$group->id} ||= $group; + } - my @in_group = grep { $self->_user_in_any_group($_, \@groups) } + my @in_group = grep { $self->_user_in_any_group($_, [values %unique_groups]) } @$users; return \@in_group; }