jetbrains.buildServer.users
Interface UserModel


public interface UserModel

Manager of various user-oriented operations in TeamCity


Method Summary
 void addListener(UserModelListener listener)
          Adds listener to the user model
 SUser createUserAccount(java.lang.String realm, java.lang.String username)
          Creates a new user.
 SUser findUserAccount(java.lang.String realm, java.lang.String username)
          Searches for a user account with specified realm and username
 SUser findUserAccount(java.lang.String realm, java.lang.String username, java.lang.String password)
          Searches for a user account with specified realm, username and password
 SUser findUserById(long userId)
          Searches for a user by id in the current login domain.
 UserSet<SUser> findUsersByPropertyValue(PropertyKey propertyKey, java.lang.String propertyValue, boolean caseSensitive)
          Returns UserSet of users having specified property in the profile.
 UserSet<SUser> getAllUsers()
          Returns all of the registered users
 SUser getGuestUser()
          Returns guest user
 int getNumberOfRegisteredUsers()
          Returns number of users currently registered in the system.
 boolean hasAdministratorAccount()
          Returns true if there is at least one administrator that can be authenticated by specified login module.
 boolean isGuestUser(User user)
          Returns true if the specified user is guest
 void removeListener(UserModelListener listener)
          Removes listener from the user model
 void removeUserAccount(long userId)
          Removes user account from database.
 

Method Detail

createUserAccount

SUser createUserAccount(java.lang.String realm,
                        java.lang.String username)
                        throws DuplicateUserAccountException,
                               MaxNumberOfUserAccountsReachedException,
                               EmptyUsernameException
Creates a new user.

Parameters:
realm - realm in which to create this user, can be null
username - username
Returns:
newly created user
Throws:
DuplicateUserAccountException - if user with specified username already exists in specified realm
MaxNumberOfUserAccountsReachedException - thrown is maximum number of user accounts reached
EmptyUsernameException - if username is an empty string

findUserById

@Nullable
SUser findUserById(long userId)
Searches for a user by id in the current login domain. Login domain is defined by currently selected login module.

Parameters:
userId - id of the user
Returns:
found user or null

findUserAccount

@Nullable
SUser findUserAccount(java.lang.String realm,
                               java.lang.String username)
Searches for a user account with specified realm and username

Parameters:
realm - can be null, in this case realm will not be considered when search is performed
username - username
Returns:
found user or null

findUserAccount

@Nullable
SUser findUserAccount(java.lang.String realm,
                               java.lang.String username,
                               java.lang.String password)
Searches for a user account with specified realm, username and password

Parameters:
realm - can be null
username - username
password - user password
Returns:
found user or null

findUsersByPropertyValue

UserSet<SUser> findUsersByPropertyValue(PropertyKey propertyKey,
                                        java.lang.String propertyValue,
                                        boolean caseSensitive)
Returns UserSet of users having specified property in the profile. UserSet collection will be sorted by account name.

Parameters:
propertyKey - property key
propertyValue - property value
caseSensitive - whether to perform case sensitive search
Returns:
set of users having the value with specified key in the profile

getAllUsers

UserSet<SUser> getAllUsers()
Returns all of the registered users

Returns:
all of the registered users

getNumberOfRegisteredUsers

int getNumberOfRegisteredUsers()
Returns number of users currently registered in the system.

Returns:
number of currently registered users

hasAdministratorAccount

boolean hasAdministratorAccount()
Returns true if there is at least one administrator that can be authenticated by specified login module.

Returns:
true if administrator account exists in the system

removeUserAccount

void removeUserAccount(long userId)
Removes user account from database.

Parameters:
userId - id of the user

addListener

void addListener(UserModelListener listener)
Adds listener to the user model

Parameters:
listener - listener to add

removeListener

void removeListener(UserModelListener listener)
Removes listener from the user model

Parameters:
listener - to remove

isGuestUser

boolean isGuestUser(@NotNull
                    User user)
Returns true if the specified user is guest

Parameters:
user - user to check
Returns:
true if user is guest

getGuestUser

@NotNull
SUser getGuestUser()
Returns guest user

Returns:
guest user