aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2011-08-17 00:45:22 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2011-08-17 00:45:22 +0200
commite15dcf488f8bbf1fef2cd0a7001385f7a95e8d59 (patch)
tree4a46e8d94f53faf98923ca7509704f5e1fdec541
parent7a8598938d6976acb5f6bde6c86be8b65d1df8da (diff)
downloadbugs-e15dcf488f8bbf1fef2cd0a7001385f7a95e8d59.tar
bugs-e15dcf488f8bbf1fef2cd0a7001385f7a95e8d59.tar.gz
bugs-e15dcf488f8bbf1fef2cd0a7001385f7a95e8d59.tar.bz2
bugs-e15dcf488f8bbf1fef2cd0a7001385f7a95e8d59.tar.xz
bugs-e15dcf488f8bbf1fef2cd0a7001385f7a95e8d59.zip
Bug 678970: Use $user and $cgi instead of Bugzilla->user and Bugzilla->cgi
r=timello a=LpSolit
-rw-r--r--Bugzilla/WebService/Bug.pm16
-rwxr-xr-xbuglist.cgi16
-rwxr-xr-xcolchange.cgi8
-rwxr-xr-xconfig.cgi2
-rwxr-xr-xcreateaccount.cgi4
-rwxr-xr-xdescribekeywords.cgi6
-rwxr-xr-xeditclassifications.cgi4
-rwxr-xr-xeditvalues.cgi10
-rwxr-xr-xeditwhines.cgi2
-rwxr-xr-xenter_bug.cgi2
-rwxr-xr-xprocess_bug.cgi6
-rwxr-xr-xquery.cgi4
-rwxr-xr-xsanitycheck.cgi2
-rwxr-xr-xshow_bug.cgi4
-rwxr-xr-xshowdependencygraph.cgi4
-rwxr-xr-xsummarize_time.cgi3
-rwxr-xr-xuserprefs.cgi7
17 files changed, 49 insertions, 51 deletions
diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm
index 9064f6a14..7844b4e97 100644
--- a/Bugzilla/WebService/Bug.pm
+++ b/Bugzilla/WebService/Bug.pm
@@ -670,10 +670,10 @@ sub add_attachment {
sub add_comment {
my ($self, $params) = @_;
-
- #The user must login in order add a comment
- Bugzilla->login(LOGIN_REQUIRED);
-
+
+ # The user must login in order add a comment
+ my $user = Bugzilla->login(LOGIN_REQUIRED);
+
# Check parameters
defined $params->{id}
|| ThrowCodeError('param_required', { param => 'id' });
@@ -682,8 +682,8 @@ sub add_comment {
|| ThrowCodeError('param_required', { param => 'comment' });
my $bug = Bugzilla::Bug->check($params->{id});
-
- Bugzilla->user->can_edit_product($bug->product_id)
+
+ $user->can_edit_product($bug->product_id)
|| ThrowUserError("product_edit_denied", {product => $bug->product});
# Backwards-compatibility for versions before 3.6
@@ -707,8 +707,8 @@ sub add_comment {
$dbh->bz_commit_transaction();
# Send mail.
- Bugzilla::BugMail::Send($bug->bug_id, { changer => Bugzilla->user });
-
+ Bugzilla::BugMail::Send($bug->bug_id, { changer => $user });
+
return { id => $self->type('int', $new_comment_id) };
}
diff --git a/buglist.cgi b/buglist.cgi
index 7549063a4..0797aa389 100755
--- a/buglist.cgi
+++ b/buglist.cgi
@@ -389,7 +389,7 @@ if ($cmdtype eq "dorem") {
# so that it can be modified easily.
$vars->{'searchname'} = $cgi->param('namedcmd');
if (!$cgi->param('sharer_id') ||
- $cgi->param('sharer_id') == Bugzilla->user->id) {
+ $cgi->param('sharer_id') == $user->id) {
$vars->{'searchtype'} = "saved";
$vars->{'search_id'} = $query_id;
}
@@ -590,7 +590,7 @@ else {
# Remove the timetracking columns if they are not a part of the group
# (happens if a user had access to time tracking and it was revoked/disabled)
-if (!Bugzilla->user->is_timetracker) {
+if (!$user->is_timetracker) {
@displaycolumns = grep($_ ne 'estimated_time', @displaycolumns);
@displaycolumns = grep($_ ne 'remaining_time', @displaycolumns);
@displaycolumns = grep($_ ne 'actual_time', @displaycolumns);
@@ -793,7 +793,7 @@ if ($cgi->param('debug')) {
# out how many hidden bugs are in a particular product (by doing
# searches and looking at the number of rows the explain says it's
# examining).
- if (Bugzilla->user->in_group('admin')) {
+ if ($user->in_group('admin')) {
$vars->{'query_explain'} = $dbh->bz_explain($query);
}
}
@@ -984,10 +984,10 @@ $vars->{'order'} = $order;
$vars->{'caneditbugs'} = 1;
$vars->{'time_info'} = $time_info;
-if (!Bugzilla->user->in_group('editbugs')) {
+if (!$user->in_group('editbugs')) {
foreach my $product (keys %$bugproducts) {
my $prod = new Bugzilla::Product({name => $product});
- if (!Bugzilla->user->in_group('editbugs', $prod->id)) {
+ if (!$user->in_group('editbugs', $prod->id)) {
$vars->{'caneditbugs'} = 0;
last;
}
@@ -995,7 +995,7 @@ if (!Bugzilla->user->in_group('editbugs')) {
}
my @bugowners = keys %$bugowners;
-if (scalar(@bugowners) > 1 && Bugzilla->user->in_group('editbugs')) {
+if (scalar(@bugowners) > 1 && $user->in_group('editbugs')) {
my $suffix = Bugzilla->params->{'emailsuffix'};
map(s/$/$suffix/, @bugowners) if $suffix;
my $bugowners = join(",", @bugowners);
@@ -1024,7 +1024,7 @@ elsif (my @product_input = $cgi->param('product')) {
}
# We only want the template to use it if the user can actually
# enter bugs against it.
-if ($one_product && Bugzilla->user->can_enter_product($one_product)) {
+if ($one_product && $user->can_enter_product($one_product)) {
$vars->{'one_product'} = $one_product;
}
@@ -1043,7 +1043,7 @@ if ($dotweak && scalar @bugs) {
$vars->{'token'} = issue_session_token('buglist_mass_change');
Bugzilla->switch_to_shadow_db();
- $vars->{'products'} = Bugzilla->user->get_enterable_products;
+ $vars->{'products'} = $user->get_enterable_products;
$vars->{'platforms'} = get_legal_field_values('rep_platform');
$vars->{'op_sys'} = get_legal_field_values('op_sys');
$vars->{'priorities'} = get_legal_field_values('priority');
diff --git a/colchange.cgi b/colchange.cgi
index 844f7615c..c3741f623 100755
--- a/colchange.cgi
+++ b/colchange.cgi
@@ -53,7 +53,7 @@ use constant COLUMN_CLASSES => {
'Bugzilla::Keyword' => 'keywords',
};
-Bugzilla->login();
+my $user = Bugzilla->login();
my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
@@ -77,7 +77,7 @@ foreach my $class (keys %{ COLUMN_CLASSES() }) {
delete $columns->{$column} if !$class->any_exist;
}
-if (!Bugzilla->user->is_timetracker) {
+if (!$user->is_timetracker) {
foreach my $column (TIMETRACKING_FIELDS) {
delete $columns->{$column};
}
@@ -138,7 +138,7 @@ if (defined $cgi->param('rememberedquery')) {
$vars->{'message'} = "change_columns";
if ($cgi->param('save_columns_for_search')
- && defined $search && $search->user->id == Bugzilla->user->id)
+ && defined $search && $search->user->id == $user->id)
{
my $params = new Bugzilla::CGI($search->url);
$params->param('columnlist', join(",", @collist));
@@ -188,7 +188,7 @@ $vars->{'buffer'} = $cgi->query_string();
my $search;
if (defined $cgi->param('query_based_on')) {
- my $searches = Bugzilla->user->queries;
+ my $searches = $user->queries;
my ($search) = grep($_->name eq $cgi->param('query_based_on'), @$searches);
if ($search) {
diff --git a/config.cgi b/config.cgi
index 2c82fdc59..f83ffcdf3 100755
--- a/config.cgi
+++ b/config.cgi
@@ -107,7 +107,7 @@ $vars->{'closed_status'} = \@closed_status;
# Generate a list of fields that can be queried.
my @fields = @{Bugzilla::Field->match({obsolete => 0})};
# Exclude fields the user cannot query.
-if (!Bugzilla->user->is_timetracker) {
+if (!$user->is_timetracker) {
@fields = grep { $_->name !~ /^(estimated_time|remaining_time|work_time|percentage_complete|deadline)$/ } @fields;
}
$vars->{'field'} = \@fields;
diff --git a/createaccount.cgi b/createaccount.cgi
index db0727add..d0437a021 100755
--- a/createaccount.cgi
+++ b/createaccount.cgi
@@ -38,7 +38,7 @@ use Bugzilla::Util;
# Just in case someone already has an account, let them get the correct footer
# on an error message. The user is logged out just after the account is
# actually created.
-Bugzilla->login(LOGIN_OPTIONAL);
+my $user = Bugzilla->login(LOGIN_OPTIONAL);
my $dbh = Bugzilla->dbh;
my $cgi = Bugzilla->cgi;
@@ -50,7 +50,7 @@ $vars->{'doc_section'} = 'myaccount.html';
print $cgi->header();
# If we're using LDAP for login, then we can't create a new account here.
-unless (Bugzilla->user->authorizer->user_can_create_account) {
+unless ($user->authorizer->user_can_create_account) {
ThrowUserError("auth_cant_create_account");
}
diff --git a/describekeywords.cgi b/describekeywords.cgi
index 9796b77d5..ffe14032f 100755
--- a/describekeywords.cgi
+++ b/describekeywords.cgi
@@ -29,7 +29,7 @@ use Bugzilla::Error;
use Bugzilla::User;
use Bugzilla::Keyword;
-Bugzilla->login();
+my $user = Bugzilla->login();
my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
@@ -39,8 +39,8 @@ my $vars = {};
Bugzilla->switch_to_shadow_db;
$vars->{'keywords'} = Bugzilla::Keyword->get_all_with_bug_count();
-$vars->{'caneditkeywords'} = Bugzilla->user->in_group("editkeywords");
+$vars->{'caneditkeywords'} = $user->in_group("editkeywords");
-print Bugzilla->cgi->header();
+print $cgi->header();
$template->process("reports/keywords.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
diff --git a/editclassifications.cgi b/editclassifications.cgi
index db9dd7f0a..6eb3cb910 100755
--- a/editclassifications.cgi
+++ b/editclassifications.cgi
@@ -58,11 +58,11 @@ sub LoadTemplate {
# Preliminary checks:
#
-Bugzilla->login(LOGIN_REQUIRED);
+my $user = Bugzilla->login(LOGIN_REQUIRED);
print $cgi->header();
-Bugzilla->user->in_group('editclassifications')
+$user->in_group('editclassifications')
|| ThrowUserError("auth_failure", {group => "editclassifications",
action => "edit",
object => "classifications"});
diff --git a/editvalues.cgi b/editvalues.cgi
index 53ea78512..1a8d89531 100755
--- a/editvalues.cgi
+++ b/editvalues.cgi
@@ -47,7 +47,7 @@ sub display_field_values {
######################################################################
# require the user to have logged in
-Bugzilla->login(LOGIN_REQUIRED);
+my $user = Bugzilla->login(LOGIN_REQUIRED);
my $dbh = Bugzilla->dbh;
my $cgi = Bugzilla->cgi;
@@ -60,10 +60,10 @@ $vars->{'doc_section'} = 'edit-values.html';
print $cgi->header();
-Bugzilla->user->in_group('admin') ||
- ThrowUserError('auth_failure', {group => "admin",
- action => "edit",
- object => "field_values"});
+$user->in_group('admin')
+ || ThrowUserError('auth_failure', {group => "admin",
+ action => "edit",
+ object => "field_values"});
#
# often-used variables
diff --git a/editwhines.cgi b/editwhines.cgi
index 04e2b548f..5d388cd0f 100755
--- a/editwhines.cgi
+++ b/editwhines.cgi
@@ -82,7 +82,7 @@ $user->in_group('bz_canusewhines')
object => "reports"});
# May this user send mail to other users?
-my $can_mail_others = Bugzilla->user->in_group('bz_canusewhineatothers');
+my $can_mail_others = $user->in_group('bz_canusewhineatothers');
# If the form was submitted, we need to look for what needs to be added or
# removed, then what was altered.
diff --git a/enter_bug.cgi b/enter_bug.cgi
index fc02aa86e..497209df4 100755
--- a/enter_bug.cgi
+++ b/enter_bug.cgi
@@ -267,7 +267,7 @@ if ($cloned_bug_id) {
$vars->{'comment'} = "";
$vars->{'comment_is_private'} = 0;
- if (!$isprivate || Bugzilla->user->is_insider) {
+ if (!$isprivate || $user->is_insider) {
# We use "body" to avoid any format_comment text, which would be
# pointless to clone.
$vars->{'comment'} = $bug_desc->body;
diff --git a/process_bug.cgi b/process_bug.cgi
index 382ee8b59..9ba03e277 100755
--- a/process_bug.cgi
+++ b/process_bug.cgi
@@ -216,7 +216,7 @@ else {
# For each bug, we have to check if the user can edit the bug the product
# is currently in, before we allow them to change anything.
foreach my $bug (@bug_objects) {
- if (!Bugzilla->user->can_edit_product($bug->product_obj->id) ) {
+ if (!$user->can_edit_product($bug->product_obj->id)) {
ThrowUserError("product_edit_denied",
{ product => $bug->product });
}
@@ -301,7 +301,7 @@ if (defined $cgi->param('newcc')
}
} else {
@cc_add = $cgi->param('newcc');
- push(@cc_add, Bugzilla->user) if $cgi->param('addselfcc');
+ push(@cc_add, $user) if $cgi->param('addselfcc');
# We came from show_bug which uses a select box to determine what cc's
# need to be removed...
@@ -378,7 +378,7 @@ foreach my $bug (@bug_objects) {
# status, so we should inform the user about that.
if (!is_open_state($new_status) && $changes->{'remaining_time'}) {
$vars->{'message'} = "remaining_time_zeroed"
- if Bugzilla->user->is_timetracker;
+ if $user->is_timetracker;
}
}
diff --git a/query.cgi b/query.cgi
index 0182f66eb..686d9db36 100755
--- a/query.cgi
+++ b/query.cgi
@@ -202,7 +202,7 @@ foreach my $val (editable_bug_fields()) {
push @chfields, $val;
}
-if (Bugzilla->user->is_timetracker) {
+if ($user->is_timetracker) {
push @chfields, "work_time";
} else {
@chfields = grep($_ ne "estimated_time", @chfields);
@@ -221,7 +221,7 @@ $vars->{'resolution'} = Bugzilla::Field->new({name => 'resolution'})->legal_valu
my @fields = @{ Bugzilla->fields({ obsolete => 0 }) };
# If we're not in the time-tracking group, exclude time-tracking fields.
-if (!Bugzilla->user->is_timetracker) {
+if (!$user->is_timetracker) {
foreach my $tt_field (TIMETRACKING_FIELDS) {
@fields = grep($_->name ne $tt_field, @fields);
}
diff --git a/sanitycheck.cgi b/sanitycheck.cgi
index 7d530ea4b..da308aaeb 100755
--- a/sanitycheck.cgi
+++ b/sanitycheck.cgi
@@ -258,7 +258,7 @@ if ($cgi->param('rescanallBugMail')) {
# and so choosing this user as being the last one having done a change
# for the bug may be problematic. So the best we can do at this point
# is to choose the currently logged in user for email notification.
- $vars->{'changer'} = Bugzilla->user;
+ $vars->{'changer'} = $user;
foreach my $bugid (@$list) {
Bugzilla::BugMail::Send($bugid, $vars);
diff --git a/show_bug.cgi b/show_bug.cgi
index 7ea55e732..f38764b21 100755
--- a/show_bug.cgi
+++ b/show_bug.cgi
@@ -43,7 +43,7 @@ my $single = !$cgi->param('format')
# If we don't have an ID, _AND_ we're only doing a single bug, then prompt
if (!$cgi->param('id') && $single) {
- print Bugzilla->cgi->header();
+ print $cgi->header();
$template->process("bug/choose.html.tmpl", $vars) ||
ThrowTemplateError($template->error());
exit;
@@ -111,7 +111,7 @@ if ($cgi->param("field")) {
@fieldlist = $cgi->param("field");
}
-unless (Bugzilla->user->is_timetracker) {
+unless ($user->is_timetracker) {
@fieldlist = grep($_ !~ /(^deadline|_time)$/, @fieldlist);
}
diff --git a/showdependencygraph.cgi b/showdependencygraph.cgi
index 0726760b9..676a3462f 100755
--- a/showdependencygraph.cgi
+++ b/showdependencygraph.cgi
@@ -35,7 +35,7 @@ use Bugzilla::Error;
use Bugzilla::Bug;
use Bugzilla::Status;
-Bugzilla->login();
+my $user = Bugzilla->login();
my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
@@ -189,7 +189,7 @@ foreach my $k (keys(%seen)) {
my ($stat, $resolution, $summary) = $dbh->selectrow_array($sth, undef, $k);
# Resolution and summary are shown only if user can see the bug
- if (!Bugzilla->user->can_see_bug($k)) {
+ if (!$user->can_see_bug($k)) {
$resolution = $summary = '';
}
diff --git a/summarize_time.cgi b/summarize_time.cgi
index dd8ba741b..c7c7bebec 100755
--- a/summarize_time.cgi
+++ b/summarize_time.cgi
@@ -250,10 +250,9 @@ sub get_earliest_activity_date {
# Template code starts here
#
-Bugzilla->login(LOGIN_REQUIRED);
+my $user = Bugzilla->login(LOGIN_REQUIRED);
my $cgi = Bugzilla->cgi;
-my $user = Bugzilla->user;
my $template = Bugzilla->template;
my $vars = {};
diff --git a/userprefs.cgi b/userprefs.cgi
index f411326a2..485ceb54f 100755
--- a/userprefs.cgi
+++ b/userprefs.cgi
@@ -51,8 +51,7 @@ sub DoAccount {
($vars->{'realname'}) = $dbh->selectrow_array(
"SELECT realname FROM profiles WHERE userid = ?", undef, $user->id);
- if(Bugzilla->params->{'allowemailchange'}
- && Bugzilla->user->authorizer->can_change_email) {
+ if (Bugzilla->params->{'allowemailchange'} && $user->authorizer->can_change_email) {
# First delete old tokens.
Bugzilla::Token::CleanTokenTable();
@@ -493,9 +492,9 @@ $cgi->delete('Bugzilla_login', 'Bugzilla_password') if ($cgi->cookie('sudo'));
$cgi->delete('GoAheadAndLogIn');
# First try to get credentials from cookies.
-Bugzilla->login(LOGIN_OPTIONAL);
+my $user = Bugzilla->login(LOGIN_OPTIONAL);
-if (!Bugzilla->user->id) {
+if (!$user->id) {
# Use credentials given in the form if login cookies are not available.
$cgi->param('Bugzilla_login', $cgi->param('old_login'));
$cgi->param('Bugzilla_password', $cgi->param('old_password'));