Package jetbrains.buildServer.users
Interface UserModel
-
- All Known Subinterfaces:
UserModelEx
- All Known Implementing Classes:
SecuredUserModel,UserModelImpl
public interface UserModelManager of various user-oriented operations in TeamCity
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidaddListener(UserModelListener listener)Adds listener to the user modelSUsercreateUserAccount(String realm, String username)Deprecated.SUserfindUserAccount(String realm, String username)Searches for a user account with specified realm and usernameSUserfindUserAccount(String realm, String username, String password)Searches for a user account with specified realm, username and passwordSUserfindUserById(long userId)Searches for a user by id in the current login domain.SUserfindUserByUsername(String username, AuthPropertyKey usernamePropertyKey)Looks for a TeamCity user with the specified username.Collection<SUser>findUsersByIds(Collection<Long> userIds)Searches for users with specified ids, returns collection of existing users only.UserSet<SUser>findUsersByPropertyValue(PropertyKey propertyKey, String propertyValue, boolean caseSensitive)Returns UserSet of users having specified property in the profile.UserSet<SUser>getAllUsers()Returns all of the registered usersSUsergetGuestUser()Returns guest userintgetNumberOfRegisteredUsers()Returns number of users currently registered in the system.SUsergetSuperUser()Returns Super userbooleanhasAdministratorAccount()Returns true if there is at least one administrator that can be authenticated by specified login module.booleanisGuestUser(User user)Returns true if the specified user is guestbooleanisSuperUser(User user)Returns true if the specified user is Super uservoidremoveListener(UserModelListener listener)Removes listener from the user modelvoidremoveUserAccount(long userId)Removes user account from database.
-
-
-
Method Detail
-
createUserAccount
@Deprecated SUser createUserAccount(@Nullable String realm, String username) throws DuplicateUserAccountException, MaxNumberOfUserAccountsReachedException, EmptyUsernameException
Deprecated.Creates a new user.- Parameters:
realm- realm realm is always ignored. Pass null hereusername- username- Returns:
- newly created user
- Throws:
DuplicateUserAccountException- if user with specified username already exists in specified realmMaxNumberOfUserAccountsReachedException- thrown is maximum number of user accounts reachedEmptyUsernameException- 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
-
findUsersByIds
@NotNull Collection<SUser> findUsersByIds(@NotNull Collection<Long> userIds)
Searches for users with specified ids, returns collection of existing users only.- Parameters:
userIds- user ids- Returns:
- collection of found users
- Since:
- 8.0.7
-
findUserAccount
@Nullable SUser findUserAccount(@Nullable String realm, @NotNull String username)
Searches for a user account with specified realm and username- Parameters:
realm- realm is always ignored. Pass null here.username- username- Returns:
- found user or null
-
findUserAccount
@Nullable SUser findUserAccount(@Nullable String realm, @NotNull String username, @NotNull String password)
Searches for a user account with specified realm, username and password- Parameters:
realm- realm is always ignored. Pass null here.username- usernamepassword- user password- Returns:
- found user or null
-
findUsersByPropertyValue
UserSet<SUser> findUsersByPropertyValue(PropertyKey propertyKey, 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 keypropertyValue- property valuecaseSensitive- whether to perform case sensitive search- Returns:
- set of users having the value with specified key in the profile
-
findUserByUsername
@Nullable SUser findUserByUsername(@NotNull String username, @NotNull AuthPropertyKey usernamePropertyKey) throws InvalidUsernameException
Looks for a TeamCity user with the specified username. Username is searched as a value of the specified user property and as an account's username itself (property has higher priority).- Parameters:
username- username to searchusernamePropertyKey- user property key to search username as a value of; it is assumed that no more than one user can have the specified username as a value of this property- Returns:
- user with the specified username being the value of the specified user property or, if not found, user with the same TeamCity username as the specified one and empty value of the specified user property or, if not found, null
- Throws:
InvalidUsernameException-- if user with the specified username being the value of the specified user property does not exist and user with the same TeamCity username as the specified one exists and his/her value of the specified user property is not empty
- if several users match the search
- Since:
- 8.0
-
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
-
isSuperUser
boolean isSuperUser(@NotNull User user)Returns true if the specified user is Super user- Parameters:
user- user to check- Returns:
- true if user is Super user
- Since:
- 8.0
-
getSuperUser
@NotNull SUser getSuperUser()
Returns Super user- Returns:
- Super user
- Since:
- 8.0
-
-