It's all about the answers!

Ask a question

How to check access to a work item ?


Sudipto Sarkar (63435) | asked Jun 15 '16, 2:47 a.m.
edited Jun 15 '16, 3:08 a.m. by Ralph Schoon (59.4k23642)
Hi All,
Say that I am accessing a workitem w1. Description field of w1 mentions one attachment say attachment 100.
And say I do not have access to this attachment. How do I detect it ?

I have fetched attachment handle and reached following stage:

IAttachmentHandle attachHandle = (IAttachmentHandle) iReference.resolve();
                IAuditableClient auditableClient = (IAuditableClient) teamRepo
                        .getClientLibrary(IAuditableClient.class);
                IAttachment attachment = (IAttachment) auditableClient
                        .resolveAuditable((IAttachmentHandle) attachHandle, IAttachment.DEFAULT_PROFILE, null);


The highlighted line above throws me an exception as I don not have access to it. I want to detect the access rights. How can I do it?


One answer



permanent link
Ralph Schoon (59.4k23642) | answered Jun 15 '16, 3:14 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I am not aware of fine grained read access permissions for work item attachments. If you have access to the work item, you have access to the attachments. There is a permission aware API to resolve handles you could use if in doubt.

https://rsjazz.wordpress.com/2012/09/21/downloading-attachments-from-work-items/
and
https://rsjazz.wordpress.com/2012/08/01/uploading-attachments-to-work-items/

explain the attachments API

Your answer


Register or to post your answer.