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

How can I test permissions on IBaselineHandle before resolving to full item?

Team,

in a code not unlike
try {
... lots of other stuff
IBaselineHandle currentBLHandle;
IBaseline currentBL = (IBaseline) teamRepository
            .itemManager().fetchCompleteItem(currentBLHandle,
            IItemManager.DEFAULT, null);
} catch (final PermissionDeniedException e) {
           
        } ... and lots of other catches

how can I test the currentBLHandle for permissions before I run into the PermissionDeniedException?

gg,
Arne

0 votes



One answer

Permanent link
Ah, this is how it works:
Resolve the whole list of baseline handles at once with

IFetchResult fetchResult = teamRepository.itemManager().fetchCompleteItemsPermissionAware(...)
and then test for fetchResult.hasPermissionDeniedItems() or iterate over fetchResult.getRetrievedItems()

I will comment if anything funny comes up that mandates more explicit explanations.

1 vote

Comments

That's the right way to do it. 


For performance reasons you should always try and fetch as many items as you can at a time. The cost of hitting the database on the server is (usually) very low, but the cost of crossing the network is very high. 

You can detect permission failures in the manner you suggest, or by using an IItemManager.fetch* and checking for null. 

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,939

Question asked: Mar 17 '15, 3:14 a.m.

Question was seen: 3,823 times

Last updated: Mar 17 '15, 10:04 a.m.

Confirmation Cancel Confirm