]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1163399: Autocompletion no longer works when impersonating a user
authorDavid Lawrence <dkl@mozilla.com>
Tue, 28 Jul 2015 14:59:55 +0000 (14:59 +0000)
committerDavid Lawrence <dkl@mozilla.com>
Tue, 28 Jul 2015 14:59:55 +0000 (14:59 +0000)
r=LpSolit,a=simon

Bugzilla/Token.pm

index c43ba9f0757680c6dee7641befa57183381c4c5a..1f8e7bc1721bce7b160e016a6ed674c39005959e 100644 (file)
@@ -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'