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 SourceAssignRolesAsync(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. |
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 |
Returns
| Type | Description |
|---|---|
| Task<Attempt<IMember, ExternalMemberOperationStatus>> | An Attempt<TResult, TStatus> with the newly created IMember on success. |
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. |
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. |
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. |
GetByEmailAsync(string)
Gets an external member by email address.
Declaration
Task<ExternalMemberIdentity?> GetByEmailAsync(string email)
Parameters
| Type | Name | Description |
|---|---|---|
| string | The email address to search for. |
Returns
| Type | Description |
|---|---|
| Task<ExternalMemberIdentity> | The ExternalMemberIdentity if found; otherwise |
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 |
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 |
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. |
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. |
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. |
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 |
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.