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

GroupManager.isUserInGroup() returning "No signature of method" error

neil1967 October 4, 2012

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.

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
Answer accepted
neil1967 October 4, 2012

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!

JamieA
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.
October 4, 2012

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

TAGS
AUG Leaders

Atlassian Community Events