Table of Contents

Class UserServiceRepositoryBase<TUserEntity>

Namespace
Tharga.Team.MongoDB
Assembly
Tharga.Team.MongoDB.dll
public abstract class UserServiceRepositoryBase<TUserEntity> : UserServiceBase, IUserService, IUserCacheInvalidator where TUserEntity : EntityBase, IUser

Type Parameters

TUserEntity
Inheritance
UserServiceRepositoryBase<TUserEntity>
Implements
Derived
Inherited Members

Constructors

UserServiceRepositoryBase(AuthenticationStateProvider, IUserRepository<TUserEntity>, ILogger<UserServiceBase>, IIconStore, ITeamCache)

protected UserServiceRepositoryBase(AuthenticationStateProvider authenticationStateProvider, IUserRepository<TUserEntity> userRepository, ILogger<UserServiceBase> logger = null, IIconStore iconStore = null, ITeamCache cache = null)

Parameters

authenticationStateProvider AuthenticationStateProvider

Resolves the calling principal when none is supplied.

userRepository IUserRepository<TUserEntity>

The user collection this service reads and writes.

logger ILogger<UserServiceBase>

Optional. Used to report activity-stamping failures.

iconStore IIconStore

Optional. Required only for user icons.

cache ITeamCache

Optional. Forward it from your own service's constructor when running more than one instance — left unforwarded, the resolved-user lookup falls back to a process-local cache that cannot see a user disabled through another instance. See ITeamCache.

Methods

CreateUserEntityAsync(ClaimsPrincipal, string)

protected abstract Task<TUserEntity> CreateUserEntityAsync(ClaimsPrincipal claimsPrincipal, string identity)

Parameters

claimsPrincipal ClaimsPrincipal
identity string

Returns

Task<TUserEntity>

DeleteUserAsync(string)

public override Task DeleteUserAsync(string userKey)

Parameters

userKey string

Returns

Task

GetAllAsync()

protected override IAsyncEnumerable<IUser> GetAllAsync()

Returns

IAsyncEnumerable<IUser>

GetUserAsync(ClaimsPrincipal)

protected override Task<IUser> GetUserAsync(ClaimsPrincipal claimsPrincipal)

Parameters

claimsPrincipal ClaimsPrincipal

Returns

Task<IUser>

GetUserByKeyAsync(string)

The user with the given key, or null. The default implementation scans GetAsync(); storage-backed services override it with a direct read.

public override Task<IUser> GetUserByKeyAsync(string userKey)

Parameters

userKey string

Returns

Task<IUser>

SeedUserNameAsync(string, string)

Sets the user's display name only if it is currently null/empty. Used by the invitation-accept flow to promote the admin-entered invitation name into the new user's identity without clobbering an IdP-provided name.

public override Task SeedUserNameAsync(string userKey, string name)

Parameters

userKey string
name string

Returns

Task

SetUserDirectoryIdAsync(string, string)

Links the user to their external-directory id (DirectoryId). Called by the oid backfill (internal self-call) and by directory verification on an email-fallback match (relink). Default is a no-op — stores that track the directory id override it.

public override Task SetUserDirectoryIdAsync(string userKey, string directoryId)

Parameters

userKey string
directoryId string

Returns

Task

SetUserIconReferenceAsync(string, string)

Backs SetOwnIconAsync(byte[], string) / ClearOwnIconAsync() — persists the icon reference (or null to clear) on the user document. Default no-op; stores that track Icon override it.

protected override Task SetUserIconReferenceAsync(string userKey, string reference)

Parameters

userKey string
reference string

Returns

Task

SetUserLastSeenAsync(string, DateTime)

Stamps when the user last made an authenticated request. The automatic throttled stamping is an internal self-call that bypasses the authorization decorator; calling this member from outside requires Manage. The default is a no-op — stores that track LastSeen override it.

public override Task SetUserLastSeenAsync(string userKey, DateTime lastSeen)

Parameters

userKey string
lastSeen DateTime

Returns

Task

SetUserNameAsync(string, string)

Always sets the user's display name. Used by the user self-edit flow where the caller has explicitly chosen a name for themselves.

public override Task SetUserNameAsync(string userKey, string name)

Parameters

userKey string
name string

Returns

Task