I'm creating script for limiting a user to create any further issues which are linked to certain issue types. Simple scripted field for adding in the validator of a transition using script runner. Can you please tell me how you can restrict this action for user but not an admin.
This script is by project role but not group :
ApplicationUser currentUser = ComponentAccessor.getJiraAuthenticationContext().getUser();
ProjectRole adminRole = projectRoleManager.getProjectRole("Administrator");
ProjectRoleActors admins = projectRoleManager.getProjectRoleActors(adminRole, issue.getProjectObject());
Boolean isAdmin = admins.contains(currentUser);
You can try something like this
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.security.roles.ProjectRoleManager;
def projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager.class)
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getUser();
def adminRole = projectRoleManager.getProjectRole("Administrator");
def admins = projectRoleManager.getProjectRoleActors(adminRole, issue.getProjectObject());
return admins.contains(currentUser);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.