Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Only allow a certain group access to a tab and its contents on all screens Edited

Hello Atlassian community,

I have a project where we've got a 'QA Notes' tab on our Findings issue type screen. This tab has a QA Notes field on it where our QA group would like to add notes, but only have people in the QM group have access to edit and see those notes/tab.

Here's what I've added via the ScriptRunner Behaviours:

Mappings are to the project and specific issue type.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue

def groupManager = ComponentAccessor.getGroupManager()

if ('isUserinGroup QM' == 'false') {
hideTab(2)
}

I've tried it with and with/out the import/def ...and I've found that if I just use 

if ('isUserinGroup QM') {
hideTab(2)
}

...the tab is hidden, but it's hidden to even the QM group. I don't know what I'm doing wrong here...any help is greatly appreciated.

2 answers

1 accepted

0 votes
Answer accepted
Daniel Ebers Community Leader Nov 28, 2020

Hi Lara,

the function hideTab(2) is working as per your description and per my past experience.

I am unsure about your implementation of testing for the group, though.

I remember that it worked like this but please double check and verify:

def currentUser = ComponentAccessor.getJiraAuthenticationContext().getUser()

if (! userUtil.getGroupNamesForUser(currentUser.name).contains("QM")) {

// the rest of existing code goes here

}

Please do not forget the closing curly bracket at the very end.

Hope it helps!

Cheers,
Daniel

@Daniel Ebers Thanks for the script...I updated with a couple items. It is technically working, but only on the Edit screen. If you aren't part of the QM group you can still View the 'QA Notes' Tab. What do I need to add to hide the tab from the View screen as well? Or is this not possible since I've created a Behaviour?

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.util.UserUtil

def userUtil = ComponentAccessor.getComponent(UserUtil.class)
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()


if (! userUtil.getGroupNamesForUser(currentUser.name).contains("QM")){
hideTab(2)
}

 

The only workaround I've found for this is to take the 'QA Notes' field off of the 'QA Tab' View screen...but the QM group wants to be able to view the contents on the View screen and not have to click on Edit to view the fields contents...so this won't work.

Daniel Ebers Community Leader Nov 30, 2020

For the view screen it is not possible as per documentation. This is a restriction due to architectural circumstances.

That's what I thought you might say! Uggghhh.

Thanks for the reply.

For anyone who may be interested in doing this, I did double check with ScriptRunner and they confirmed that my ask is not possible at this time. They do have a new Feature request documented - Make hideTab work on View screen SRJIRA-3125. This is in a TO DO status.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Jira Software

Presenting the "Best of 2020" Jira Software roundup!

Catch up with Atlassian Product Managers in our 2020 Demo Den round-up! From Advanced Roadmaps to Code in Jira to Next-Gen Workflows, check out the videos below to help up-level your work in the new ...

7,175 views 8 28
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you