diff options
author | Dylan William Hardison <dylan@hardison.net> | 2017-12-23 22:56:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-23 22:56:57 +0100 |
commit | 253c35c0e0322138176abbfb3825dd85dfeece5c (patch) | |
tree | 26040490cbfc8781b0b3c66c670f01b196fecf94 | |
parent | 099ab661d00aaa29eb3ff00749fd851cdd15d4b5 (diff) | |
download | bugzilla-253c35c0e0322138176abbfb3825dd85dfeece5c.tar.gz bugzilla-253c35c0e0322138176abbfb3825dd85dfeece5c.tar.xz |
Bug 1426963 - Make Bugzilla::User->in_group() use a hash lookup
-rw-r--r-- | Bugzilla/User.pm | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index 68a3b8313..dc8f60565 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -1316,7 +1316,9 @@ sub bless_groups { sub in_group { my ($self, $group, $product_id) = @_; $group = $group->name if blessed $group; - if (scalar grep($_->name eq $group, @{ $self->groups })) { + $self->{in_group} //= { map { $_->name => $_ } @{ $self->groups } }; + + if ($self->{in_group}{$group}) { return 1; } elsif ($product_id && detaint_natural($product_id)) { |