How Do I Get the Current User's Repository Permissions (Groups) via Java-API?
I have an operation behavior that needs to know the repository permissions of the user who triggered it. I found this post here on Jazz.net that provided some instructions for how to do this with the "Plain-Java" (client-side) API:
Unfortunately, I can't use this technique in a Server-Side operation behavior. I had thought that the technique might be similar so I've been using the intellisense and trial-and-error to try and figure out how I should do it.
I found a service and interface that looked promisiting under com.ibm.team.repository.service.userregistry.provider.*
I tried instantiating a class for the IUserRegistryProviderService and then getting the IUserRegistry using the getRegistry() function, but I got an error message saying that this action is only permitted on the JTS server. Since the operation fires on the CCM server, I assume I just can't use this technique.
Does anyone know how to do this?
One answer
I found an answer to this but evidently forgot to come back and document it.
IAuditableCommon iac = getService(IAuditableCommon.class);
IContributor currentUser = (IContributor) iac.resolveAuditable(getAuthenticatedContributor(), ItemProfile.createFullProfile(IContributor.ITEM_TYPE), monitor);
IExternalUserRegistryService regService = getService(IExternalUserRegistryService.class);
boolean currentUserIsJazzAdmin = regService.isMember(currentUser.getUserId(), "JazzAdmins");
Comments
Nate Decker
Oct 09 '15, 2:52 p.m.Nate Decker
Oct 09 '15, 2:52 p.m.