how to get Project Role object using api method in Behaviours Plugin?

fabby June 5, 2012

my jira version is jira 4.4.1

i'v known how to get "project" object instance.

now i need "Project Role" object.i only searched "ProjectRole getProjectRole(String name)" about project role.but i can't find any methods in relation to connecting "Project Role" with "Project"

anyone can help?

thanks!

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Mizan
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.
June 5, 2012

Below is a Java code i hope it works for groovy as well

import com.atlassian.jira.security.roles.ProjectRole;
import com.atlassian.jira.security.roles.ProjectRoleManager;

ProjectRoleManager defaultprojrolemanager = (ProjectRoleManager)ComponentManager.getComponentInstanceOfType(ProjectRoleManager.class);

Collection projectrole = defaultprojrolemanager.getProjectRoles(User, Project);

for (ProjectRole projro : projectrole) {
      if ((projro.getName().equals("Role"))) {
        //do something
      }
    }

fabby June 6, 2012

Mizan,

thanks for your answer! i use groovy similar to yours

TAGS
AUG Leaders

Atlassian Community Events