Hi,
Via a Scriptrunner Fragment I want to have the option More -> Labels in issues of 4 Jira projects only available for users in the project roles 'Administrators', 'Scrum Masters', 'Productowners'.
With the following script I am able to make the option More -> Labels in issues available only to users in the project roles 'Administrators', 'Scrum Masters', 'Productowners', but this now applies to all jira projects.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.web.action.ProjectActionSupport
import com.atlassian.jira.project.Project
import com.atlassian.jira.security.roles.ProjectRoleManager
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
ProjectActionSupport projectSupport = new ProjectActionSupport();
Project currentProject = ComponentAccessor.getProjectManager().getProjectObj(projectSupport.getSelectedProjectId());
def projectRoleManager = ComponentAccessor.getComponentOfType(ProjectRoleManager)
def allowedRoles = ['Administrators', 'Scrum Masters', 'Productowners','Viewers','Service Desk Team']
def isUserInAllowedRoles = allowedRoles.any{ projectRole ->
def role = projectRoleManager.getProjectRole(projectRole)
projectRoleManager.isUserInProjectRole(currentUser, role, currentProject)
}
return ( isUserInAllowedRoles || !jiraHelper.project?.key in ["SH3","SF3","SI3","SM3"])
System does not respond (properly) to
return ( isUserInAllowedRoles || !jiraHelper.project?.key in ["SH3","SF3","SI3","SM3"])
How do I modify the script so that it only applies to the 4 jira projects?
Thank you in advance.
Regards, Marco Brundel
This is a follow up question to
https://community.atlassian.com/t5/Adaptavist-questions/How-can-a-Scriptrunner-Fragment-make-it-apply-to-multiple/qaq-p/1932960
