diff options
author | lpsolit%gmail.com <> | 2009-08-17 22:59:52 +0000 |
---|---|---|
committer | lpsolit%gmail.com <> | 2009-08-17 22:59:52 +0000 |
commit | 5f725ca6ee9edb009af450d79ab7a0f88c059e8d (patch) | |
tree | 935e4abc9069beba67fac581b0d263238530dd4f /Bugzilla | |
parent | ef1a85038621e7e13ff850e9b1c33b504ebcde35 (diff) | |
download | bugs-5f725ca6ee9edb009af450d79ab7a0f88c059e8d.tar bugs-5f725ca6ee9edb009af450d79ab7a0f88c059e8d.tar.gz bugs-5f725ca6ee9edb009af450d79ab7a0f88c059e8d.tar.bz2 bugs-5f725ca6ee9edb009af450d79ab7a0f88c059e8d.tar.xz bugs-5f725ca6ee9edb009af450d79ab7a0f88c059e8d.zip |
Bug 389396: Do not list series you cannot plot - Patch by Frédéric Buclin <LpSolit@gmail.com> r=dkl a=LpSolit
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/Chart.pm | 6 | ||||
-rw-r--r-- | Bugzilla/Series.pm | 32 |
2 files changed, 17 insertions, 21 deletions
diff --git a/Bugzilla/Chart.pm b/Bugzilla/Chart.pm index 1f232f310..58089d29e 100644 --- a/Bugzilla/Chart.pm +++ b/Bugzilla/Chart.pm @@ -396,10 +396,10 @@ sub getVisibleSeries { "LEFT JOIN category_group_map AS cgm " . " ON series.category = cgm.category_id " . " AND cgm.group_id NOT IN($grouplist) " . - "WHERE creator = " . Bugzilla->user->id . " OR " . - " cgm.category_id IS NULL " . + "WHERE creator = ? OR (is_public = 1 AND cgm.category_id IS NULL) " . $dbh->sql_group_by('series.series_id', 'cc1.name, cc2.name, ' . - 'series.name')); + 'series.name'), + undef, Bugzilla->user->id); foreach my $series (@$serieses) { my ($cat, $subcat, $name, $series_id) = @$series; $cats{$cat}{$subcat}{$name} = $series_id; diff --git a/Bugzilla/Series.pm b/Bugzilla/Series.pm index 1aaf287ce..fb1f38c18 100644 --- a/Bugzilla/Series.pm +++ b/Bugzilla/Series.pm @@ -79,34 +79,30 @@ sub new { } sub initFromDatabase { - my $self = shift; - my $series_id = shift; - + my ($self, $series_id) = @_; + my $dbh = Bugzilla->dbh; + my $user = Bugzilla->user; + detaint_natural($series_id) || ThrowCodeError("invalid_series_id", { 'series_id' => $series_id }); - - my $dbh = Bugzilla->dbh; + + my $grouplist = $user->groups_as_string; + my @series = $dbh->selectrow_array("SELECT series.series_id, cc1.name, " . "cc2.name, series.name, series.creator, series.frequency, " . "series.query, series.is_public " . "FROM series " . - "LEFT JOIN series_categories AS cc1 " . + "INNER JOIN series_categories AS cc1 " . " ON series.category = cc1.id " . - "LEFT JOIN series_categories AS cc2 " . + "INNER JOIN series_categories AS cc2 " . " ON series.subcategory = cc2.id " . "LEFT JOIN category_group_map AS cgm " . " ON series.category = cgm.category_id " . - "LEFT JOIN user_group_map AS ugm " . - " ON cgm.group_id = ugm.group_id " . - " AND ugm.user_id = " . Bugzilla->user->id . - " AND isbless = 0 " . - "WHERE series.series_id = $series_id AND " . - "(is_public = 1 OR creator = " . Bugzilla->user->id . " OR " . - "(ugm.group_id IS NOT NULL)) " . - $dbh->sql_group_by('series.series_id', 'cc1.name, cc2.name, ' . - 'series.name, series.creator, series.frequency, ' . - 'series.query, series.is_public')); - + " AND cgm.group_id NOT IN($grouplist) " . + "WHERE series.series_id = ? " . + " AND (creator = ? OR (is_public = 1 AND cgm.category_id IS NULL))", + undef, ($series_id, $user->id)); + if (@series) { $self->initFromParameters(@series); return $self; |