Forums

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

Login dates macro for JIRA login date but on Confluence page

Alex Fox
Contributor
December 11, 2018

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!

1 answer

0 votes
Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 21, 2018

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>

 image.png

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

Alex Fox
Contributor
January 2, 2019

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?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events