Search Results for

    Show / Hide Table of Contents
    View Source

    Interface IExternalMemberService

    Defines the ExternalMemberService, which provides operations for managing external-only members that are not backed by the content system.

    Namespace: Umbraco.Cms.Core.Services
    Assembly: Umbraco.Core.dll
    Syntax
    public interface IExternalMemberService

    Methods

    View Source

    AssignRolesAsync(Guid, string[])

    Assigns roles to an external member.

    Declaration
    Task<Attempt<ExternalMemberIdentity?, ExternalMemberOperationStatus>> AssignRolesAsync(Guid memberKey, string[] roleNames)
    Parameters
    Type Name Description
    Guid memberKey

    The unique key of the external member.

    string[] roleNames

    The names of the roles to assign.

    Returns
    Type Description
    Task<Attempt<ExternalMemberIdentity, ExternalMemberOperationStatus>>

    An Attempt<TResult, TStatus> indicating the operation result.

    View Source

    ConvertToContentMemberAsync(Guid, string, Action<IMember, string?>?)

    Converts an external-only member to a full content-based member.

    Declaration
    Task<Attempt<IMember?, ExternalMemberOperationStatus>> ConvertToContentMemberAsync(Guid memberKey, string memberTypeAlias, Action<IMember, string?>? mapProfileData = null)
    Parameters
    Type Name Description
    Guid memberKey

    The unique key of the external member to convert.

    string memberTypeAlias

    The alias of the member type to use for the content-based member.

    Action<IMember, string> mapProfileData

    An optional callback invoked after the content member is created but before it is saved. Receives the new IMember and the external member's profileData JSON string, allowing the developer to map profile data fields to content properties (e.g. member.SetValue("department", ...)).

    Returns
    Type Description
    Task<Attempt<IMember, ExternalMemberOperationStatus>>

    An Attempt<TResult, TStatus> with the newly created IMember on success.

    View Source

    CreateAsync(ExternalMemberIdentity, IExternalLogin?)

    Creates a new external member.

    Declaration
    Task<Attempt<ExternalMemberIdentity, ExternalMemberOperationStatus>> CreateAsync(ExternalMemberIdentity member, IExternalLogin? externalLogin = null)
    Parameters
    Type Name Description
    ExternalMemberIdentity member

    The external member identity to create.

    IExternalLogin externalLogin

    An optional external login to associate with the member in the same transaction.

    Returns
    Type Description
    Task<Attempt<ExternalMemberIdentity, ExternalMemberOperationStatus>>

    An Attempt<TResult, TStatus> with the created member on success.

    View Source

    DeleteAsync(Guid)

    Deletes an external member by its unique key.

    Declaration
    Task<Attempt<ExternalMemberIdentity?, ExternalMemberOperationStatus>> DeleteAsync(Guid key)
    Parameters
    Type Name Description
    Guid key

    The unique key of the external member to delete.

    Returns
    Type Description
    Task<Attempt<ExternalMemberIdentity, ExternalMemberOperationStatus>>

    An Attempt<TResult, TStatus> with the deleted member on success, or a not-found status.

    View Source

    GetAllAsync(int, int)

    Gets a paged collection of all external members.

    Declaration
    Task<PagedModel<ExternalMemberIdentity>> GetAllAsync(int skip, int take)
    Parameters
    Type Name Description
    int skip

    The number of items to skip.

    int take

    The number of items to take.

    Returns
    Type Description
    Task<PagedModel<ExternalMemberIdentity>>

    A PagedModel<T> containing the external members.

    View Source

    GetByEmailAsync(string)

    Gets an external member by email address.

    Declaration
    Task<ExternalMemberIdentity?> GetByEmailAsync(string email)
    Parameters
    Type Name Description
    string email

    The email address to search for.

    Returns
    Type Description
    Task<ExternalMemberIdentity>

    The ExternalMemberIdentity if found; otherwise null.

    View Source

    GetByKeyAsync(Guid)

    Gets an external member by its unique key.

    Declaration
    Task<ExternalMemberIdentity?> GetByKeyAsync(Guid key)
    Parameters
    Type Name Description
    Guid key

    The unique identifier of the external member.

    Returns
    Type Description
    Task<ExternalMemberIdentity>

    The ExternalMemberIdentity if found; otherwise null.

    View Source

    GetByUsernameAsync(string)

    Gets an external member by username.

    Declaration
    Task<ExternalMemberIdentity?> GetByUsernameAsync(string username)
    Parameters
    Type Name Description
    string username

    The username to search for.

    Returns
    Type Description
    Task<ExternalMemberIdentity>

    The ExternalMemberIdentity if found; otherwise null.

    View Source

    GetRolesAsync(Guid)

    Gets the role names assigned to an external member.

    Declaration
    Task<IEnumerable<string>> GetRolesAsync(Guid memberKey)
    Parameters
    Type Name Description
    Guid memberKey

    The unique key of the external member.

    Returns
    Type Description
    Task<IEnumerable<string>>

    A collection of role names.

    View Source

    RemoveRolesAsync(Guid, string[])

    Removes roles from an external member.

    Declaration
    Task<Attempt<ExternalMemberIdentity?, ExternalMemberOperationStatus>> RemoveRolesAsync(Guid memberKey, string[] roleNames)
    Parameters
    Type Name Description
    Guid memberKey

    The unique key of the external member.

    string[] roleNames

    The names of the roles to remove.

    Returns
    Type Description
    Task<Attempt<ExternalMemberIdentity, ExternalMemberOperationStatus>>

    An Attempt<TResult, TStatus> indicating the operation result.

    View Source

    UpdateAsync(ExternalMemberIdentity)

    Updates an existing external member.

    Declaration
    Task<Attempt<ExternalMemberIdentity, ExternalMemberOperationStatus>> UpdateAsync(ExternalMemberIdentity member)
    Parameters
    Type Name Description
    ExternalMemberIdentity member

    The external member identity to update.

    Returns
    Type Description
    Task<Attempt<ExternalMemberIdentity, ExternalMemberOperationStatus>>

    An Attempt<TResult, TStatus> with the updated member on success.

    View Source

    UpdateLoginPropertiesAsync(ExternalMemberIdentity)

    Updates only the login-related properties of an external member via a lightweight direct SQL update.

    Declaration
    Task<Attempt<ExternalMemberIdentity, ExternalMemberOperationStatus>> UpdateLoginPropertiesAsync(ExternalMemberIdentity member)
    Parameters
    Type Name Description
    ExternalMemberIdentity member

    The external member identity carrying the new values for LastLoginDate and SecurityStamp.

    Returns
    Type Description
    Task<Attempt<ExternalMemberIdentity, ExternalMemberOperationStatus>>

    An Attempt<TResult, TStatus> with the updated member on success.

    Remarks

    Use this instead of UpdateAsync(ExternalMemberIdentity) on the login path when only LastLoginDate and/or SecurityStamp have changed. Skips the uniqueness checks and full-DTO mapping performed by the full update, and deliberately does not bump UpdateDate — login is not treated as a member update, and the Examine index is not refreshed. Any change to real member data (name, email, profile data, etc.) must go through UpdateAsync(ExternalMemberIdentity) which does bump UpdateDate and triggers a re-index.

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