Hey all,
I'm currently adding a top menu item as a custom web item using Scriptrunner (JSM Data Center). My intension is to add a condition to restrict this to a group.
The example snippet within the condition allows me to restrict what is shown per project, however, I'd like to restrict it to groups.
For example, only the 1st line team can only view the Jira form to raise a ticket from a telephone call, etc.
I've been looking through the adaptavist documentation but haven't quite found what I'm looking for. Is this possible, and if so, could someone point me in the right direction, please?
Many thanks in advance!
Dear Sam,
You can try this code in your condition:
import com.atlassian.jira.component.ComponentAccessor
def groupManager = ComponentAccessor.groupManager
def loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser
final username = loggedInUser.username
final groupName = "GROUP NAME" //TO BE UPDATED - PUT YOUR GROUP NAME HERE
def groupNames = groupManager.getGroupNamesForUser(username)
return groupNames.contains(groupName)
Amazing! Thank you so much, that worked like a treat.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.