Interface UserModel

    • Method Detail

      • 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 - username
        password - 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 key
        propertyValue - property value
        caseSensitive - 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 search
        usernamePropertyKey - 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