Commit 297024e7 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 403755: DBI error thrown when you cannot edit a bug which is in a product…

Bug 403755: DBI error thrown when you cannot edit a bug which is in a product restricted by CANEDIT - Patch by Fré©ric Buclin <LpSolit@gmail.com> r/a=mkanat
parent aad74658
......@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment