Commit 1f327cdf authored by Joshua Hoblitt's avatar Joshua Hoblitt

The per user apiToken property may not be defined

The approach to retrieving a "plain text" of the API token may be
completely broken by recent core changes but should still be working for
"legacy" api tokens.  However, this is enough to prevent userToMap()
from generating an exception.
parent 6ea2c611
......@@ -102,7 +102,7 @@ class Util {
def tokenProperty = user.getProperty(jenkins.security.ApiTokenProperty)
if (tokenProperty != null) {
conf['api_token_public'] = tokenProperty.getApiToken()
conf['api_token_plain'] = tokenProperty.@apiToken.getPlainText()
conf['api_token_plain'] = tokenProperty.@apiToken?.getPlainText()
}
def passwordProperty = user.getProperty(hudson.security.HudsonPrivateSecurityRealm.Details)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment