Hi all,
I'm trying to create a flag that shows on every page if it's in a public or private space due security. I'm using the Adaptavist Scriptrunner and would like to achieve this with some Groovy Scripting, but somehow it keeps giving me errors.
import com.atlassian.confluence.pages.Page
import com.atlassian.confluence.security.Permission
import com.atlassian.confluence.security.PermissionManager
import com.atlassian.confluence.security.SpacePermissionManager
import com.atlassian.confluence.user.ConfluenceUser
import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.confluence.spaces.Space
def space = context.space as Space
if (space) {
def spaceManager = ComponentLocator.getComponent(SpacePermissionManager)
return spaceManager.groupHasPermission(Permission.VIEW, space, "confluence-users")
}
else {
return false
}
I already tried with different permissions, but the same errors keeps popping up:
Cannot find matching method
com.atlassian.confluence.security.DefaultSpacePermissionManagergroupHasPermission
Please check if the declared type is right and if the method exists.
What is going wrong?
Thank you
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.