This service encapsulates the management of people and groups. People and groups may be managed entirely in the repository or entirely in some other implementation such as LDAP. Some properties may be in the repository and some in another store. Individual properties may or may not be mutable.
The PersonService supports various methods relating to users. The methods relating to the Person service include the ability to:
- Look up people from usernames
- Create user information
- Delete user information
- Modify user information
Create a user that can login/authenticate with password:
if (serviceRegistry.getAuthenticationService().authenticationExists(userName) == false) { serviceRegistry.getAuthenticationService().createAuthentication(userName, password.toCharArray()); Map user = new Map(); user.put(ContentModel.PROP_USERNAME, userName); user.put(ContentModel.PROP_FIRSTNAME, "firstName"); user.put(ContentModel.PROP_LASTNAME, "lastName"); user.put(ContentModel.PROP_EMAIL, userName+"@example.com"); user.put(ContentModel.PROP_JOBTITLE, "jobTitle"); NodeRef person = serviceRegistry.getPersonService().createPerson(user); }