From b001c2915072a89b1134e1f4033cb0bfb94c4498 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Tue, 5 Sep 2006 20:04:52 +0000 Subject: Bug 274187: request.cgi should use the shadow database - Patch by Frédéric Buclin r=mkanat a=myk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- request.cgi | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/request.cgi b/request.cgi index 0ee7ec955..4b2adb6b5 100755 --- a/request.cgi +++ b/request.cgi @@ -41,10 +41,7 @@ use Bugzilla::Component; # Make sure the user is logged in. my $user = Bugzilla->login(); - my $cgi = Bugzilla->cgi; -local our $vars = {}; - ################################################################################ # Main Body Execution @@ -71,10 +68,12 @@ exit; sub queue { my $cgi = Bugzilla->cgi; + # There are some user privilege checks to do. We do them against the main DB. my $dbh = Bugzilla->dbh; my $template = Bugzilla->template; my $user = Bugzilla->user; my $userid = $user->id; + my $vars = {}; my $status = validateStatus($cgi->param('status')); my $form_group = validateGroup($cgi->param('group')); @@ -140,8 +139,10 @@ sub queue { $query .= " AND flags.status = '?' " unless $status; # The set of criteria by which we filter records to display in the queue. + # We now move to the shadow DB to query the DB. my @criteria = (); - + $dbh = Bugzilla->switch_to_shadow_db; + # A list of columns to exclude from the report because the report conditions # limit the data being displayed to exact matches for those columns. # In other words, if we are only displaying "pending" , we don't @@ -278,7 +279,10 @@ sub queue { my $flagtypes = $dbh->selectcol_arrayref( "SELECT DISTINCT(name) FROM flagtypes ORDER BY name"); push(@types, @$flagtypes); - + + # We move back to the main DB to get the list of products the user can see. + $dbh = Bugzilla->switch_to_main_db; + $vars->{'products'} = $user->get_selectable_products; $vars->{'excluded_columns'} = \@excluded_columns; $vars->{'group_field'} = $form_group; @@ -286,7 +290,7 @@ sub queue { $vars->{'types'} = \@types; # Return the appropriate HTTP response headers. - print Bugzilla->cgi->header(); + print $cgi->header(); # Generate and return the UI (HTML page) from the appropriate template. $template->process("request/queue.html.tmpl", $vars) -- cgit v1.2.3-24-g4f1b