How to get the permissions set on a user programmatically(serverside)
![]()
Hi
I am trying to check the permissions on a user .If the user has a permission to create workitem in a project area or not. Is there a way to get this information once I have the contributer handle. For eg: I have the the following to get the contributer IRepositoryItemService item = getService(IRepositoryItemService.class); IContributorHandle approver = getAuthenticatedContributor(); IItem username = item.fetchItem(approver, null); IContributor contributor = (IContributor)username.getFullState(); return contributor.getName(); So once I get the contributer I need to check whether this user has permission to create and save workitem on a particular project area. I do not know whether there is any API functions which support this operation. Appreciate your help. |
Accepted answer
![]()
Ralph Schoon (63.3k●3●36●46)
| answered Jan 17 '13, 6:52 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
The permissions are not tied to the user, but to the role the user has. The permissions are also not stored with the user but in some other process related API. See for how to at least get the roles of a user. http://rsjazz.wordpress.com/2012/12/09/analyzing-a-aroject-areas-members-and-roles-using-the-plain-java-client-libraries/
Meera Varma selected this answer as the correct answer
|
2 other answers
![]()
Hi Meera,
I don't have personal experience with this, but the following forum post has some suggestions: https://jazz.net/forum/questions/28417/web-client-api-to-know-the-permissions-of-the-logged-in-user |
![]()
Old post, but still might be useful to someone out there.
If you have the IRole object, you can send the actions as a string array:
String[] actions = {"modify","any","create","delete"}; //<- not sure if this encompass all the actions available.
to the process service (using client side libraries here):
boolean[] actionsAllowed = processService.getPermittedActions(role.getId(), actions, monitor);
and you'll get true or false, depending if the current role has those actions. Haven't tested this, though.
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.