The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
  • Community
  • Q&A
  • Jira
  • Questions
  • Method doesn't exist in PermissionSchemeManager interface although it was clearly stated in Java API

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Ram Kumar Aravindakshan _Adaptavist_
Community Champion
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