Hello everyone,
I'm fairly new to Groovy for Jira, and I came across a strange case
I need to know if an user has rights to a given project/issue. I then created following code :
///
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.plugin.ProjectPermissionKey
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.issue.IssueManager;
IssueManager issueManager = ComponentAccessor.getIssueManager()
def issueobj = Issues.getByKey('BLA-136')
Issue issue = issueManager.getIssueObject(issueobj.id)
def appUser = ApplicationUser.hasPermission(new ProjectPermissionKey("BROWSE_PROJECTS"), issue )
///
But when I execute I got
groovy.lang.MissingMethodException: No signature of method: static com.atlassian.jira.user.ApplicationUser.hasPermission() is applicable for argument types: (com.atlassian.jira.security.plugin.ProjectPermissionKey, com.atlassian.jira.issue.IssueImpl) values: [BROWSE_PROJECTS, BLA-136] Possible solutions: hasPermission(com.atlassian.jira.security.plugin.ProjectPermissionKey, com.atlassian.jira.project.Project), hasPermission(com.atlassian.jira.security.plugin.ProjectPermissionKey, com.atlassian.jira.issue.Issue), hasPermission(com.atlassian.jira.permission.GlobalPermissionKey) at Script460.run(Script460.groovy:12)
I don't know how to hop from com.atlassian.jira.issue.IssueImpl to com.atlassian.jira.issue.Issue. It's the same if I try to load the project, I even tried mutableIssue but still the same result. I tried to use directly issueobj but same result too.
Do you have any indication or documentation I may have missed on how to convert that into the type I need ?
Regards,