Getting page permissions

Using Velocity, how does one get page permissions? I'm ultimately looking to develop an permission indicator system (using a series of icons) that will display if the user/group has permission to a space, set of pages (heirarchy), and/or a single page itself.

I've read how to get user permissions but this wouldn't solve the problem I'm facing such as the following:

#set ($pagePermission = $permissionHelper.canView($remoteUser, $action.page))

Thanks!

1 answer

1 accepted

So I believe I figured it out.

## get space-level permissions
#foreach ($permission in $space.getPermissions())
	#set($spacePermission = $spacePermission + "@@" + $permission) ## get permissions
#end

## get page-level permissions
#set ($groupPagePermissions = $<proprietaryHelper>.contentPermissionManager.getContentPermissionSets($page, "View"))

This code is added to the Page Layout and from there, I send off the $spacePermission and $groupPagePermissions to JavaScript and use the indexOf method to find groupName and users I'm looking for. Then, JavaScript displays the icons based on a few if/else statements.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

866 views 23 12
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