Class UserServiceBase
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
authenticationStateProviderAuthenticationStateProviderloggerILogger<UserServiceBase>iconStoreIIconStore
Fields
_authenticationStateProvider
protected readonly AuthenticationStateProvider _authenticationStateProvider
Field Value
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
Methods
ClearOwnIconAsync()
Clears the current user's own icon and deletes the stored bytes (self-service).
public virtual Task ClearOwnIconAsync()
Returns
ClearUserIconAsync(string)
Clears a specific user's icon (administrative). Requires Manage.
public virtual Task ClearUserIconAsync(string userKey)
Parameters
userKeystring
Returns
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
userKeystring
Returns
GetAllAsync()
protected abstract IAsyncEnumerable<IUser> GetAllAsync()
Returns
GetAsync()
All users. Cross-user enumeration — requires Manage.
public virtual IAsyncEnumerable<IUser> GetAsync()
Returns
GetClaims(ClaimsPrincipal)
protected virtual Task<ClaimsPrincipal> GetClaims(ClaimsPrincipal claimsPrincipal)
Parameters
claimsPrincipalClaimsPrincipal
Returns
GetCurrentUserAsync(ClaimsPrincipal)
public Task<IUser> GetCurrentUserAsync(ClaimsPrincipal claimsPrincipal)
Parameters
claimsPrincipalClaimsPrincipal
Returns
GetUserAsync(ClaimsPrincipal)
protected abstract Task<IUser> GetUserAsync(ClaimsPrincipal claimsPrincipal)
Parameters
claimsPrincipalClaimsPrincipal
Returns
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
userKeystring
Returns
InvalidateUserCache(string)
protected void InvalidateUserCache(string identity)
Parameters
identitystring
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
Returns
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
Returns
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
Returns
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
Returns
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
Returns
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
Returns
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)