Hello everyone!
I’m trying to make a condition for the web item to be hidden if the user is not a particular group.
I’m having errors:
[ERROR] userHasGroup.java:[21,1] method does not override or implement a method from a supertype
[ERROR] userHasGroup.java:[22,25] abstract methods cannot have a body
Here is my code: (got it from https://community.atlassian.com/t5/Answers-Developer-Questions/How-can-i-control-web-item-condition/qaq-p/471832 )
package userGroup;
import java.util.Map;
import com.atlassian.jira.plugin.webfragment.model.JiraHelper;
import com.atlassian.jira.plugin.webfragment.conditions.AbstractIssueWebCondition;
import com.atlassian.plugin.PluginParseException;
import com.atlassian.sal.api.user.UserManager;
public class userHasGroup extends AbstractIssueWebCondition{
private String group;
private UserManager userManager;
public userHasGroup(UserManager userManager){
this.userManager = userManager;
}
@Override
public void init(Map params) throws PluginParseException {
this.group=(String)params.get("group");
super.init(params);
}
@Override
public boolean shouldDisplay(UserManager userManager, JiraHelper arg1) {
if(userManager.getRemoteUserKey()!=null && this.group!=null){
return userManager.isUserInGroup(userManager.getRemoteUserKey(), this.group);
}
return false;
}
}
Can you please help me to understand what am I doing wrong?