Hi All,
I am using the "Hide system or plugin UI element" from ScriptRunner Add-On to hide a Link in the UI and it works to hide it for all members of the project.
I have also found a script to hide to all the members except the project admin. I am able to perform the above for all project, but my condition is to restrict only one project.
Can anyone suggest How to restrict on one project based on project role.
Below is the script I found out and using
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.roles.ProjectRoleManager
def project = jiraHelper.project?.key
String roleName = "Administrators"
if (project != null) {
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
ProjectRoleManager projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager);
def projectRole = projectRoleManager.getProjectRole(roleName)
return projectRoleManager.isUserInProjectRole(user, projectRole, issue.getProjectObject())
}
return false