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
Deleted user
November 14, 2018

It should be enough adding this in a simple validator:

issue.getFixVersions() 

And then select the field fix versions to show the error you want there.

Rosana Casilli
November 14, 2018

Hi Cristian!

 

I have written the exact what you told me, but now it doesn't show me the message error when the fix version is not complete.

 

I fogot to tell you that I am using Groovy

Deleted user
November 14, 2018

Are you using a simple validator or a scripted validator? Note that this are not the same. In Simple validator you don't need to use

throw new InvalidInputException("Fix Version/s is required");

But you ned to use it in a scripted validator

Rosana Casilli
November 14, 2018

I am using Scripted Validator.

Deleted user
November 14, 2018

If you are using scripted validator use this:

import com.opensymphony.workflow.InvalidInputException

if (issue.getFixVersions()) {

throw new InvalidInputException("Fix Version/s is required");

}

If you are using Simple Validator, this should be enough:

issue.getFixVersions()

Rosana Casilli
November 14, 2018

I do not have Script Runner installed (the company doesn't want to invest money on this) so I have installed Code Runner  Groovy, and I have written the code in my first post. But As I have said, when the fix version has a value then it shows the error "An unknown exception occured executing Validator com.atlassian.jira.workflow.SkippableValidator@17eedcdc: root cause: java.lang.NullPointerException"

Rosana Casilli
November 15, 2018

I do not have Script Runner installed (the company doesn't want to invest money on this) so I have installed Code Runner  Groovy, and I have written the code in my first post. But As I have said, when the fix version has a value then it shows the error "An unknown exception occured executing Validator com.atlassian.jira.workflow.SkippableValidator@17eedcdc: root cause: java.lang.NullPointerException"

TAGS
AUG Leaders

Atlassian Community Events