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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For the view screen it is not possible as per documentation. This is a restriction due to architectural circumstances.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's what I thought you might say! Uggghhh.
Thanks for the reply.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.