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 if a user with the login exists

    Declaration
    bool ExistsByLogin(string login)
    Parameters
    Type Name Description
    string login
    Returns
    Type Description
    bool
    View Source

    ExistsByUserName(string)

    Checks if a user with the username exists

    Declaration
    bool ExistsByUserName(string username)
    Parameters
    Type Name Description
    string username
    Returns
    Type Description
    bool
    View Source

    Get(int)

    Returns a user by id

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

    A cached IUser instance

    View Source

    Get(int?, bool)

    Returns a user by id

    Declaration
    IUser? Get(int? id, bool includeSecurityData)
    Parameters
    Type Name Description
    int? id
    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

    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 username

    Declaration
    IUser? GetByUsername(string username, bool includeSecurityData)
    Parameters
    Type Name Description
    string username
    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

    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 items based on a complex query

    Declaration
    int GetCountByQuery(IQuery<IUser>? query)
    Parameters
    Type Name Description
    IQuery<IUser> query
    Returns
    Type Description
    int
    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 id to find the user by.

    Returns
    Type Description
    IUser

    An uncached IUser instance.

    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.

    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.

    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[]?, IQuery<IUser>?)

    Gets paged user results

    Declaration
    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
    long pageIndex
    int pageSize
    long totalRecords
    Expression<Func<IUser, object>> orderBy
    Direction orderDirection
    string[] includeUserGroups

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

    string[] excludeUserGroups

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

    UserState[] userState

    Optional parameter to filter by specified user state

    IQuery<IUser> filter
    Returns
    Type Description
    IEnumerable<IUser>
    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