From d5c1c6f8c6ce9ae4a7c425a57d5e289c8aec84e7 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Tue, 28 Jul 2015 14:59:55 +0000 Subject: Bug 1163399: Autocompletion no longer works when impersonating a user r=LpSolit,a=simon --- Bugzilla/Token.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Bugzilla/Token.pm') diff --git a/Bugzilla/Token.pm b/Bugzilla/Token.pm index c43ba9f07..1f8e7bc17 100644 --- a/Bugzilla/Token.pm +++ b/Bugzilla/Token.pm @@ -37,8 +37,9 @@ use parent qw(Exporter); sub issue_api_token { # Generates a random token, adds it to the tokens table if one does not # already exist, and returns the token to the caller. - my $dbh = Bugzilla->dbh; - my $user = Bugzilla->user; + my $dbh = Bugzilla->dbh; + # Allow certain UI components to work if impersonating another user. + my $user = Bugzilla->sudoer || Bugzilla->user; my ($token) = $dbh->selectrow_array(" SELECT token FROM tokens WHERE userid = ? AND tokentype = 'api_token' -- cgit v1.2.3-24-g4f1b