Custom web item only for specific role in a specific project Edited

I want that only a specific role in a specific project can see the link in the top-navigation.bar in jira. how should the condition look like?

this link is for the service-desk-agents in a service desk project. they can quickly open the queues with that. if i leave the condition blank every user can see this link. but i want only this menu-point. only the agents in this service-desk-project should see the link.

2017-11-03_151703.png2017-11-03_151826.png

1 answer

1 accepted

Accepted Answer
0 votes
Alexey Matveev Community Champion Nov 03, 2017

Hello,

The codition would look somthing like this

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.roles.ProjectRoleManager
import com.atlassian.jira.security.roles.ProjectRole

def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def projectRoleManager = ComponentAccessor.getComponentOfType(ProjectRoleManager)
def project = ComponentAccessor.getProjectManager().getProjectByCurrentKey("ProjectKey")
ProjectRole administratorProjectRole = projectRoleManager.getProjectRole("RoleName");
if (projectRoleManager.isUserInProjectRole(user, administratorProjectRole, project)) {
return true
} else {
return false
}

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 16, 2018 in Jira

Looking for anyone who made the switch to Data Center

The Jira Marketing team is putting together an ebook on migrating to Data Center. We're looking for pro tips on how you staffed your project team and organized your Proof of Concept. Share yo...

62 views 0 2
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you