Using this amazing thread I can now generate a list of user login dates on a Confluence page. My problem is that our user management is all via JIRA (we don't use Crowd) so what I actually need is for the macro to look at the JIRA login date. Can anyone advise me on how to amend the macro to retrieve this information rather than looking at Confluence log in dates?
Thank you!
Hello Alex,
The thread you linked is indeed an excellent question and example of how to create a user macro to display user logins along with other stats. To access Jira from Confluence you will have to communicate over the following: com.atlassian.jira.bc.security.login.LoginInfo
As I am not the author of the original script posted in the other thread, I will have to spend some time to figure out how to get that added. Here is the example script we are working with;
## @noparams
#set($containerManagerClass = $content.class.forName('com.atlassian.spring.container.ContainerManager'))
#set($getInstanceMethod = $containerManagerClass.getDeclaredMethod('getInstance',null))
#set($containerManager = $getInstanceMethod.invoke(null,null))
#set($containerContext = $containerManager.containerContext)
#set($loginManager = $containerContext.getComponent('loginManager'))
#set($users = $userAccessor.getUsers())
<table class="confluenceTable">
<tr>
<th class="confluenceTh">User</th>
<th class="confluenceTh">Last Successful Login Date</th>
<th class="confluenceTh">Active</th>
</tr>
#foreach($user in $users)
<tr>
<td class="confluenceTd">#usernameLink($user.name)</td>
<td class="confluenceTd">$action.dateFormatter.formatDateTime($loginManager.getLoginInfo($user).lastSuccessfulLoginDate)</td>
<td class="confluenceTd" style="text-align:center;">
#if($userAccessor.isDeactivated($user))
False
#else
True
#end
</td>
</tr>
#end
</table>
We can attempt to find a way to access this information, but we do not have an estimate time to have something deliverable. Meaning we will do best effort.
Regards,
Stephen Sifers
Hi Stephen, thank you very much for the reply.
You seem to have got the same results as I did in my testing, does this mean that this information is not exposed in a way that Confluence can access it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.