From: David Lawrence Date: Tue, 28 Jul 2015 14:59:55 +0000 (+0000) Subject: Bug 1163399: Autocompletion no longer works when impersonating a user X-Git-Tag: release-5.1.1~223 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d5c1c6f8c6ce9ae4a7c425a57d5e289c8aec84e7;p=thirdparty%2Fbugzilla.git Bug 1163399: Autocompletion no longer works when impersonating a user r=LpSolit,a=simon --- diff --git a/Bugzilla/Token.pm b/Bugzilla/Token.pm index c43ba9f075..1f8e7bc172 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'