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

Setting Restricted Access programmatically

Hi All,
Am using Restricted Access feature provided in RTC v3.0 for controlling view access for couple of work items for list of users. I understand that we can have it enabled on web client by including "Restricted Access" attribute in our editor presentation. Now I have a scenario wherein, I would need to create work items programmatically. I would want these newly created ones also to be set for access controlling by default. Can I set this attribute "Restricted Access" also in my program to achieve this?? Any pointers in this direction would greatly help. Thanks

Thanks & regards,
Mohan

1

0 votes



One answer

Permanent link
Hello Mohan,

yes you can set the Restricted Access att of a WorkItem programmatically. You basically need to get the UUID from the Project Area you want to set the value for and set the contextId attribute. Here I add you some snippets to try to help out:




// Assume pArea1 is WI's Project Area
// and PArea2 is to what you want to set security context
// Both assignable to IProjectArea

IWorkItemClient service = (IWorkItemClient) repo.getClientLibrary(IWorkItemClient.class);

// Retrieve Restricted Attribute
IAttribute restrictedAtt = service.findAttribute(pArea1, "contextId", monitor);

// I assume you already have your WorkItem WorkingCopy

IWorkItem workItem = <workingCopy>.getWorkItem();

// From a Project Area, you have to get the UUID

UUID secContext = pArea2.getContextId();

workItem.setValue(restrictedAtt, secContext);

...


Hope this eskeleton snippets help.

Regads,

Jorge

									

1 vote

Comments

I'm using 4.0.3, and I'd like to programatically set Restricted Access to an Access Group.  Is this possible?  I haven't figured out how to return the UUID for the Access Group. 

The code above would work for 4.0.3 as well.

That code is getting the UUID for the Project Area though... I'm trying to get the UUID for an Access Group.  Or am I missing something?

See https://rsjazz.wordpress.com/2013/06/26/attribute-customization-java-based-value-providers-conditions-and-validators/ and look into how I get the SecurityContextProvider that actually uses them. Look into the code.

I think it is

workItemCommon.getAuditableCommon().getAccessGroups()

So you get them from an AuditableCommon service or client library.

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: Mar 04 '11, 2:42 a.m.

Question was seen: 6,715 times

Last updated: Jul 05 '13, 1:23 a.m.

Confirmation Cancel Confirm