Set permission scheme in Java

Chris Steenwyk April 15, 2021

I am trying to set the permission scheme of a project. I have a permission scheme named "Test".

 

This code passes, but the permission scheme remains "Default Software Scheme". Ideas?

 

public void SetPermissionScheme(Project project) 
{

log.info("Setting project permission scheme");
PermissionSchemeManager permissionSchemeManager = ComponentAccessor.getPermissionSchemeManager();
permissionSchemeManager.removeSchemesFromProject( project );
Scheme permissionScheme = permissionSchemeManager.getSchemeObject("Test");
permissionSchemeManager.addSchemeToProject(project, permissionScheme);
}

This is what the audit log looks like for the project:

image.jpg So the permission scheme is set, then removed for some reason?

1 answer

0 votes
Martin Bayer _MoroSystems_ s_r_o__
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 15, 2021

Hi @Chris Steenwyk I never used this manager but I have few ideas

Can you try to add some logging and share the log pls?

Chris Steenwyk April 20, 2021

So I added logging . There are no errors reported during the operation. I also removed the "removeSchemesFromProject" call without affecting the end result.

Is there another way to set the permission scheme?

Martin Bayer _MoroSystems_ s_r_o__
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 21, 2021

What is the result of following code?

Scheme permissionScheme = permissionSchemeManager.getSchemeObject("Test"); 
log.error(permissionScheme) 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.13.5
TAGS
AUG Leaders

Atlassian Community Events