Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Condition check logged in user

In follow-up to my previous question (

How do I create a condition where the hiding of UI elements ONLY applies to: anonymous users OR logged in users that are member of group XX


1 answer

1 accepted

0 votes
Answer accepted

Found it myself..


import com.atlassian.jira.component.ComponentAccessor

def groupManager = ComponentAccessor.groupManager
def loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser

final username = loggedInUser.username

def groupNames = groupManager.getGroupNamesForUser(username).contains("jira-administrators")

groupNames == true

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events