summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Bugzilla/User.pm25
1 files changed, 10 insertions, 15 deletions
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index f9448ff57..7cd1910c4 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -562,21 +562,16 @@ sub can_see_user {
sub can_edit_product {
my ($self, $prod_id) = @_;
my $dbh = Bugzilla->dbh;
- my $sth = $self->{sthCanEditProductId};
- my $userid = $self->id;
- my $query = q{SELECT group_id FROM group_control_map
- WHERE product_id =?
- AND canedit != 0 };
- if (%{$self->groups}) {
- my $groups = join(',', values(%{$self->groups}));
- $query .= qq{AND group_id NOT IN($groups)};
- }
- unless ($sth) { $sth = $dbh->prepare($query); }
- $sth->execute($prod_id);
- $self->{sthCanEditProductId} = $sth;
- my $result = $sth->fetchrow_array();
-
- return (!defined($result));
+
+ my $has_external_groups =
+ $dbh->selectrow_array('SELECT 1
+ FROM group_control_map
+ WHERE product_id = ?
+ AND canedit != 0
+ AND group_id NOT IN(' . $self->groups_as_string . ')',
+ undef, $prod_id);
+
+ return !$has_external_groups;
}
sub can_see_bug {