ALM_How to update the access list using java or OSLC api.
![]() Hi all,
The Access Control for my project area is selected as "Users in the access list only".
I am able to get the list of users already present in the access list by using RTC Api code snippet as below.
IReadAccessListHandle accessListHandle=area.getReadAccessList();
IReadAccessList iReadAccessList = (IReadAccessList) itemManager.fetchCompleteItem(accessListHandle, itemManager.DEFAULT,new NullProgressMonitor());
IContributorHandle[] memberHandles=iReadAccessList.getContributors();
But i am unable to find any method to update this list.
|
One answer
![]()
Ralph Schoon (62.0k●3●36●43)
| answered Mar 22 '18, 11:18 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER This is easy enough to find for the Java API, provided you follow the hint in https://rsjazz.wordpress.com/2013/03/20/understanding-and-using-the-rtc-java-client-api/ to setup the RTC Eclipse client with the SDK.
public void testAddToAndRemoveFromProjectAreaAccessList() throws TeamRepositoryException { // This will be the list that we expect at the end: user1, guest1, and guest2 List expectedUsers = new ArrayList(); // First, set up the project area by manually adding members to the access list. IContributor user1 = repo.contributorManager().fetchContributorByUserId(TestUserNames.TEST_JAZZ_USER1, null); expectedUsers.add(user1); IContributor user2 = repo.contributorManager().fetchContributorByUserId(TestUserNames.TEST_JAZZ_USER2, null); IReadAccessListHandle accessHandle = fProjectArea.getReadAccessList(); IReadAccessList accessList = (IReadAccessList) repo.itemManager().fetchCompleteItem(accessHandle, IItemManager.REFRESH, null).getWorkingCopy(); accessList.addContributors(new IContributorHandle[] { user1, user2 }); getProcessItemService().save(accessList, null); |