It's all about the answers!

Ask a question

Difficulty in setting visibility of a component to access group


Prajakta Kalyankar (11) | asked Mar 28 '17, 6:52 a.m.

 Hi,

I am trying to change visibility of a component to access group using setComponentOwnerAndVisibility() method of IWorkspaceManager.  
1. I have created access group using: 
IAccessGroupClientService clientService = (IAccessGroupClientService) repo.getClientLibrary(IAccessGroupClientService.class); 
IWorkItemCommon workItemCommon = (IWorkItemCommon)repo.getClientLibrary(IWorkItemCommon.class); 
IAccessGroup accessGroup = (IAccessGroup) workItemCommon.getAuditableCommon().createAuditable(IAccessGroup.ITEM_TYPE); 
accessGroup.setName("Test_AccessGroup_1"); 

2. Added required team areas to this access group:
accessGroup.add(team, ReadAccessContextType.MEMBERS);  
   
3. Setting visibility of a  component using: 
wm.setComponentOwnerAndVisibility(component, owner, (IReadScope) IReadScope.FACTORY.createAccessGroupScope(accessGroup), monitor); 

But getting  java.lang.IllegalArgumentException for this method
java.lang.IllegalArgumentException
at com.ibm.team.repository.common.model.impl.ItemTypeImpl.createItemHandle(ItemTypeImpl.java:151)
at com.ibm.team.scm.common.internal.dto.impl.AccessGroupScopeImpl.setAccessGroupId(AccessGroupScopeImpl.java:226)
at com.ibm.team.scm.common.dto.IReadScope$1.createAccessGroupScope(IReadScope.java:133)
Anyone has any clue?

One answer



permanent link
Ralph Schoon (56.8k23642) | answered Mar 28 '17, 7:06 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 https://rsjazz.wordpress.com/2016/02/03/setting-access-control-permissions-for-scm-versionables/ explains the API for that. 


IPermissionContextProvider accessGroupContext = IPermissionContextProvider.FACTORY.create(accessGroupHandle);
    
provides the context.

Your answer


Register or to post your answer.