Skip to content

Instantly share code, notes, and snippets.

@dvdsmpsn
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dvdsmpsn/11226938 to your computer and use it in GitHub Desktop.
Save dvdsmpsn/11226938 to your computer and use it in GitHub Desktop.
List Users - Confluence User Macro
## List Users - Confluence User Macro
##
## Produces a CSV of all members of the `confluence-users` group in Confluence
## Columns: user_key,username,display_name,email
##
## WARNING:
##
## Use very sparingly as this *will* slow down large Confluence instances.
## Yes, it will try to print out 100,000 users if you have that many in the system
##
## I generally remove this user macro after using once and add only when needed.
##
## @noparams
#set($containerManagerClass = $action.class.forName('com.atlassian.spring.container.ContainerManager'))
#set($getInstanceMethod = $containerManagerClass.getDeclaredMethod('getInstance',null))
#set($containerManager = $getInstanceMethod.invoke(null,null))
#set($containerContext = $containerManager.containerContext)
#set($userAccessor = $containerManager.containerContext.getComponent('userAccessor'))
#set($users = $userAccessor.getUsersWithConfluenceAccessAsList() )
<h2>Users</h2>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<div>
<pre>
<code>user_key,username,display_name,email
#foreach( $user in $users )
${user.key},${user.name},${user.fullName},${user.email}
#end
</code>
</pre>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment