Table of Contents

Class UserServiceBase

Namespace
Tharga.Team
Assembly
Tharga.Team.dll
public abstract class UserServiceBase : IUserService
Inheritance
UserServiceBase
Implements
Derived
Inherited Members

Constructors

UserServiceBase(AuthenticationStateProvider, ILogger<UserServiceBase>, IIconStore)

protected UserServiceBase(AuthenticationStateProvider authenticationStateProvider, ILogger<UserServiceBase> logger = null, IIconStore iconStore = null)

Parameters

authenticationStateProvider AuthenticationStateProvider
logger ILogger<UserServiceBase>
iconStore IIconStore

Fields

_authenticationStateProvider

protected readonly AuthenticationStateProvider _authenticationStateProvider

Field Value

AuthenticationStateProvider

Properties

LastSeenStampInterval

How often (at most) LastSeen is written on resolve. Null disables stamping; Zero stamps on every resolve. The throttle is per process, so a multi-instance deployment writes at most once per interval per instance.

protected virtual TimeSpan? LastSeenStampInterval { get; }

Property Value

TimeSpan?

Methods

ClearOwnIconAsync()

Clears the current user's own icon and deletes the stored bytes (self-service).

public virtual Task ClearOwnIconAsync()

Returns

Task

ClearUserIconAsync(string)

Clears a specific user's icon (administrative). Requires Manage.

public virtual Task ClearUserIconAsync(string userKey)

Parameters

userKey string

Returns

Task

DeleteUserAsync(string)

Deletes the user record from the store, with no team-membership cleanup — call through DeleteUserAsync(string, bool, CancellationToken), which removes team memberships and audits.

public virtual Task DeleteUserAsync(string userKey)

Parameters

userKey string

Returns

Task

GetAllAsync()

protected abstract IAsyncEnumerable<IUser> GetAllAsync()

Returns

IAsyncEnumerable<IUser>

GetAsync()

All users. Cross-user enumeration — requires Manage.

public virtual IAsyncEnumerable<IUser> GetAsync()

Returns

IAsyncEnumerable<IUser>

GetClaims(ClaimsPrincipal)

protected virtual Task<ClaimsPrincipal> GetClaims(ClaimsPrincipal claimsPrincipal)

Parameters

claimsPrincipal ClaimsPrincipal

Returns

Task<ClaimsPrincipal>

GetCurrentUserAsync(ClaimsPrincipal)

public Task<IUser> GetCurrentUserAsync(ClaimsPrincipal claimsPrincipal)

Parameters

claimsPrincipal ClaimsPrincipal

Returns

Task<IUser>

GetUserAsync(ClaimsPrincipal)

protected abstract 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 virtual Task<IUser> GetUserByKeyAsync(string userKey)

Parameters

userKey string

Returns

Task<IUser>

InvalidateUserCache(string)

protected void InvalidateUserCache(string identity)

Parameters

identity string

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 virtual Task SeedUserNameAsync(string userKey, string name)

Parameters

userKey string
name string

Returns

Task

SetOwnIconAsync(byte[], string)

Sets the current user's own icon from raw image bytes (self-service): stores them via the registered IIconStore, persists the reference on the user, and deletes any previous icon. Requires a registered icon store and an authenticated caller.

public virtual Task SetOwnIconAsync(byte[] data, string contentType)

Parameters

data byte[]
contentType 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 virtual Task SetUserDirectoryIdAsync(string userKey, string directoryId)

Parameters

userKey string
directoryId string

Returns

Task

SetUserIconAsync(string, byte[], string)

Sets a specific user's icon (administrative). The mechanism is the same as SetOwnIconAsync(byte[], string) but targets userKey; requires Manage.

public virtual Task SetUserIconAsync(string userKey, byte[] data, string contentType)

Parameters

userKey string
data byte[]
contentType 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 virtual 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 virtual 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 virtual Task SetUserNameAsync(string userKey, string name)

Parameters

userKey string
name string

Returns

Task