CRJAZ1319E Read access is not permitted.
HI All,
I am comparing baselines using java client api and fetching change sets,
Then I fetch work item of chagne set using below API
List<ILink> links = ChangeSetLinks.findLinks((ProviderFactory) teamRepository.getClientLibrary(ProviderFactory.class),sethandleforwi,
new String[] { ILinkConstants.CHANGESET_WORKITEM_LINKTYPE_ID },null);
for (final ILink lk : links)
{
final Object resolved = lk.getTargetRef().resolve();
if (resolved instanceof IWorkItemHandle)
{
workItem = (IWorkItem) iItemManager.fetchCompleteItem((IWorkItemHandle)resolved,IItemManager.DEFAULT,null);
//throws exception at this line
}
}
Exception thrown at this line is
com.ibm.team.repository.common.PermissionDeniedException: CRJAZ1319E Read access
is not permitted. The user, myadmin, tried to read one or more items that have the following type: WorkItem
What is cause of this error, and how can i resolve this error.
Accepted answer
The most likely cause is you don't have permission to read the work item, so you can get the handle but not resolve the item. Since RTC 3.x there are read permissions and a permission aware API. You can use IItemManager().fetchCompleteItemsPermissionAware(handleList,IItemManager.REFRESH, monitor) to make sure you know if you have access to objects or not. See https://rsjazz.wordpress.com/2015/10/28/build-artifacts-publishing-and-automated-build-output-management-using-the-plain-java-client-libraries/ for how it is used.