Last active
August 29, 2015 14:00
-
-
Save dvdsmpsn/11226938 to your computer and use it in GitHub Desktop.
List Users - Confluence User Macro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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