How can I get the Project Roles, which have Browse Project permission in the permission scheme for a certain project in JIRA plugin development?
I did a deep look into JIRA source, but got lost and did not find the right place.
Kind regards
Holger
Community moderators have prevented the ability to post new answers.
It took me a while to find out. Somewhere I found the hint to look at the JIRA XML export to understand the usage of GenericValue.
The JIRA XML export looks like this concerning permission schemes.
<PermissionScheme id="0" name="Default Permission Scheme" description="This is the default Permission Scheme. Any new projects that are created will be assigned this scheme."/> <Project id="10000" name="Test Project" url="" lead="admin" description="" key="TEST" counter="1" assigneetype="2" avatar="10011"/> <NodeAssociation sourceNodeId="10000" sourceNodeEntity="Project" sinkNodeId="0" sinkNodeEntity="PermissionScheme" associationType="ProjectScheme"/> <ProjectRole id="10000" name="Users" description="A project role that represents users in a project"/> <ProjectRole id="10001" name="Developers" description="A project role that represents developers in a project"/> <ProjectRole id="10002" name="Administrators" description="A project role that represents administrators in a project"/> <SchemePermissions id="10004" scheme="0" permission="23" type="projectrole" parameter="10002"/> <SchemePermissions id="10005" scheme="0" permission="10" type="projectrole" parameter="10000"/> <SchemePermissions id="10006" scheme="0" permission="11" type="projectrole" parameter="10000"/> <SchemePermissions id="10007" scheme="0" permission="15" type="projectrole" parameter="10000"/> <SchemePermissions id="10008" scheme="0" permission="19" type="projectrole" parameter="10000"/> <SchemePermissions id="10009" scheme="0" permission="13" type="projectrole" parameter="10001"/> <SchemePermissions id="10010" scheme="0" permission="17" type="projectrole" parameter="10001"/>
This means, that there is a PermissionScheme with id="0" is associated to a project id="10000". Then you can see, that the project role 10000 is assigned to the scheme 0 for certain permissions. As you can also assign users and groups you will also find XML nodes with type="user" and type="group" where parameter then is user id resp. group name.
Use PermissionSchemeManager to retrieve the PermissionScheme of the project
GenericValue tmpSchemeGV = permissionSchemeManager.getSchemes(tmpProjectGV).get(0);
Use getEntities to check which project roles are assigned to a certain permission
List<GenericValue> tmpBrowseRoles = permissionSchemeManager.getEntities(tmpSchemeGV, "projectrole", new Long(Permissions.BROWSE));
The generic value now contains the information, which project role it is.
for (Iterator<GenericValue> iterator = tmpBrowseRoles.iterator(); iterator.hasNext();) { GenericValue genericValue = (GenericValue) iterator.next(); ProjectRole tmpRole = projectRoleManager.getProjectRole(new Long(genericValue.getString("parameter"))); System.out.println(tmpRole.getName()); }
Best regards
Holger
I wish I could up vote more than once...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the feedback. Yes, very tricky.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Where can i find PermissionSchemeManager?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How do I get the list of users with list of permissions and their project roles in JIRA projects.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Read below link care fully.
https://confluence.atlassian.com/display/JIRA/Managing+Project+Permissions
i geuss your developing jira plugin.
http://docs.atlassian.com/jira/latest/com/atlassian/jira/security/PermissionManager.html
and you will get the object for
http://docs.atlassian.com/jira/latest/com/atlassian/jira/security/Permissions.html
now all permissions are integer no you can put and get the list of available groups.
all permissions are user specific if you want to make permissions as project specific you can put list of project in "Set" and display it.
regards,
tousif shaikh.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What do you mean with "permissions are user specific"? Permissions e.g. Permissions.BROWSE can be assigned to users, groups and project roles.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
is this what you are looking for?
http://docs.atlassian.com/jira/latest/com/atlassian/jira/security/roles/ProjectRoleManager.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, no. I don't find anything there, to check, if the project role is assoziated with a certain permission.
Any other hint?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.