Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Remove user permissions from Confluence space

Tomislav Sablic
Contributor
November 4, 2020

Hello,

 

Could someone help me with ScriptRunner REST endpoint running on Confluence Server 7.2.0?

 

I just need to remove user permissions from space only. For example, I pass username and space key, and the script removes all permissions. I've been trying to use SpaceManager, SpaceManagerInternal but my context is always null. 

 

def space = spaceManager.getSpace(spaceKey)

SpacePermissionContext context = SpacePermissionContext.builder().build()

spacePermissionManager.removeAllUserPermissions(user,context)

 

The builder().build() doesn't work, and createDefault() as well.

How do I use this context in the right way?

 

Thanks.

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
January 27, 2019

Look at line 48 (the error message gives you the line on which it failed).  That line has a getId() call on the object "issue", but that object does not exist (that's what the "null object" part of the error means). 

So look at where that should be being created, because that line is not finding the issue.

Rajeswari Thangavel
Contributor
January 27, 2019

Hello, 

Thanks for your reply.

I'm new to scriptrunner. Could you please let me know how to create object?

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
January 27, 2019

By getting it from somewhere - look to where "issue" is defined in your code - that is going wrong.

TAGS
AUG Leaders

Atlassian Community Events