Hidding the transition for everyone except for 2 groups

Rok Antolic November 22, 2015

Hello,

I would like to hide transition for everyone except for the groups "Change Managers" and "Process Supervisors". I guess via script and conditions it should be possible somehow. Any ideas about the code and how to get it done?

Thanx!

Rok

2 answers

4 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 22, 2015

You don't even need script-runner for this - the condition "user is in group" is present in off-the-shelf JIRA.

Rok Antolic November 23, 2015

I know about that and I use it often, maybe I should have given the more detailed explanation. In this particular case all the users are able to do transitions, because I have automatic Sub-Task blocking conditions system up, and in most cases transitions are automatic, etc. But when the ticket doesn't get automatically transitioned, I have this hole in my system that transition becomes visible to everyone which is not good. When I place "User is in group" condition, automatic system stops working sadly, that's why I wanted to simply hide the transition from everyone who isn't supposed to do it when it comes to "manual situation" Cheers, Rok

Steven F Behnke
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 Leaders.
November 25, 2015

Would it be possible to see this via a screenshot? I think I have an understanding of what your issue is but I'm not sure where the "hole" comes from.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 25, 2015

Yes, it would have been useful to tell us the full situation. I think this is a complex setup and you need to show us the conditions on this transition in full.

0 votes
Mario Günter
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 Leaders.
November 22, 2015

Hi Rock, 

maybe this is what you need: 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.util.UserUtil
 
// get users groups
def curUserGroups = ComponentAccessor.getUserUtil().getGroupNamesForUser(curUser.getName())
 
if (curUserGroups.contains("group1") || curUserGroups.contains("group2")) {
	// do something (return true) 
} else {
	// do something different (return false)
}

Hope this helps.

Cheers, Mario 

Rok Antolic November 23, 2015

Thanx man :), I'll check into it!

Suggest an answer

Log in or Sign up to answer