jbeck
jbeck

Reputation: 2254

Can I assign JIRA permission schemes to projects in a plugin?

I haven't been able to find any info about this, whether or not it's possible.

I'm writing an external app that I want to give the ability to really put projects on hold (i.e. browse only, can't create/modify/etc... issues), and remove that hold. Everything is working fine in terms of the communication between the two apps, but I can't find the API hook to change the permission scheme associated with a project.

Can anyone point me in the right direction or tell me if this is just something that can't be done?

Upvotes: 2

Views: 625

Answers (1)

grdl
grdl

Reputation: 3958

It is possible.

First you should use validateUpdateProjectSchemes from ProjectService class (to get the projectService object you simply inject it into your constructor).

UpdateProjectSchemesValidationResult validationResult = projectService.validateUpdateProjectSchemes(
    user,
    permissionSchemeID,
    null,
    null);

Then, check if validation result is valid and actually update the project with chosen permission scheme using updateProjectSchemes method:

if (validationResult.isValid()){
    projectService.updateProjectSchemes(validationResult, project);
}

Upvotes: 2

Related Questions