$helper.action.remoteUser.name doesn't return value

Franz Güntner March 8, 2018

Hi there,

I want to show a certain code for a certain group of users. If've found this:

#if ($userAccessor.hasMembership('confluence-administrators', $helper.action.remoteUser.name)
WORKS
#end

It works, but only if I replace the ..remoteUser.. with a real Username. It seems that $helper.action.remoteUser.name does not return any value.

To be sure, I tried this:

$userAccessor.getGroupNamesForUserName($helper.action.remoteUser.name)
$userAccessor.getGroupNamesForUserName('realUsername')

Second works, first not. Does anyone of you have an idea why? I am running Confluence 6.5.2

 

Thanks,

Franz

 

1 answer

1 vote
Stephen Deutsch
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 9, 2018

It's likely that $helper.action.remoteUser either doesn't exist or returns the string name, therefore if you try to run .name on a string it will return null, as it's not a ConfluenceUser object.

Since you can use a string for this function call, I would recommend using $req.remoteUser instead.

Franz Güntner March 12, 2018

Thanks! I've found out that $action.remoteUser.Name also works!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events