com.imcode.imcms.api
Class UserService

java.lang.Object
  extended by com.imcode.imcms.api.UserService

public class UserService
extends java.lang.Object


Constructor Summary
UserService(ContentManagementSystem contentManagementSystem)
           
 
Method Summary
 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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserService

public UserService(ContentManagementSystem contentManagementSystem)
Method Detail

getAllUsers

public User[] getAllUsers()
                   throws NoPermissionException
Throws:
NoPermissionException

getUsersWithRole

public java.util.List<User> getUsersWithRole(Role role)

getUser

public User getUser(int userId)
Parameters:
userId -
Returns:
User with the specified id, or null if none.

getUser

public User getUser(java.lang.String userLoginName)
Parameters:
userLoginName -
Returns:
User with the specified login name, or null if none.

getAllRoles

public Role[] getAllRoles()
                   throws NoPermissionException
Throws:
NoPermissionException
Since:
2.0

getRole

public Role getRole(int roleId)
Since:
2.0

getRole

public Role getRole(java.lang.String roleName)
Since:
2.0

deleteRole

public void deleteRole(Role role)
                throws NoPermissionException
Throws:
NoPermissionException
Since:
2.0

getAllUsersWithRole

public User[] getAllUsersWithRole(Role role)
                           throws NoPermissionException
Throws:
NoPermissionException
Since:
2.0

createNewRole

public Role createNewRole(java.lang.String roleName)
Since:
2.0

saveRole

public void saveRole(Role role)
              throws NoPermissionException,
                     SaveException
Throws:
NoPermissionException - unless superadmin.
AlreadyExistsException - if another role with the same name exists.
SaveException - if the name is too long.
Since:
2.0

createNewUser

public User createNewUser(java.lang.String loginName,
                          java.lang.String password)
Create a new user. Don't forget to call saveUser(User).

Parameters:
loginName - The user's login name
password - The user's password
Returns:
A new user

saveUser

public void saveUser(User user)
              throws NoPermissionException,
                     SaveException
Throws:
NoPermissionException
SaveException

updateUserSession

public void updateUserSession(User user)

sendPasswordReminderMail

public void sendPasswordReminderMail(User user,
                                     java.lang.String fromAddress,
                                     java.lang.String subject,
                                     java.lang.String body,
                                     java.lang.String bodyPasswordPlaceHolderRegex)
                              throws MailException
Send a password reminder mail

Parameters:
user - The user to send mail to
fromAddress - The address to send from
subject - The subject of the mail
body - The body of the mail, containing a placeholder for the password
bodyPasswordPlaceHolderRegex - Is replaced with the password in the body.
Throws:
MailException