summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Series.pm
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2009-08-18 00:59:52 +0200
committerlpsolit%gmail.com <>2009-08-18 00:59:52 +0200
commit5f725ca6ee9edb009af450d79ab7a0f88c059e8d (patch)
tree935e4abc9069beba67fac581b0d263238530dd4f /Bugzilla/Series.pm
parentef1a85038621e7e13ff850e9b1c33b504ebcde35 (diff)
downloadbugzilla-5f725ca6ee9edb009af450d79ab7a0f88c059e8d.tar.gz
bugzilla-5f725ca6ee9edb009af450d79ab7a0f88c059e8d.tar.xz
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/Series.pm')
-rw-r--r--Bugzilla/Series.pm32
1 files changed, 14 insertions, 18 deletions
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;