I am attempting to allow a specific group to by pass a workflow step. I want the script to get the current user and if that user is in a group "QA" , it returns true and the post function executes the next transition.
I'm not sure what to do for coding here. I've attempted to use groovy but our script listener add on is broken at the moment and I cannot test.
Any help would be greatly appreciated in making this code work.
thanks,
import com.atlassian.crowd.embedded.api.User; import com.atlassian.jira.ComponentManager; User user = ComponentManager.getInstance().getJiraAuthenticationContext().getLoggedInUser(); CrowdService cs = ComponentManager.getInstance().getCrowdService(); return cs.isuserMemberOfGroup(user.getName(), "QA");
Try:
def groupManager = ComponentAccessor.getGroupManager() return groupManager.getGroupNamesForUser(user.name).contains("QA")
@echlin I was getting this error when it ran. I was able to pull it out of catalina.out when creating a ticket. Script1.groovy: 5: unable to resolve class CrowdService @ line 5, column 14. CrowdService cs = ComponentManager.getInstance().getCrowdService(); So I added this import: import com.atlassian.crowd.embedded.api.CrowdService; That didnt seem to help. Any help would be greatly appreciated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Strange... Try def groupManager = ComponentAccessor.getGroupManager() return groupManager.getGroupNamesForUser(user.name).contains("QA")
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.