com.atlassian.core.user
Class UserUtils

java.lang.Object
  extended by com.atlassian.core.user.UserUtils

Deprecated. Use UserUtils instead. Since v4.4.

public class UserUtils
extends Object

A utility class for operating on users.

See Also:
GroupUtils

Constructor Summary
UserUtils()
          Deprecated.  
 
Method Summary
static void changePassword(User user, String password)
          Deprecated. Changes the password for a given user.
static User createUser(String username, String email)
          Deprecated. This method is used when a user is created automatically, or by another user (for example an administrator).
static User createUser(String username, String email, String fullname)
          Deprecated. This method is used when a user is created automatically, or by another user (for example an administrator).
static User createUser(String username, String password, String email, String fullname)
          Deprecated. Generic method which actually creates users, and fires the given event.
static User createUser(String username, String password, String email, String fullname, Collection groups)
          Deprecated. Creates a new user with given attributes and associates the user with given collection of groups.
static boolean existsUser(String username)
          Deprecated. Checks if a user with given username exists.
static Collection getAllUsers()
          Deprecated.  
static User getUser(String username)
          Deprecated. Retrieves and returns the user by given username.
static User getUserByEmail(String email)
          Deprecated. Return the first user found that matches thie email address.
static Collection getUsers(Collection groups)
          Deprecated. Get a list of users in a set of groups (either Group objects or String group names)
static List getUsersByEmail(String email)
          Deprecated. Finds the users by the given e-mail address.
static void removeUser(User user)
          Deprecated. Removes the given user.
static String resetPassword(User user)
          Deprecated. For a user, create a new password, and dispatch an 'forgot password' event
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserUtils

public UserUtils()
Deprecated. 
Method Detail

getUser

public static User getUser(String username)
                    throws EntityNotFoundException
Deprecated. 
Retrieves and returns the user by given username. If such user does not exist throws EntityNotFoundException.

Parameters:
username - usename to lookup
Returns:
user looked up by the given username
Throws:
EntityNotFoundException - if user with given username not found

existsUser

public static boolean existsUser(String username)
Deprecated. 
Checks if a user with given username exists. Returns true if such user exists, false otherwise.

Parameters:
username - username to look up
Returns:
true if user found, false otherwise

getAllUsers

public static Collection getAllUsers()
Deprecated. 

getUserByEmail

public static User getUserByEmail(String email)
                           throws EntityNotFoundException
Deprecated. 
Return the first user found that matches thie email address. There may be many users with the same email address, and this method should not be used to return a single user.

The email address is matched case insensitive. This loops through all users, and so is a O(N) operation.

Parameters:
email - user email
Returns:
The first user that matches the email address
Throws:
EntityNotFoundException - if no user is found.

getUsersByEmail

public static List getUsersByEmail(String email)
Deprecated. 
Finds the users by the given e-mail address. E-mail address look-up is done case insensitively. Leading or trailing spaces in the given e-mail address are trimmed before look up.

Parameters:
email - e-mail address
Returns:
always returns a list of users found (even if empty)

getUsers

public static Collection getUsers(Collection groups)
Deprecated. 
Get a list of users in a set of groups (either Group objects or String group names)

Parameters:
groups - collection of groups (either Group objects or String group names)
Returns:
a collection of User objects

createUser

public static User createUser(String username,
                              String email)
                       throws DuplicateEntityException,
                              ImmutableException
Deprecated. 
This method is used when a user is created automatically, or by another user (for example an administrator). Should not be used for users signing themselves up.

This method will also generate an automatic random password for the user.

Parameters:
username - username
email - user's e-mail address
Returns:
newly created user
Throws:
DuplicateEntityException - if user already exists
ImmutableException - if setting the user's password fails

createUser

public static User createUser(String username,
                              String email,
                              String fullname)
                       throws DuplicateEntityException,
                              ImmutableException
Deprecated. 
This method is used when a user is created automatically, or by another user (for example an administrator). Should not be used for users signing themselves up.

This method will also generate an automatic random password for the user.

Parameters:
username - username
email - e-mail address
fullname - user's full name
Returns:
newly created user
Throws:
DuplicateEntityException - if user already exists
ImmutableException - if setting the user's password fails

createUser

public static User createUser(String username,
                              String password,
                              String email,
                              String fullname)
                       throws DuplicateEntityException,
                              ImmutableException
Deprecated. 
Generic method which actually creates users, and fires the given event.

Parameters:
username - username
password - password
email - e-mail address
fullname - user's full name
Returns:
newly created user
Throws:
DuplicateEntityException - if user already exists
ImmutableException - if setting the user's password fails

createUser

public static User createUser(String username,
                              String password,
                              String email,
                              String fullname,
                              Collection groups)
                       throws DuplicateEntityException,
                              ImmutableException
Deprecated. 
Creates a new user with given attributes and associates the user with given collection of groups.

Parameters:
username - username
password - passwod
email - e-mail address
fullname - user's full name
groups - group names (String objects) the user will belong to
Returns:
newly created user
Throws:
DuplicateEntityException - if user already exists
ImmutableException - if setting the user's password fails

removeUser

public static void removeUser(User user)
                       throws Exception
Deprecated. 
Removes the given user. A ImmutableException is thrown if given user cannot be removed.

Parameters:
user - user to remove
Throws:
Exception - if user cannot be removed

resetPassword

public static String resetPassword(User user)
                            throws ImmutableException
Deprecated. 
For a user, create a new password, and dispatch an 'forgot password' event

Parameters:
user - The user whose password needs to be reset.
Returns:
new password
Throws:
ImmutableException - if password cannot be changed

changePassword

public static void changePassword(User user,
                                  String password)
                           throws ImmutableException
Deprecated. 
Changes the password for a given user.

Parameters:
user - user to change password for
password - new password
Throws:
ImmutableException - if password cannot be changed


Copyright © 2002-2011 Atlassian. All Rights Reserved.