Forums

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

Method doesn't exist in PermissionSchemeManager interface although it was clearly stated in Java API

Nhat Nam Nguyen
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 21, 2022

Hello there,

After I programmatically created a Jira project successfully, I need to add a permission scheme and notification scheme to the newly created project. Here is my code:

Capture2.PNG

I successfully added the notification scheme to the newly-created project but I could not add the permission scheme. 

 

What's confusing is that the PermissionSchemeManager: https://docs.atlassian.com/software/jira/docs/api/8.22.5/com/atlassian/jira/permission/PermissionSchemeManager.html and the NotificationSchemeManager: https://docs.atlassian.com/software/jira/docs/api/8.22.5/com/atlassian/jira/notification/NotificationSchemeManager.html all inherit from the parent SchemeManager, therefore both have the addSchemeToProject(Project project, Scheme scheme) method. However, the Scriptrunner editor stated that PermissionSchemeManager doesn't have the method while NotificationSchemeManager has the method and works perfectly.

Capture3.PNG

 

Any ideas why? Thanks !!!

1 answer

0 votes
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 28, 2022

Hi @Nhat Nam Nguyen

After going through your description, I did a quick test in my environment with the sample code below and didn't encounter any error messages.

import com.atlassian.jira.component.ComponentAccessor

def projectManager = ComponentAccessor.projectManager
def permissionSchemeManager = ComponentAccessor.permissionSchemeManager

def scheme = permissionSchemeManager.getSchemeObject('Sample')
def project = projectManager.getProjectByCurrentKey('MOCK')

permissionSchemeManager.addSchemeToProject(project, scheme)

Below is a screenshot of the configuration for your reference:-

configuration.png

If you observe in the screenshot above, no error message is returned. The code is accepted without any issue.

Please try to modify your code according to the example code I have provided above and see if the error persists.

Also, please update your ScriptRunner plugin to the latest release before testing.

Thank you and Kind regards,

Ram

Suggest an answer

Log in or Sign up to answer