Difference between revisions of "UserManagement Core"
(→User Management) |
(→UserManager APIs) |
||
Line 49: | Line 49: | ||
* @throws UserManagementSystemException | * @throws UserManagementSystemException | ||
*/ | */ | ||
− | GCubeUser createdUser = userManager.createUser(autoScreenName, username, email, firstName, middleName, lastName, jobTitle, locationIndustry, | + | GCubeUser createdUser = userManager.createUser(autoScreenName, username, email, firstName, middleName, lastName, |
− | backgroundSummary, male, reminderQuestion, reminderAnswer, sendEmail, forcePasswordReset, portraitBytes); | + | jobTitle, locationIndustry, backgroundSummary, male, reminderQuestion, reminderAnswer, |
+ | sendEmail, forcePasswordReset, portraitBytes); | ||
// or maybe you want to retrieve information about an existing user | // or maybe you want to retrieve information about an existing user | ||
Line 56: | Line 57: | ||
// delete user | // delete user | ||
− | userManager.deleteUserByEMail( | + | userManager.deleteUserByEMail(validUserMail); |
</source> | </source> | ||
+ | |||
+ | The UserManager offers a lot of other utilities. They are reported below: | ||
+ | |||
+ | * create user methods; | ||
+ | * delete user from liferay; | ||
+ | * get user information such as email, id, screename, professional information, fullname and much more; | ||
+ | * list all the users; | ||
+ | * list users belonging to a given group. | ||
=== GroupManager APIs=== | === GroupManager APIs=== | ||
=== RoleManager APIs=== | === RoleManager APIs=== |
Revision as of 19:00, 2 May 2016
Contents
User Management
Introduction
User Management is a library that sits between the Liferay portal services and gCube portlets. The main functionality of the Library is to provide management of users, roles and organizations. It provides a layer of abstraction above the liferay services, hiding the configuration complexities of roles and organizations. The gcube requirement of roles in the scope of organization is achieved by creating a role with the organization name suffixed to it. The addition/removal of organization names to the role names are handled by the Library and are transparent to the application and portlets using the library.
Interfaces
The library exposes three interfaces:
- User Manager
- Role Manager
- Group(Organization) Manager
These interfaces provide the functionalities necessary for CRUD operation on Users, Roles and Organizations and additional functionalities that organise users into Organizations and assigning/dismissal of roles.
Maven Dependency
Add the following dependency to your maven project to use the library.
<dependency> <groupId>org.gcube.dvos</groupId> <artifactId>usermanagement-core</artifactId> <version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version> <scope>provided</scope> </dependency>
UserManager APIs
The UserManager interface allows to create, retrieve and delete users. In order to perform such operations you need to instanciate the proper manager. See the below example.
// Instanciate the manager UserManager userManager = new LiferayUserManager(); /* * Create the user and let you choose if you want to send him/her a mail notification and force or not the user to change * his/her password. * You can also pass the avatar to set as bytes. * @param autoScreenName set true if you want liferay to auto generate a screename for this user, false otherwise * @param username the username of the user you want * @param email a valid email address * @param firstName * @param middleName * @param lastName * @param jobTitle * @param backgroundSummary * @param male * @param portraitBytes the bytes of the avatar to use for the user * @param openId user's openId * @return an instance of the yet created user * @throws UserManagementSystemException */ GCubeUser createdUser = userManager.createUser(autoScreenName, username, email, firstName, middleName, lastName, jobTitle, locationIndustry, backgroundSummary, male, reminderQuestion, reminderAnswer, sendEmail, forcePasswordReset, portraitBytes); // or maybe you want to retrieve information about an existing user GCubeUser userByMail = userManager.getUserByEmail(validUserMail); // delete user userManager.deleteUserByEMail(validUserMail);
The UserManager offers a lot of other utilities. They are reported below:
- create user methods;
- delete user from liferay;
- get user information such as email, id, screename, professional information, fullname and much more;
- list all the users;
- list users belonging to a given group.