Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Getting current user for a ScriptRunner scripted macro (Confluence)

Joshua DeClerck
Contributor
April 19, 2018

If possible, how does one get the logged-in user for use in a scripted macro in Confluence?

This is specifically a ScriptRunner for Confluence scripted macro, not a native Confluence custom macro.

1 answer

1 accepted

3 votes
Answer accepted
Joshua DeClerck
Contributor
April 20, 2018

Oops, discovered it on my own by digging into the baked-in Locked Content Macro's code. For anyone else looking for this, I found:

import com.atlassian.confluence.user.AuthenticatedUserThreadLocal

currentUser = AuthenticatedUserThreadLocal.get()

Which returns as a ConfluenceUser.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events