I want to get the names of groups, which are assigned to a role in a project, but only found a way to get all usernames that are assigned to a role, with the following:
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.project.Project;
import com.atlassian.jira.security.PermissionManager;
import com.atlassian.jira.security.roles.ProjectRole;
import com.atlassian.jira.security.roles.ProjectRoleActors;
import com.atlassian.jira.security.roles.ProjectRoleManager;
import com.atlassian.jira.user.ApplicationUser;
Collection<Project> projects = permissionManager.getProjects(new ProjectPermissionKey("BROWSE_PROJECTS"), appUser);
ProjectRoleManager projectRoleManager = ComponentAccessor.getComponentOfType(ProjectRoleManager.class);
ProjectRole projectRole = projectRoleManager.getProjectRole("Role Name");
for(Project project : projects){
ProjectRoleActors projectRoleActors = projectRoleManager.getProjectRoleActors(projectRole, project);
System.out.println(projectRoleActors.getUsers().toString());
}
Is there any way to get the groupnames instead of all usernames?