After we upgraded to version 7.19.7 the result of a user macro has changed, namely it now shows the user name instead of the full name.
The macro code is the following:
## Macro title: Space Administrators
## Macro has a body: N
## Body processing: Selected body processing option
## Output: Selected output option
##
## Developed by: Andrew Frayling
## Date created: 21/03/2012
## Installed by: <your name>
## Macro to display a list of user that are able to administer the current space.
## @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">Beheerders</th>
</tr>
#foreach ($permission in $space.getPermissions())
#if ($permission.isUserPermission() && $permission.getType() == "SETSPACEPERMISSIONS")
<tr>
<td class="confluenceTd">#usernameLink($permission.getUserName())</td>
</tr>
#end
#end
</table>
Where before the upgrade it would display 'Patrick Vanhoof' as a result of the macro, it now shows 'PVanhoof'.
Why?
Hey @Patrick Vanhoof ,
try to substitute the following row:
...
<td class="confluenceTd">#usernameLink($permission.getUserName())</td>
...
with :
...
<td class="confluenceTd">#usernameLink($permission.getUserSubject()
.getFullName() )</td>
...
Hope this helps,
Fabio
Thanks a lot!
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.
In this context I found the one which we are using which is slightly different. It also shows the groups and their members which are having access.
Now the macro editor shows the following:
"User Macro users-in-space may use context keys [ userAccessor ] which are not set in system property macro.required.velocity.context.keys. If the macro is not rendered as expected, try to manually add those keys into the system property."
This is the code for the group extension which is affected by the message above:
#if($paramShowGroups == true)
<h2>Gruppen ... </h2>
#if($paramListUsers == true)
#foreach ($permission in $space.getPermissions())
#if ($permission.isGroupPermission() && $permission.getType() == "SETSPACEPERMISSIONS")
#set ( $groupString = $permission.getGroup() )
#set ( $groupObject = $userAccessor.getGroup($groupString) )
#set ( $memberList = $userAccessor.getMemberNamesAsList($groupObject) )
<h3>$groupString</h3>
<table class="confluenceTable">
<tr>
<th class="confluenceTh">... mit Administratorrechten</th>
</tr>
#foreach ($member in $memberList)
<tr>
<td class="confluenceTd">#usernameLink($member)</td>
</tr>
#end
</table>
#end
#end
#foreach ($permission in $space.getPermissions())
#if ($permission.isGroupPermission() && $permission.getType() == "VIEWSPACE")
#set ( $groupString = $permission.getGroup() )
#set ( $groupObject = $userAccessor.getGroup($groupString) )
#set ( $memberList = $userAccessor.getMemberNamesAsList($groupObject) )
<h3>$groupString</h3>
<table class="confluenceTable">
<tr>
<th class="confluenceTh">... ohne Administratorrechte</th>
</tr>
#foreach ($member in $memberList)
<tr>
<td class="confluenceTd">#usernameLink($member)</td>
</tr>
#end
</table>
#end
#end
#else
#foreach ($permission in $space.getPermissions())
#if ($permission.isGroupPermission() && $permission.getType() == "SETSPACEPERMISSIONS")
#set ( $groupString = $permission.getGroup() )
#set ( $groupObject = $userAccessor.getGroup($groupString) )
<li>$groupString</li>
#end
#end
#foreach ($permission in $space.getPermissions())
#if ($permission.isGroupPermission() && $permission.getType() == "VIEWSPACE")
#set ( $groupString = $permission.getGroup() )
#set ( $groupObject = $userAccessor.getGroup($groupString) )
<li>$groupString</li>
#end
Now the question for me is, how to "manually add those keys into the system property."
Any help would be appreciated.
Thanks
Uli
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.
Oh btw. we got it fixed the way it was described above. Our system administrator added the missing velocity key into teh system properties and now it works fine again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.