How to modify access list for Project area?
Hi, I have following issue. I would like to modify access list for given project area. I found following method: projectArea.getReadAccessList() Is that a method I should use? Could you provide me sample of the code how to add given user and add him "developer" role?
Thanks in advance. |
9 answers
Hi, I have following issue. I would like to modify access list for given project area. I found following method: projectArea.getReadAccessList() Is that a method I should use? Could you provide me sample of the code how to add given user and add him "developer" role? there is no 'api'.. there are a bunch of methods on objects as this is an Object Oriented system.. if you look at the new Javadoc for 3.0.1.1, you need to connect to the repository (ITeamRepository), and u need to create, update, save users (IContributor) with some manager class (IContributorManager) and there are a bunch of classes under IContributor (identity, userid, details, handle, record) and u will probably have to use the ItemManager to read/write stuff in the Repository. A lot of those classes are in the com.ibm.team.repository.common package, some are in the com.ibm.team.repository.client package Sam |
Hi,
You can use the IProjectArea#getReadAccessList() method, then fetch that item handle, then use the IReadAccessList#addContributors() method, then save that modified read access list. If you don't actually need them to be on the access list specifically, you can also just use IProcessArea#addMember(). I don't think you will be able to assign a role to a user who is on the access list but not a member of the project anyways. Unfortunately there isn't a public API way to add a role to a user via the client libraries. However, there is a REST service that allows you to. Check out https://jazz.net/wiki/bin/view/Main/DraftTeamProcessRestApi#Role_Assignments_collection. Hope that helps. Parker Jazz Foundation | Process team |
Hello,
Use teamRepository.itemManager() to get an IItemManager. Then, call IItemManager.fetchCompleteItem(ACLHandle, flags, progressMonitor) to get the full access list item. Martha Jazz Developer, Process team Thank you Parker for your reply. Unfortunately I have another issue: |
Thank you Martha :) Hi krzysztofkazmierczyk, If you want to modify an IItem, you have to use its workingCopy, e.g. IReadAccessList readAccessList = (IReadAccessList) teamRepository.itemManager().fetchCompleteItem(aCLhandle, IItemManager.DEFAULT, null).getWorkingCopy(); Kevin Jazz Foundation Process Team |
Hello, Hi, Get IProcessItemService and then use it to save your changes. IProcessItemService processItemService = (IProcessItemService) teamRepository.getClientLibrary(IProcessItemService.class); processItemService ().save(readAccessList, null); Kevin Jazz Foundation Process Team |
Thank you Parker for your reply. Unfortunately I have another issue:
I know how to fetch IReadAccessListHandle but I do not have any idea how I can retrieve object of type IReadAccessList. Here is my code:
Ho to retrieve IReadAccessList object? |
Thank you Martha :)
Now I believe have the last issue. Here is my code:
Now, I get following exception in the last line: Exception in thread "main" com.ibm.team.repository.common.internal.ImmutablePropertyException What is wrong with my code? |
Hello,
I used workingCopy now, but the changes are not applied. IReadAccessList does not contain save() method. How I should apply the changes after adding to access list? |
|
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.