Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Hide a UI element in one project depending on Role

Vasanta Kumaar
Contributor
May 25, 2020

Hi All,

I am using the "Hide system or plugin UI element" from ScriptRunner Add-On to hide a Link in the UI and it works to hide it for all members of the project.

I have also found a script to hide to all the members except the project admin. I am able to perform the above for all project, but my condition is to restrict only one project. 

Can anyone suggest How to restrict on one project based on project role.

Below is the script I found out and using 

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

def project = jiraHelper.project?.key


String roleName = "Administrators"

if (project != null) {

def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
ProjectRoleManager projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager);
def projectRole = projectRoleManager.getProjectRole(roleName)

return projectRoleManager.isUserInProjectRole(user, projectRole, issue.getProjectObject())

}

return false

 

 

2 answers

Suggest an answer

Log in or Sign up to answer
0 votes
Rogério Paiva - Xray Xporter
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
March 29, 2022

Hi @Garden16_ 

What kind of customization would you like to do?

The JQL enhancements as mentioned by @Ste Wright  could be a good option.

If you want to change the option in the screenshot you showed; currently, it is not possible to change that.

Please contact Xray Support (http://Xraysupport.getXray.app) if you need further help.

Thank you.

Kind regards,
Rogerio Paiva [Xray Support Team]

0 votes
Ste Wright
Community Champion
March 19, 2022

Hi @Garden16_ 

Is this for Xray Test Management?

If so, have you checked out this list of JQL functions available on their help site?

Ste

TAGS
AUG Leaders

Atlassian Community Events