Hi all,
One of our services is running JIRA + confluence with crowd as authentication backend.
As part of the user management tools, we wrote a confluence macro to help us keeping track of users last login, account activity etc...
The problem is that the code we use seems not to get the Last Login Date called "lastAuthenticated" from crowd (apparently not a standard attribute). But we can get the standard attributes such as the username.
Following works and returns the name:
$crowdService.getUserWithAttributes($user.name).getDisplayName()
Following doesn't work, nothing is returned (even asking a list of available keys returns nothing)
$crowdService.getUserWithAttributes($user.name).getValue("lastAuthenticated")
Our macro is following:
## @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($crowdService = $containerContext.getComponent('crowdService'))
#set($groups = $userAccessor.getGroupsAsList())
<table class="confluenceTable" width="660px">
<tr>
<th class="confluenceTh">Group</th>
<th class="confluenceTh">Name</th>
<th class="confluenceTh">Email</th>
<th class="confluenceTh">Last Login</th>
</tr>
#foreach ($group in $groups)
#set($usernames = $userAccessor.getMemberNames($group))
#foreach($username in $usernames)
#set($user = $userAccessor.getUser($username))
#set($lastLogin = $crowdService.getUserWithAttributes($username).getValue("lastAuthenticated"))
<tr>
<td class="confluenceTd">$group.Name</td>
<td class="confluenceTd">#usernameLink($user.name)</td>
<td class="confluenceTd">$user.email</td>
<td class="confluenceTd">$lastLogin</td>
</tr>
#end
#end
</table>
We did ask Atlassian support but were told that development/API queries is beyond their technical expertise... And that we should ask the developers community.
Is there someone here that has any idea about this issue?
Any suggestion is welcome, thank you 