Package org.nuclos.api.provider
Class UserProvider
java.lang.Object
org.nuclos.api.provider.UserProvider
The
UserProvider provides several methods to create users and manipulate user role data- Author:
- reichama
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voiddelete(NuclosUser user) This method allows to delete a specific user account.static voidexpire(NuclosUser user, Date date) This method allows to define a date on which to expire a specific user account.static UIDgrantMandator(NuclosMandator mandator, NuclosUser user) This method assigns a mandator to a given user.static UIDgrantRole(Class<? extends NuclosRole> role, NuclosUser user) This method assigns a role to a given user.static UIDgrantRole(NuclosRole role, NuclosUser user) This method assigns a role to a given user.static UIDinsert(String username, String firstname, String lastname, String email, Boolean passwordChangeRequired) Deprecated.static UIDinsert(String username, String firstname, String lastname, String email, String password, Boolean passwordChangeRequired) Deprecated.static UIDinsert(NuclosUser user) This method creates a Nuclos User and returns the id of the new object.
A password will be generated and a default notification Email with the password will be send.
A new user does not have any roles and therefore does not have any rights in Nuclos.static UIDinsert(NuclosUser user, String password) This method creates a Nuclos User and returns the id of the new object.
Sends a default notification Email with the password.
A new user does not have any roles and therefore does not have any rights in Nuclos.static UIDinsert(NuclosUser user, String password, boolean sendNotification) This method creates a Nuclos User and returns the id of the new object.
A new user does not have any roles and therefore does not have any rights in Nuclos.static booleanisMandatorGranted(NuclosMandator mandator, NuclosUser user) This method checks if a mandator is granted to a given user.static voidresetPassword(NuclosUser user, String password, boolean sendNotification) This method resets the password for the given Nuclos User.static voidrevokeMandator(NuclosMandator mandator, NuclosUser user) This method revokes a mandator from a given user.static voidrevokeRole(Class<? extends NuclosRole> role, NuclosUser user) This method dispossesses a user of the given role.static voidrevokeRole(NuclosRole role, NuclosUser user) This method dispossesses a user of the given role.voidsetUserService(UserService repService) static voidupdate(NuclosUser user) This method updates the given Nuclos User.verifyPasswordResolveUser(String username, String password) verifyPasswordResolveUserId(String username, String password)
-
Constructor Details
-
UserProvider
public UserProvider()
-
-
Method Details
-
setUserService
-
insert
This method creates a Nuclos User and returns the id of the new object.
A password will be generated and a default notification Email with the password will be send.
A new user does not have any roles and therefore does not have any rights in Nuclos. Use method addRole() and removeRole() for modifications- Parameters:
user-- Returns:
- Throws:
BusinessException
-
insert
This method creates a Nuclos User and returns the id of the new object.
Sends a default notification Email with the password.
A new user does not have any roles and therefore does not have any rights in Nuclos. Use method addRole() and removeRole() for modifications- Parameters:
user-password- If no password is given, one will be generated. The same applies to the username.- Returns:
- Throws:
BusinessException
-
insert
public static UID insert(NuclosUser user, String password, boolean sendNotification) throws BusinessException This method creates a Nuclos User and returns the id of the new object.
A new user does not have any roles and therefore does not have any rights in Nuclos. Use method addRole() and removeRole() for modifications- Parameters:
user-password- If no password is given, one will be generated. The same applies to the username.sendNotification- Send a default notification Email with the password- Returns:
- Throws:
BusinessException
-
insert
@Deprecated public static UID insert(String username, String firstname, String lastname, String email, Boolean passwordChangeRequired) throws BusinessException Deprecated.Deprecated: Use the insert methods with NuclosUser This method creates a Nuclos User and returns the id of the new object. Password is created by Nuclos automatically. Afterwards a notification Email containing the password is sent to the user.
Note: A new user does not have any roles and therefore does not have any rights in Nuclos. Use method addRole() and removeRole() for modifications- Parameters:
username- , firstname, lastname, email, passwordChangeRequired- Returns:
- UID
- Throws:
BusinessException
-
insert
@Deprecated public static UID insert(String username, String firstname, String lastname, String email, String password, Boolean passwordChangeRequired) throws BusinessException Deprecated.Deprecated: Use the insert methods with NuclosUser This method creates a Nuclos User and returns the id of the new object. A password must be provided. Afterwards a notification Email containing the password is sent to the user.
Note: A new user does not have any roles and therefore does not have any rights in Nuclos. Use method addRole() and removeRole() for modifications- Parameters:
username- , firstname, lastname, email, password, passwordChangeRequired- Returns:
- UID
- Throws:
BusinessException
-
update
This method updates the given Nuclos User.- Parameters:
user-- Throws:
BusinessException
-
resetPassword
public static void resetPassword(NuclosUser user, String password, boolean sendNotification) throws BusinessException This method resets the password for the given Nuclos User.- Parameters:
user-password- If no password is given, one will be generated. The same applies to the username.sendNotification- Send a default notification Email with the password- Throws:
BusinessException
-
verifyPasswordResolveUserId
-
verifyPasswordResolveUser
-
grantRole
public static UID grantRole(Class<? extends NuclosRole> role, NuclosUser user) throws BusinessException This method assigns a role to a given user. The class of the user role is generated automatically and corresponds to an existing user role in Nuclos. TheNuclosUsercan be extracted by usingQueryProviderorBusinessObjectProvider- Parameters:
role-user-- Returns:
- Throws:
BusinessException
-
grantRole
This method assigns a role to a given user. TheNuclosUserandNuclosRolecan be extracted by usingQueryProviderorBusinessObjectProviderUse the classes org.nuclos.system.User and org.nuclos.system.Role- Parameters:
role-user-- Returns:
- Throws:
BusinessException
-
grantMandator
This method assigns a mandator to a given user. The class of the user mandator is generated automatically and corresponds to an existing mandator in Nuclos. TheNuclosMandatorcan be extracted by usingQueryProviderorBusinessObjectProvider- Parameters:
mandator-user-- Returns:
- Throws:
BusinessException
-
revokeMandator
public static void revokeMandator(NuclosMandator mandator, NuclosUser user) throws BusinessException This method revokes a mandator from a given user. The class of the user mandator is generated automatically and corresponds to an existing mandator in Nuclos. TheNuclosMandatorcan be extracted by usingQueryProviderorBusinessObjectProvider- Parameters:
mandator-user-- Throws:
BusinessException
-
isMandatorGranted
public static boolean isMandatorGranted(NuclosMandator mandator, NuclosUser user) throws BusinessException This method checks if a mandator is granted to a given user. The class of the user mandator is generated automatically and corresponds to an existing mandator in Nuclos. TheNuclosMandatorcan be extracted by usingQueryProviderorBusinessObjectProvider- Parameters:
mandator-user-- Returns:
- true if the Mandator is granted to the given user
- Throws:
BusinessException
-
revokeRole
public static void revokeRole(Class<? extends NuclosRole> role, NuclosUser user) throws BusinessException This method dispossesses a user of the given role. The class of the user role is generated automatically and corresponds to an existing user role in Nuclos. TheNuclosUsercan be extracted by usingQueryProviderorBusinessObjectProvider. If the user is not assigned to the role aBusinessExceptionis thrown.- Parameters:
role-user-- Throws:
BusinessException
-
revokeRole
This method dispossesses a user of the given role. The class of the user role is generated automatically and corresponds to an existing user role in Nuclos. TheNuclosUserandNuclosRolecan be extracted by usingQueryProviderorBusinessObjectProvider. Use the classes org.nuclos.system.User and org.nuclos.system.Role. If the user is not assigned to the role aBusinessExceptionis thrown.- Parameters:
role-user-- Throws:
BusinessException
-
expire
This method allows to define a date on which to expire a specific user account. TheNuclosUsercan be extracted by usingQueryProviderorBusinessObjectProvider.- Parameters:
user-date-- Throws:
BusinessException
-
delete
This method allows to delete a specific user account. TheNuclosUsercan be extracted by usingQueryProviderorBusinessObjectProvider.- Parameters:
user-- Throws:
BusinessException
-