Search Results for

    Show / Hide Table of Contents
    View Source

    Interface IUserRepository

    Represents a repository for IUser entities.

    Namespace: Umbraco.Cms.Core.Persistence.Repositories
    Assembly: Umbraco.Core.dll
    Syntax
    public interface IUserRepository : IReadWriteQueryRepository<Guid, IUser>, IReadRepository<Guid, IUser>, IWriteRepository<IUser>, IQueryRepository<IUser>, IRepository

    Methods

    View Source

    AddClientId(int, string)

    Adds a client identifier for a user.

    Declaration
    void AddClientId(int id, string clientId)
    Parameters
    Type Name Description
    int id

    The user identifier.

    string clientId

    The client identifier to add.

    View Source

    ClearLoginSession(Guid)

    Clears a specific login session.

    Declaration
    void ClearLoginSession(Guid sessionId)
    Parameters
    Type Name Description
    Guid sessionId

    The session identifier.

    View Source

    ClearLoginSessions(int)

    Clears all login sessions for a user.

    Declaration
    int ClearLoginSessions(int userId)
    Parameters
    Type Name Description
    int userId

    The user identifier.

    Returns
    Type Description
    int

    The number of sessions cleared.

    View Source

    ClearLoginSessions(TimeSpan)

    Clears login sessions older than the specified timespan.

    Declaration
    int ClearLoginSessions(TimeSpan timespan)
    Parameters
    Type Name Description
    TimeSpan timespan

    The timespan after which sessions are considered stale.

    Returns
    Type Description
    int

    The number of sessions cleared.

    View Source

    CreateLoginSession(int?, string, bool)

    Creates a login session for a user.

    Declaration
    Guid CreateLoginSession(int? userId, string requestingIpAddress, bool cleanStaleSessions = true)
    Parameters
    Type Name Description
    int? userId

    The user identifier.

    string requestingIpAddress

    The IP address of the requesting client.

    bool cleanStaleSessions

    Whether to clean stale sessions.

    Returns
    Type Description
    Guid

    The unique identifier of the created session.

    View Source

    ExistsByLogin(string)

    Checks whether a user with the specified login exists.

    Declaration
    bool ExistsByLogin(string login)
    Parameters
    Type Name Description
    string login

    The login to check for.

    Returns
    Type Description
    bool

    true if a user with the login exists; otherwise, false.

    View Source

    ExistsByUserName(string)

    Checks whether a user with the specified username exists.

    Declaration
    bool ExistsByUserName(string username)
    Parameters
    Type Name Description
    string username

    The username to check for.

    Returns
    Type Description
    bool

    true if a user with the username exists; otherwise, false.

    View Source

    Get(int)

    Returns a user by their integer identifier.

    Declaration
    IUser? Get(int id)
    Parameters
    Type Name Description
    int id

    The user identifier.

    Returns
    Type Description
    IUser

    A cached IUser instance if found; otherwise, null.

    View Source

    Get(int?, bool)

    Returns a user by their integer identifier.

    Declaration
    IUser? Get(int? id, bool includeSecurityData)
    Parameters
    Type Name Description
    int? id

    The user identifier.

    bool includeSecurityData

    This is only used for a shim in order to upgrade to 7.7.

    Returns
    Type Description
    IUser

    A non cached IUser instance if found; otherwise, null.

    View Source

    GetAllClientIds()

    Gets all client identifiers.

    Declaration
    IEnumerable<string> GetAllClientIds()
    Returns
    Type Description
    IEnumerable<string>

    A collection of client identifiers.

    View Source

    GetAllInGroup(int)

    Gets a list of IUser objects associated with a given group

    Declaration
    IEnumerable<IUser> GetAllInGroup(int groupId)
    Parameters
    Type Name Description
    int groupId

    Id of group

    Returns
    Type Description
    IEnumerable<IUser>
    View Source

    GetAllNotInGroup(int)

    Gets a list of IUser objects not associated with a given group

    Declaration
    IEnumerable<IUser> GetAllNotInGroup(int groupId)
    Parameters
    Type Name Description
    int groupId

    Id of group

    Returns
    Type Description
    IEnumerable<IUser>
    View Source

    GetByClientId(string)

    Gets a user by their client identifier.

    Declaration
    IUser? GetByClientId(string clientId)
    Parameters
    Type Name Description
    string clientId

    The client identifier.

    Returns
    Type Description
    IUser

    The user if found; otherwise, null.

    View Source

    GetByUsername(string, bool)

    Returns a user by their username.

    Declaration
    IUser? GetByUsername(string username, bool includeSecurityData)
    Parameters
    Type Name Description
    string username

    The username to find the user by.

    bool includeSecurityData

    This is only used for a shim in order to upgrade to 7.7.

    Returns
    Type Description
    IUser

    A non cached IUser instance if found; otherwise, null.

    View Source

    GetClientIds(int)

    Gets all client identifiers for a user.

    Declaration
    IEnumerable<string> GetClientIds(int id)
    Parameters
    Type Name Description
    int id

    The user identifier.

    Returns
    Type Description
    IEnumerable<string>

    A collection of client identifiers.

    View Source

    GetCountByQuery(IQuery<IUser>?)

    Gets the count of users matching the specified query.

    Declaration
    int GetCountByQuery(IQuery<IUser>? query)
    Parameters
    Type Name Description
    IQuery<IUser> query

    The query to filter users by, or null to count all users.

    Returns
    Type Description
    int

    The number of users matching the query.

    View Source

    GetForUpgrade(int)

    Gets a user for upgrade purposes; this will only return a result if the current runtime state is upgrade.

    Declaration
    IUser? GetForUpgrade(int id)
    Parameters
    Type Name Description
    int id

    The identifier to find the user by.

    Returns
    Type Description
    IUser

    An uncached IUser instance if found; otherwise, null.

    Remarks

    This only resolves the minimum amount of fields required to authorize for an upgrade. We need this to be able to add new columns to the user table.

    View Source

    GetForUpgradeByEmail(string)

    Gets a user by email for upgrade purposes; this will only return a result if the current runtime state is upgrade.

    Declaration
    IUser? GetForUpgradeByEmail(string email)
    Parameters
    Type Name Description
    string email

    The email to find the user by.

    Returns
    Type Description
    IUser

    An uncached IUser instance if found; otherwise, null.

    Remarks

    This only resolves the minimum amount of fields required to authorize for an upgrade. We need this to be able to add new columns to the user table.

    View Source

    GetForUpgradeByUsername(string)

    Gets a user by username for upgrade purposes; this will only return a result if the current runtime state is upgrade.

    Declaration
    IUser? GetForUpgradeByUsername(string username)
    Parameters
    Type Name Description
    string username

    The username to find the user by.

    Returns
    Type Description
    IUser

    An uncached IUser instance if found; otherwise, null.

    Remarks

    This only resolves the minimum amount of fields required to authorize for an upgrade. We need this to be able to add new columns to the user table.

    View Source

    GetPagedResultsByQuery(IQuery<IUser>?, long, int, out long, Expression<Func<IUser, object?>>, Direction, string[]?, string[]?, UserState[]?, UserKind[]?, IQuery<IUser>?)

    Gets a paged collection of users matching the specified query and filters, including a filter by user kind.

    Declaration
    IEnumerable<IUser> GetPagedResultsByQuery(IQuery<IUser>? query, long pageIndex, int pageSize, out long totalRecords, Expression<Func<IUser, object?>> orderBy, Direction orderDirection, string[]? includeUserGroups, string[]? excludeUserGroups, UserState[]? userState, UserKind[]? userKinds, IQuery<IUser>? filter = null)
    Parameters
    Type Name Description
    IQuery<IUser> query

    The base query to filter users by, or null for no base query.

    long pageIndex

    The zero-based page index.

    int pageSize

    The number of items per page.

    long totalRecords

    When this method returns, contains the total number of users matching the query.

    Expression<Func<IUser, object>> orderBy

    The expression to order the results by.

    Direction orderDirection

    The direction to order the results in.

    string[] includeUserGroups

    A filter to only include users that belong to these user groups.

    string[] excludeUserGroups

    A filter to only include users that do not belong to these user groups.

    UserState[] userState

    An optional filter to only include users in the specified states.

    UserKind[] userKinds

    An optional filter to only include users of the specified kinds.

    IQuery<IUser> filter

    An optional additional query to further filter the results.

    Returns
    Type Description
    IEnumerable<IUser>

    A paged enumerable of users matching the query.

    Remarks

    The default implementation delegates to the obsolete overload without user kind support, and therefore throws System.NotSupportedException if userKinds is supplied. Implementers must override this method to support filtering by user kind.

    View Source

    GetPagedResultsByQuery(IQuery<IUser>?, long, int, out long, Expression<Func<IUser, object?>>, Direction, string[]?, string[]?, UserState[]?, IQuery<IUser>?)

    Gets a paged collection of users matching the specified query and filters.

    Declaration
    [Obsolete("Please use the method overload with all parameters. Scheduled for removal in Umbraco 20.")]
    IEnumerable<IUser> GetPagedResultsByQuery(IQuery<IUser>? query, long pageIndex, int pageSize, out long totalRecords, Expression<Func<IUser, object?>> orderBy, Direction orderDirection = Direction.Ascending, string[]? includeUserGroups = null, string[]? excludeUserGroups = null, UserState[]? userState = null, IQuery<IUser>? filter = null)
    Parameters
    Type Name Description
    IQuery<IUser> query

    The base query to filter users by, or null for no base query.

    long pageIndex

    The zero-based page index.

    int pageSize

    The number of items per page.

    long totalRecords

    When this method returns, contains the total number of users matching the query.

    Expression<Func<IUser, object>> orderBy

    The expression to order the results by.

    Direction orderDirection

    The direction to order the results in.

    string[] includeUserGroups

    A filter to only include users that belong to these user groups.

    string[] excludeUserGroups

    A filter to only include users that do not belong to these user groups.

    UserState[] userState

    An optional filter to only include users in the specified states.

    IQuery<IUser> filter

    An optional additional query to further filter the results.

    Returns
    Type Description
    IEnumerable<IUser>

    A paged enumerable of users matching the query.

    View Source

    GetProfile(int)

    Gets a user profile by identifier.

    Declaration
    IProfile? GetProfile(int id)
    Parameters
    Type Name Description
    int id

    The user identifier.

    Returns
    Type Description
    IProfile

    The user profile if found; otherwise, null.

    View Source

    GetProfile(string)

    Gets a user profile by username.

    Declaration
    IProfile? GetProfile(string username)
    Parameters
    Type Name Description
    string username

    The username.

    Returns
    Type Description
    IProfile

    The user profile if found; otherwise, null.

    View Source

    GetUserStates()

    Gets the count of users grouped by their state.

    Declaration
    IDictionary<UserState, int> GetUserStates()
    Returns
    Type Description
    IDictionary<UserState, int>

    A dictionary mapping user states to their counts.

    View Source

    InvalidateSessionsForRemovedProviders(IEnumerable<string>)

    Invalidates sessions for users that aren't associated with the current collection of providers.

    Declaration
    void InvalidateSessionsForRemovedProviders(IEnumerable<string> currentLoginProviders)
    Parameters
    Type Name Description
    IEnumerable<string> currentLoginProviders

    The names of the currently configured providers.

    View Source

    RemoveClientId(int, string)

    Removes a client identifier from a user.

    Declaration
    bool RemoveClientId(int id, string clientId)
    Parameters
    Type Name Description
    int id

    The user identifier.

    string clientId

    The client identifier to remove.

    Returns
    Type Description
    bool

    true if the client identifier was removed; otherwise, false.

    View Source

    ValidateLoginSession(int, Guid)

    Validates a login session for a user.

    Declaration
    bool ValidateLoginSession(int userId, Guid sessionId)
    Parameters
    Type Name Description
    int userId

    The user identifier.

    Guid sessionId

    The session identifier.

    Returns
    Type Description
    bool

    true if the session is valid; otherwise, false.

    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX