summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
Diffstat (limited to 'Bugzilla')
-rwxr-xr-xBugzilla/Bug.pm41
-rw-r--r--Bugzilla/Search.pm36
2 files changed, 38 insertions, 39 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 7e703d14f..3dadd3cd5 100755
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -37,8 +37,8 @@ use Bugzilla::Util;
for my $key (qw (bug_id alias product version rep_platform op_sys bug_status
resolution priority bug_severity component assigned_to
reporter bug_file_loc short_desc target_milestone
- qa_contact status_whiteboard creation_ts groupset
- delta_ts votes whoid usergroupset comment query error) ){
+ qa_contact status_whiteboard creation_ts
+ delta_ts votes whoid comment query error) ){
$ok_field{$key}++;
}
@@ -105,10 +105,6 @@ sub initBug {
$self->{'whoid'} = $user_id;
- &::SendSQL("SELECT groupset FROM profiles WHERE userid=$self->{'whoid'}");
- my $usergroupset = &::FetchOneColumn();
- if (!$usergroupset) { $usergroupset = '0' }
- $self->{'usergroupset'} = $usergroupset;
my $query = "
select
@@ -116,7 +112,7 @@ sub initBug {
resolution, priority, bug_severity, components.name, assigned_to, reporter,
bug_file_loc, short_desc, target_milestone, qa_contact,
status_whiteboard, date_format(creation_ts,'%Y-%m-%d %H:%i'),
- groupset, delta_ts, sum(votes.count)
+ delta_ts, sum(votes.count)
from bugs left join votes using(bug_id),
products, components
where bugs.bug_id = $bug_id
@@ -124,10 +120,10 @@ sub initBug {
AND components.id = bugs.component_id
group by bugs.bug_id";
- &::SendSQL(&::SelectVisible($query, $user_id, $usergroupset));
- my @row;
+ &::SendSQL($query);
+ my @row = ();
- if (@row = &::FetchSQLData()) {
+ if ((@row = &::FetchSQLData()) && &::CanSeeBug($bug_id, $self->{'whoid'})) {
my $count = 0;
my %fields;
foreach my $field ("bug_id", "alias", "product", "version", "rep_platform",
@@ -135,24 +131,21 @@ sub initBug {
"bug_severity", "component", "assigned_to", "reporter",
"bug_file_loc", "short_desc", "target_milestone",
"qa_contact", "status_whiteboard", "creation_ts",
- "groupset", "delta_ts", "votes") {
+ "delta_ts", "votes") {
$fields{$field} = shift @row;
if ($fields{$field}) {
$self->{$field} = $fields{$field};
}
$count++;
}
- } else {
- &::SendSQL("select groupset from bugs where bug_id = $bug_id");
- if (@row = &::FetchSQLData()) {
+ } elsif (@row) {
$self->{'bug_id'} = $bug_id;
$self->{'error'} = "NotPermitted";
return $self;
- } else {
+ } else {
$self->{'bug_id'} = $bug_id;
$self->{'error'} = "NotFound";
return $self;
- }
}
$self->{'assigned_to'} = &::DBID_to_name($self->{'assigned_to'});
@@ -356,22 +349,6 @@ sub XML_Footer {
return ("</bugzilla>\n");
}
-sub UserInGroup {
- my $self = shift();
- my ($groupname) = (@_);
- if ($self->{'usergroupset'} eq "0") {
- return 0;
- }
- &::ConnectToDatabase();
- &::SendSQL("select (bit & $self->{'usergroupset'}) != 0 from groups where name = "
- . &::SqlQuote($groupname));
- my $bit = &::FetchOneColumn();
- if ($bit) {
- return 1;
- }
- return 0;
-}
-
sub CanChangeField {
my $self = shift();
my ($f, $oldvalue, $newvalue) = (@_);
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm
index 482daca5c..d6e7a9b7f 100644
--- a/Bugzilla/Search.pm
+++ b/Bugzilla/Search.pm
@@ -29,7 +29,7 @@ use strict;
# The caller MUST require CGI.pl and globals.pl before using this
-use vars qw($userid $usergroupset);
+use vars qw($userid);
package Bugzilla::Search;
@@ -117,7 +117,7 @@ sub init {
my @legal_fields = ("product", "version", "rep_platform", "op_sys",
"bug_status", "resolution", "priority", "bug_severity",
"assigned_to", "reporter", "component",
- "target_milestone", "groupset");
+ "target_milestone", "bug_group");
foreach my $field (keys %F) {
if (lsearch(\@legal_fields, $field) != -1) {
@@ -322,6 +322,12 @@ sub init {
push(@wherepart, "$table.bug_id = bugs.bug_id");
$f = "$table.thetext";
},
+ "^bug_group,(?!changed)" => sub {
+ push(@supptables, "LEFT JOIN bug_group_map bug_group_map_$chartid ON bugs.bug_id = bug_group_map_$chartid.bug_id");
+
+ push(@supptables, "LEFT JOIN groups groups_$chartid ON groups_$chartid.id = bug_group_map_$chartid.group_id");
+ $f = "groups_$chartid.name";
+ },
"^attachments\..*," => sub {
my $table = "attachments_$chartid";
push(@supptables, "attachments $table");
@@ -747,7 +753,7 @@ sub init {
# chart -1 is generated by other code above, not from the user-
# submitted form, so we'll blindly accept any values in chart -1
if ((!$chartfields{$f}) && ($chart != -1)) {
- my $errstr = "Can't use " . html_quote($f) . " as a field name. " .
+ my $errstr = "Can't use $f as a field name. " .
"If you think you're getting this in error, please copy the " .
"entire URL out of the address bar at the top of your browser " .
"window and email it to <109679\@bugzilla.org>";
@@ -807,11 +813,27 @@ sub init {
$suppseen{$str} = 1;
}
}
- my $query = ("SELECT DISTINCT " . join(', ', @fields) .
+ my $query = ("SELECT DISTINCT " .
+ join(', ', @fields) .
+ ", COUNT(DISTINCT ugmap.group_id) AS cntuseringroups, " .
+ " COUNT(DISTINCT bgmap.group_id) AS cntbugingroups, " .
+ " ((COUNT(DISTINCT ccmap.who) AND cclist_accessible) " .
+ " OR ((bugs.reporter = $::userid) AND bugs.reporter_accessible) " .
+ " OR bugs.assigned_to = $::userid ) AS canseeanyway " .
" FROM $suppstring" .
- " WHERE " . join(' AND ', (@wherepart, @andlist)));
-
- $query = &::SelectVisible($query, $::userid, $::usergroupset);
+ " LEFT JOIN bug_group_map AS bgmap " .
+ " ON bgmap.bug_id = bugs.bug_id " .
+ " LEFT JOIN user_group_map AS ugmap " .
+ " ON bgmap.group_id = ugmap.group_id " .
+ " AND ugmap.user_id = $::userid " .
+ " AND ugmap.isbless = 0" .
+ " LEFT JOIN cc AS ccmap " .
+ " ON ccmap.who = $::userid AND ccmap.bug_id = bugs.bug_id " .
+ " WHERE " . join(' AND ', (@wherepart, @andlist)) .
+ " GROUP BY bugs.bug_id " .
+ " HAVING cntuseringroups = cntbugingroups" .
+ " OR canseeanyway"
+ );
if ($debug) {
print "<p><code>" . value_quote($query) . "</code></p>\n";