Overview
There are two types of permissions at the Space level in Confluence: Space permissions, and Page permissions.
Page permissions are much simpler than Space permissions, for the simple reason that there are only TWO types of Page permission: VIEW and EDIT.
Getting Permissions From a Page
Simply retrieving the permissions of a Page is pretty simple. As you can see in the code below, you need only fill in a view variables: the page ID, and the type of Permission you’d like review.
import com.atlassian.confluence.pages.PageManager
import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.confluence.pages.PageManager
import com.atlassian.confluence.security.ContentPermission
import com.atlassian.confluence.user.UserAccessor
def userAccessor = ComponentLocator.getComponent(UserAccessor)
def pageManager = ComponentLocator.getComponent(PageManager)
//Define the user accessor and the page manager
def currentPage = pageManager.getPage(83591282)
//Use the page manager to get a specific page
def editPermissions = currentPage.getContentPermissionSet(ContentPermission.VIEW_PERMISSION)
//Define the type of permissions to be returned
editPermissions.getUserKeys().each{names ->
//For each person with the type of permissions
log.warn(userAccessor.getUserByKey(names).getName())
//Take the user key and user it to fetch the name of the associated user
}
The page ID of any Confluence page is available under Page Information, under the ellipses in the top-right corner:
In this case the Page ID is 83591282. The other piece of information that the