How can a non-admin user tell who is the Space Admin for a Space to which the user does not have access?

This is related to https://answers.atlassian.com/questions/16292, but there have been no satisfactory answers there for 3 1/2 years.

We have spaces which are restricted.  They are NOT open to anonymous access, nor are they open to general groups like "confluence-users".  When a non-authorized user accesses a Space like that, they get "You are not permitted to perform this operation", which isn't very helpful.  Then they email me (the Confluence Admin), and i need to look up the Space owner and ask  if the user can have access, RO or RW.

That's a big waste of time, for the users and for me!

How can I create an auto-updating page/macro/etc that lists all Spaces and who the Space Admins are?  I know I could create it manually, but I'd like to avoid having that maintenance too, if possible.

2 answers

1 accepted

This widget could not be displayed.

Thanks to @Jonathan Simonoff for his suggestion.  That code was targeted at every page in a Space or the whole Site, and I just wanted a single page (accessible to ALL) that would list ALL Space Admins.  Using Jonathan's code and some more searching, I came up with this user macro which I instantiated on a globally-accessible page:

 

## @noparams
#set ($allSpaces = $spaceManager.getAllSpaces())
#foreach ($space in $allSpaces)
  #set($permissionCount = 0)
  #if($space.getSpaceType() == "global")
    <b><a href="$req.contextPath/display/$space.getKey()">$space.name</a>: </b>
    #foreach ($permission in $space.getPermissions())
      #if ($permission.getType() == "SETSPACEPERMISSIONS")
        #set($permissionCount = $permissionCount + 1)
        #if ($permissionCount == 1)
          #set($sepchar="")
        #else
          #set($sepchar=" / ")
        #end
        #if($permission.isGroupPermission())
            #set ( $memberList = $userAccessor.getMemberNamesAsList($userAccessor.getGroup($permission.getGroup())) )
            #foreach ($member in $memberList)
$!sepchar #usernameLink($member)
              #set($sepchar=" / ")
            #end
        #end
        #if ($permission.isUserPermission())
$!sepchar #usernameLink($permission.getUserName())
        #end 
      #end
    #end
    <br><br>
  #end
#end
This widget could not be displayed.

I added this to the bottom of the page layout, just before #GENERAL PAGE DECORATION ENDS.  This only works in spaces that use the default theme.

<p style='font-size:12px;color:gray'> Administrators for this space: 
 #set($sepchar="")
 #foreach ($permission in $space.getPermissions())
    #if ($permission.isUserPermission() && $permission.getType() == "SETSPACEPERMISSIONS")
$!sepchar #usernameLink($permission.getUserName())
        #set($sepchar=",")
    #end 
  #end
</p>

Sorry, newbie to wiki markup (but not HTML & CSS). Which menu sequence do I go thru to enter that?

Sorry -- that would need to be installed by an admin. Go to Layouts in the admin interface, and edit the page layout. You can do that on the individual space level or for the whole site, which is what we did. FYI -- that isn't wiki markup -- it is Velocity, the page layout language used in Confluence.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Monday in Confluence

Why start from scratch? Introducing four new templates for Confluence Cloud

Hi my Community friends!  For those who don't know me, I'm a product marketer on the Confluence Cloud team - nice to meet you! For those of you who do, you know that I've been all up in your Co...

370 views 2 6
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you