Cannot figure out what I'm doing wrong. Running jira 4.4.4 using a groovy script post-function.
Here's what I've done:
import com.atlassian.jira.ComponentManager import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.security.groups.GroupManager def componentManager = ComponentManager.getInstance() def currentUser = componentManager.jiraAuthenticationContext?.user if ( GroupManager.isUserInGroup(currentUser.name, "Client Managers")) { // do something }
and I keep getting this error:
javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: static com.atlassian.jira.security.groups.GroupManager.isUserInGroup() is applicable for argument types: (java.lang.String, java.lang.String) values: [testuser, Client Managers]
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:318)
Am I using the wrong package? I cannot figure out why this doesn't work.
Community moderators have prevented the ability to post new answers.
Found the issue. You have to do this:
GroupManager groupManager = ComponentManager.getComponentInstanceOfType(GroupManager.class)
and change this:
if ( GroupManager.isUserInGroup(currentUser.name, "Client Managers")) { // do something }
to this:
if ( groupManager.isUserInGroup(currentUser.name, "ClientManagers")) { // do something }
Rookie mistake!
Kind of a rookie mistake but that's OK. Maybe you could try to set up your IDE... if you do that it won't let you make this kind of mistake: https://studio.plugins.atlassian.com/wiki/display/GRV/Script+Runner#ScriptRunner-DebuggingandCodingwithIDEA
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.