Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Error while fetching related workitens

Hello,

Im doing an advisor (@save operation) to check if some spefic type is related to work item.

I want to fetch the relateds items and do something if the type is a task, for example. But when the user try to save the work and dont have permission to read the related items, PermissionDeniedException is throwed.

I would like to know if there is a way to check the work item type when the user dont have the permission.  My code:

IWorkItemHandle wiRelatedHandle = (IWorkItemHandle) related
                                            .resolve();
                                     //This line throws PermissionDeniedException
                                    IWorkItem workItemRelated = (IWorkItem) auditableCommon
                                            .resolveAuditable(wiRelatedHandle, IWorkItem.SMALL_PROFILE,
                                                    monitor);                                 
                                   
                                   if (workItemRelated.getWorkItemType().equals(type))
                                            hasTask=true;
                                    }
Thanks.
 

0 votes

Comments

I know of some users who would create a new client interface, log on with a dedicated user and do all the "privileged" stuff. Doing this way will make the code more complicated though.



One answer

Permanent link
No. Unless you do as Donald suggests, there is no way around the security..

just put a try catch around it and catch the exception and ignore it is all you can do.
you should be in a loop processing all the related workitems..
 for(IReference ir: ((ISaveParameter) data). getNewReferences(). getReferences(WorkItemEndPoints.RELATED_WORK_ITEM))
{
  try {
       // your code
       }
  catch(PermissionDeniedException ex)
       {
       // ignore it
       }
}

0 votes

Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Dec 10 '14, 1:21 p.m.

Question was seen: 2,944 times

Last updated: Dec 11 '14, 11:51 p.m.

Confirmation Cancel Confirm