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
4,364,880
Community Members
 
Community Events
168
Community Groups

Condition check logged in user

In follow-up to my previous question (https://community.atlassian.com/t5/Adaptavist-questions/Hide-UI-elements/qaq-p/1481462):

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
TAGS

Atlassian Community Events