You are looking at documentation for an older release. Not what you want? See the current release documentation.
How to create/remove a user and remove membership of a user.
How to create/update/remove a group.
How to assign a user to an existing group.
Setting auto-membership for users
How to set a membership for a newly created user.
Prerequisites
To use the OrganizationService API, you need to:
Create a Maven portlet project to follow the snippets in the next sub-sections.
Use two dependencies below:
<dependency>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>exo.kernel.container</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gatein.portal</groupId>
<artifactId>exo.portal.component.application-registry</artifactId>
<scope>provided</scope>
</dependency>
eXo Platform manages identification and authorization with the entities packaged in org.exoplatform.services.organization, including user, user profile, group, membership type (also known as "role"), and membership. See more about these entities in the Organization API.
You can take handlers corresponding to the entities by using OrganizationService
as follows:
/** .*/
private UserHandler userHandler;
/** .*/
private UserProfileHandler profileHandler;
/** .*/
private GroupHandler groupHandler;
/** .*/
private MembershipHandler membershipHandler;
/** .*/
private MembershipTypeHandler membershipTypeHandler;
@Override
public void init(PortletConfig config) throws PortletException{
super.init(config);
PortalContainer container = PortalContainer.getInstance();
OrganizationService orgService = (OrganizationService)container.getComponentInstanceOfType(OrganizationService.class);
userHandler = orgService.getUserHandler();
profileHandler = orgService.getUserProfileHandler();
groupHandler = orgService.getGroupHandler();
membershipHandler = orgService.getMembershipHandler();
membershipTypeHandler = orgService.getMembershipTypeHandler();
}