Commit 7619511f authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 330754: Remove AnyEntryGroups() from globals.pl - Patch by Frédéric Buclin…

Bug 330754: Remove AnyEntryGroups() from globals.pl - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=justdave
parent 8604641c
...@@ -54,9 +54,7 @@ use vars qw( ...@@ -54,9 +54,7 @@ use vars qw(
@legal_severity @legal_severity
); );
# If we're using bug groups to restrict bug entry, we need to know who the my $user = Bugzilla->login(LOGIN_REQUIRED);
# user is right from the start.
Bugzilla->login(LOGIN_REQUIRED) if AnyEntryGroups();
my $cloned_bug; my $cloned_bug;
my $cloned_bug_id; my $cloned_bug_id;
...@@ -68,8 +66,6 @@ my $vars = {}; ...@@ -68,8 +66,6 @@ my $vars = {};
my $product = trim($cgi->param('product') || ''); my $product = trim($cgi->param('product') || '');
if ($product eq '') { if ($product eq '') {
my $user = Bugzilla->login();
# If the user cannot enter bugs in any product, stop here. # If the user cannot enter bugs in any product, stop here.
my @enterable_products = @{$user->get_enterable_products}; my @enterable_products = @{$user->get_enterable_products};
ThrowUserError('no_products') unless scalar(@enterable_products); ThrowUserError('no_products') unless scalar(@enterable_products);
...@@ -293,8 +289,6 @@ sub pickos { ...@@ -293,8 +289,6 @@ sub pickos {
# End of subroutines # End of subroutines
############################################################################## ##############################################################################
Bugzilla->login(LOGIN_REQUIRED) if (!(AnyEntryGroups()));
# If a user is trying to clone a bug # If a user is trying to clone a bug
# Check that the user has authorization to view the parent bug # Check that the user has authorization to view the parent bug
# Create an instance of Bug that holds the info from the parent # Create an instance of Bug that holds the info from the parent
...@@ -302,7 +296,7 @@ $cloned_bug_id = $cgi->param('cloned_bug_id'); ...@@ -302,7 +296,7 @@ $cloned_bug_id = $cgi->param('cloned_bug_id');
if ($cloned_bug_id) { if ($cloned_bug_id) {
ValidateBugID($cloned_bug_id); ValidateBugID($cloned_bug_id);
$cloned_bug = new Bugzilla::Bug($cloned_bug_id, Bugzilla->user->id); $cloned_bug = new Bugzilla::Bug($cloned_bug_id, $user->id);
} }
# We need to check and make sure # We need to check and make sure
...@@ -310,7 +304,7 @@ if ($cloned_bug_id) { ...@@ -310,7 +304,7 @@ if ($cloned_bug_id) {
my $prod_obj = new Bugzilla::Product({name => $product}); my $prod_obj = new Bugzilla::Product({name => $product});
# Update the product name to get the correct case. # Update the product name to get the correct case.
$product = $prod_obj->name if defined $prod_obj; $product = $prod_obj->name if defined $prod_obj;
Bugzilla->user->can_enter_product($product, 1); $user->can_enter_product($product, 1);
GetVersionTable(); GetVersionTable();
......
...@@ -185,33 +185,6 @@ sub GetVersionTable { ...@@ -185,33 +185,6 @@ sub GetVersionTable {
$::VersionTableLoaded = 1; $::VersionTableLoaded = 1;
} }
#
# This function checks if there are any entry groups defined.
# If called with no arguments, it identifies
# entry groups for all products. If called with a product
# id argument, it checks for entry groups associated with
# one particular product.
sub AnyEntryGroups {
my $product_id = shift;
$product_id = 0 unless ($product_id);
return $::CachedAnyEntryGroups{$product_id}
if defined($::CachedAnyEntryGroups{$product_id});
my $dbh = Bugzilla->dbh;
PushGlobalSQLState();
my $query = "SELECT 1 FROM group_control_map WHERE entry != 0";
$query .= " AND product_id = $product_id" if ($product_id);
$query .= " " . $dbh->sql_limit(1);
SendSQL($query);
if (MoreSQLData()) {
$::CachedAnyEntryGroups{$product_id} = MoreSQLData();
FetchSQLData();
PopGlobalSQLState();
return $::CachedAnyEntryGroups{$product_id};
} else {
return undef;
}
}
#
# This function checks if there are any default groups defined. # This function checks if there are any default groups defined.
# If so, then groups may have to be changed when bugs move from # If so, then groups may have to be changed when bugs move from
# one bug to another. # one bug to another.
......
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