public class UserService
extends java.lang.Object
| Constructor and Description |
|---|
UserService(ContentManagementSystem contentManagementSystem) |
| Modifier and Type | Method and Description |
|---|---|
Role |
createNewRole(java.lang.String roleName) |
User |
createNewUser(java.lang.String loginName,
java.lang.String password)
Create a new user.
|
void |
deleteRole(Role role) |
Role[] |
getAllRoles() |
User[] |
getAllUsers() |
User[] |
getAllUsersWithRole(Role role) |
Role |
getRole(int roleId) |
Role |
getRole(java.lang.String roleName) |
User |
getUser(int userId) |
User |
getUser(java.lang.String userLoginName) |
java.util.List<User> |
getUsersWithRole(Role role) |
void |
saveRole(Role role) |
void |
saveUser(User user) |
void |
sendPasswordReminderMail(User user,
java.lang.String fromAddress,
java.lang.String subject,
java.lang.String body,
java.lang.String bodyPasswordPlaceHolderRegex)
Send a password reminder mail
|
void |
updateUserSession(User user) |
public UserService(ContentManagementSystem contentManagementSystem)
public User[] getAllUsers() throws NoPermissionException
NoPermissionExceptionpublic User getUser(int userId)
userId - public User getUser(java.lang.String userLoginName)
userLoginName - public Role[] getAllRoles() throws NoPermissionException
NoPermissionExceptionpublic Role getRole(int roleId)
public Role getRole(java.lang.String roleName)
public void deleteRole(Role role) throws NoPermissionException
NoPermissionExceptionpublic User[] getAllUsersWithRole(Role role) throws NoPermissionException
NoPermissionExceptionpublic Role createNewRole(java.lang.String roleName)
public void saveRole(Role role) throws NoPermissionException, SaveException
NoPermissionException - unless superadmin.AlreadyExistsException - if another role with the same name exists.SaveException - if the name is too long.public User createNewUser(java.lang.String loginName, java.lang.String password)
saveUser(User).loginName - The user's login namepassword - The user's passwordpublic void saveUser(User user) throws NoPermissionException, SaveException
NoPermissionExceptionSaveExceptionpublic void updateUserSession(User user)
public void sendPasswordReminderMail(User user, java.lang.String fromAddress, java.lang.String subject, java.lang.String body, java.lang.String bodyPasswordPlaceHolderRegex) throws MailException
user - The user to send mail tofromAddress - The address to send fromsubject - The subject of the mailbody - The body of the mail, containing a placeholder for the passwordbodyPasswordPlaceHolderRegex - Is replaced with the password in the body.MailException