It's all about the answers!

Ask a question

How to get the permissions set on a user programmatically(serverside)


Meera Varma (91912) | asked Jan 16 '13, 6:22 a.m.
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


permanent link
Ralph Schoon (58.2k23642) | 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



permanent link
Lauren Hayward Schaefer (3.3k11327) | answered Jan 17 '13, 6:47 a.m.
JAZZ DEVELOPER
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

permanent link
Carlos Maciel (3112) | answered Jan 14 '15, 12:59 p.m.
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


Register or to post your answer.