import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.JiraAuthenticationContext
import com.atlassian.jira.user.ApplicationUser
//获取登录人
JiraAuthenticationContext jiraAuthenticationContext = ComponentAccessor.getComponent(JiraAuthenticationContext.class)
ApplicationUser currentUser = jiraAuthenticationContext.getLoggedInUser()
//获取所有管理员
Collection<ApplicationUser> applicationUsers = ComponentAccessor.getUserUtil().getJiraSystemAdministrators()
boolean check = false
for(ApplicationUser admin:applicationUsers){
if (admin.getUsername().equals(currentUser.getUsername())) {
check = true
break
}
}
return check