To assign users to Collaboration project roles from a remote application, use the IRole interface in the IDK.
The IProject.getRole method takes in the role type (guest, member or leader) and returns the associated IRole object for the project. To define roles for a project, follow the steps below.
Java
... //get the project IProjectManager projectManager = getProjectManager(request, response, out); IProject project = projectManager.getProject(projectID); //get the guest role for the project IRole guestrole = project.getRole(RoleType.GUEST); //add the guests from a community and an individual user to the role guestrole.addCommunityMember(CommunityID, COMMUNITY_GUEST); guestrole.addMember(UserID, USER); //set the access level for discussions to write guestrole.setAccessLevel(FunctionalArea.DISCUSSION, AccessLevel.WRITE); //call store to persist the changes guestrole.store() ...
.NET (C#)
... //get the project Plumtree.Remote.PRC.Collaboration.Project.IProjectManager projectManager = GetProjectManager(Request, Response); IProject project = GetProject(projectID); //get the guest role for the project IRole guestrole = project.GetRole(RoleTypes.Guest); //add the guests from a community and an individual user to the role guestrole.AddCommunityMember(CommunityID, CommunityGuest); guestrole.AddMember(UserID, User); //set the access level for discussions to write guestrole.SetAccessLevel(FunctionalAreas.Discussion, AccessLevels.Write); //call store to persist the changes guestrole.Store(); ...
.NET (VB)
... //get the project dim projectManager As Plumtree.Remote.PRC.Collaboration.Project.IProjectManager = GetProjectManager(Request, Response) dim project As IProject = GetProject(projectID) //get the guest role for the project dim guestrole As IRole = project.GetRole(RoleTypes.Guest) //add the guests from a community and an individual user to the role guestrole.AddCommunityMember(CommunityID, CommunityGuest) guestrole.AddMember(UserID, User) //set the access level for discussions to write guestrole.SetAccessLevel(FunctionalAreas.Discussion, AccessLevels.Write) //call store to persist the changes guestrole.Store() ...