com.atlassian.jira.bc.user
Class DefaultUserService

java.lang.Object
  extended by com.atlassian.jira.bc.user.DefaultUserService
All Implemented Interfaces:
UserService

public class DefaultUserService
extends java.lang.Object
implements UserService

Default implementation of UserService interface. Contains metohods to create/delete users hiding UserUtil internals.

Since:
v4.0

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.jira.bc.user.UserService
UserService.CreateUserValidationResult, UserService.DeleteUserValidationResult, UserService.FieldName
 
Constructor Summary
DefaultUserService(UserUtil userUtil, PermissionManager permissionManager, ApplicationProperties applicationProperties)
           
 
Method Summary
 com.opensymphony.user.User createUser(UserService.CreateUserValidationResult result)
          Given a valid validation result, this will create the user using the details provided in the validation result.
 com.opensymphony.user.User createUserForSignup(UserService.CreateUserValidationResult result)
          Given a valid validation result, this will create the user using the details provided in the validation result.
 com.opensymphony.user.User createUserNoEvent(UserService.CreateUserValidationResult result)
          Given a valid validation result, this will create the user using the details provided in the validation result.
 void removeUser(com.opensymphony.user.User user, UserService.DeleteUserValidationResult result)
          Given a valid validation result, this will remove the user and removes the user from all the groups.
 UserService.CreateUserValidationResult validateCreateUserForAdmin(com.opensymphony.user.User user, java.lang.String username, java.lang.String password, java.lang.String confirmPassword, java.lang.String email, java.lang.String fullname)
          Validates creating a user for the admin section.
 UserService.CreateUserValidationResult validateCreateUserForAdminPasswordRequired(com.opensymphony.user.User user, java.lang.String username, java.lang.String password, java.lang.String confirmPassword, java.lang.String email, java.lang.String fullname)
          Validates creating a user for RPC calls.
 UserService.CreateUserValidationResult validateCreateUserForSignupOrSetup(com.opensymphony.user.User user, java.lang.String username, java.lang.String password, java.lang.String confirmPassword, java.lang.String email, java.lang.String fullname)
          Validates creating a user during setup of JIRA or during public signup.
 UserService.DeleteUserValidationResult validateDeleteUser(com.opensymphony.user.User loggedInUser, java.lang.String username)
          Validates removing a user for the admin section.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultUserService

public DefaultUserService(UserUtil userUtil,
                          PermissionManager permissionManager,
                          ApplicationProperties applicationProperties)
Method Detail

validateCreateUserForSignupOrSetup

public UserService.CreateUserValidationResult validateCreateUserForSignupOrSetup(com.opensymphony.user.User user,
                                                                                 java.lang.String username,
                                                                                 java.lang.String password,
                                                                                 java.lang.String confirmPassword,
                                                                                 java.lang.String email,
                                                                                 java.lang.String fullname)
Description copied from interface: UserService
Validates creating a user during setup of JIRA or during public signup. This method checks that external user management is disabled. It also validates that all parameters (username, email, fullname, password) have been provided. Email is also checked to ensure that it is a valid email address. The username is required to be lowercase characters only and unique. The confirmPassword has to match the password provided.

This validation differs from the 'ForAdminPasswordRequired' and 'ForAdmin' validations as follows:


validateCreateUserForAdminPasswordRequired

public UserService.CreateUserValidationResult validateCreateUserForAdminPasswordRequired(com.opensymphony.user.User user,
                                                                                         java.lang.String username,
                                                                                         java.lang.String password,
                                                                                         java.lang.String confirmPassword,
                                                                                         java.lang.String email,
                                                                                         java.lang.String fullname)
Description copied from interface: UserService
Validates creating a user for RPC calls. This method checks that external user management is disabled and that the user performing the operation has global admin rights. It also validates that all parameters (username, email, fullname, password) have been provided. Email is also checked to ensure that it is a valid email address. The username is required to be lowercase characters only and unique. The confirmPassword has to match the password provided.

This validation differs from the 'ForSetup' and 'ForAdmin' validations as follows:


validateCreateUserForAdmin

public UserService.CreateUserValidationResult validateCreateUserForAdmin(com.opensymphony.user.User user,
                                                                         java.lang.String username,
                                                                         java.lang.String password,
                                                                         java.lang.String confirmPassword,
                                                                         java.lang.String email,
                                                                         java.lang.String fullname)
Description copied from interface: UserService
Validates creating a user for the admin section. This method checks that external user management is disabled and that the user performing the operation has global admin rights. It also validates that all parameters (username, email, fullname) except for the password have been provided. Email is also checked to ensure that it is a valid email address. The username is required to be lowercase characters only and unique. The confirmPassword has to match the password provided.

This validation differs from the 'ForSetup' and 'ForAdminPasswordRequired' validations as follows:

Specified by:
validateCreateUserForAdmin in interface UserService
Parameters:
user - The remote user trying to add a new user
username - The username of the new user. Needs to be lowercase and unique.
password - The password for the new user.
confirmPassword - The password confirmation. Needs to match password.
email - The email for the new user. Needs to be a valid email address.
fullname - The full name for the new user
Returns:
a validation result containing appropriate errors or the new user's details

createUserNoEvent

public com.opensymphony.user.User createUserNoEvent(UserService.CreateUserValidationResult result)
                                             throws com.opensymphony.user.ImmutableException,
                                                    com.opensymphony.user.DuplicateEntityException
Description copied from interface: UserService
Given a valid validation result, this will create the user using the details provided in the validation result. No email notification will be send to created user.

Specified by:
createUserNoEvent in interface UserService
Parameters:
result - The validation result
Returns:
The new user object that was created
Throws:
com.opensymphony.user.ImmutableException - Generic exception ocurred when creating the user
com.opensymphony.user.DuplicateEntityException - User with this username alread exists

createUserForSignup

public com.opensymphony.user.User createUserForSignup(UserService.CreateUserValidationResult result)
                                               throws com.opensymphony.user.ImmutableException,
                                                      com.opensymphony.user.DuplicateEntityException
Description copied from interface: UserService
Given a valid validation result, this will create the user using the details provided in the validation result. Email notification will be send to created user - via UserEventType.USER_SIGNUP event.

Specified by:
createUserForSignup in interface UserService
Parameters:
result - The validation result
Returns:
The new user object that was created
Throws:
com.opensymphony.user.ImmutableException - Generic exception ocurred when creating the user
com.opensymphony.user.DuplicateEntityException - User with this username alread exists

createUser

public com.opensymphony.user.User createUser(UserService.CreateUserValidationResult result)
                                      throws com.opensymphony.user.ImmutableException,
                                             com.opensymphony.user.DuplicateEntityException
Description copied from interface: UserService
Given a valid validation result, this will create the user using the details provided in the validation result. Email notification will be send to created user - via UserEventType.USER_CREATED event.

Specified by:
createUser in interface UserService
Parameters:
result - The validation result
Returns:
The new user object that was created
Throws:
com.opensymphony.user.ImmutableException - Generic exception ocurred when creating the user
com.opensymphony.user.DuplicateEntityException - User with this username alread exists

validateDeleteUser

public UserService.DeleteUserValidationResult validateDeleteUser(com.opensymphony.user.User loggedInUser,
                                                                 java.lang.String username)
Description copied from interface: UserService
Validates removing a user for the admin section. This method checks that external user management is disabled and that the user performing the operation has global admin rights. It also validates that username have been provided. Removing the user is not allowed if:

Specified by:
validateDeleteUser in interface UserService
Parameters:
loggedInUser - The remote user trying to remove an user
username - The username of the user to remove. Needs to be valid
Returns:
a validation result containing appropriate errors or the user object for delete

removeUser

public void removeUser(com.opensymphony.user.User user,
                       UserService.DeleteUserValidationResult result)
Description copied from interface: UserService
Given a valid validation result, this will remove the user and removes the user from all the groups. All compoments lead by user will have lead cleared.

Specified by:
removeUser in interface UserService
Parameters:
user - the user to delete


Copyright © 2002-2011 Atlassian. All Rights Reserved.