How to fetch role of a logged in user
Accepted answer
it is deprecated, and I haven't found what the replacement is yet.
com.ibm.team.process.internal.common.RolePersistence.getPersistentRoleData(IProkectArea.getTeamData(), IContrinutorHandle srcuser)
note that a user might have multiple roles.
Comments
Hi Sam,
Thank you.
One more question, how to fetch details of Approval tab.
Do you have any sample snippet?
Regards,
Chandan
IApprovals = IWorkItem.getApprovals()
see the javadoc that is provided as part of the product downloads
Thanks for the Approval code.
But i feel role of a logged in user, i am not able to fetch from the server extensions plugin.
How to do it... ?
I used the code from my server participant plugin, built on Ralph's
I showed you the types, not the exact code..
I am not aware of any role restriction that would prevent you from reading the approvals from a workitem.
the newstate is a workitem, so, once you cast, then you should be able to use the getApprovals() method.
here are the two exact statements
// Get the full state of the parent work item so we can edit it
IWorkItem workingCopy = (IWorkItem) fWorkItemServer.getAuditableCommon().resolveAuditable(workItem, IWorkItem.FULL_PROFILE, monitor).getWorkingCopy();
IApprovals approvals = workingCopy.getApprovals();
I am able to fetch approval details.
I need to fetch the roles of logged-in alm user. I am not able to achieve it.
I need a snippet to fetch user role for a project Area.
the AbstractService your plugin extends, provides a method,
getAuthenticatedContributor(), which returns the current Contributor (aka user ) handle
which you can then use on the prior RolePersistance method
Consider reading some of the links provided below. They show the API that you can use to get the roles of a user. The API is common and can be used on client as well as server. Especially read https://rsjazz.wordpress.com/2015/06/19/a-custom-condition-to-make-attributes-required-or-read-only-by-role/