Class ActivityGroupService
- Namespace
- Excalibur.A3.Authorization
- Assembly
- Excalibur.A3.dll
Provides services for managing activity groups.
public sealed class ActivityGroupService : IActivityGroupService
- Inheritance
-
ActivityGroupService
- Implements
- Inherited Members
Remarks
Initializes a new instance of the ActivityGroupService class. An application-scoped cache is required. The parameter default allows dependency injection to report the corrective registration diagnostic when it is missing; it does not provide a cache fallback.
Constructors
ActivityGroupService(HttpClient, ICorrelationId, IAuthenticationToken, IActivityGroupStore, IActivityGroupGrantStore, IOptions<ActivityGroupSyncOptions>, ILogger<ActivityGroupService>, IDistributedCache?)
Provides services for managing activity groups.
public ActivityGroupService(HttpClient httpClient, ICorrelationId correlationId, IAuthenticationToken token, IActivityGroupStore activityGroupStore, IActivityGroupGrantStore activityGroupGrantStore, IOptions<ActivityGroupSyncOptions> syncOptions, ILogger<ActivityGroupService> logger, IDistributedCache? cache = null)
Parameters
httpClientHttpClientcorrelationIdICorrelationIdtokenIAuthenticationTokenactivityGroupStoreIActivityGroupStoreactivityGroupGrantStoreIActivityGroupGrantStoresyncOptionsIOptions<ActivityGroupSyncOptions>loggerILogger<ActivityGroupService>cacheIDistributedCache
Remarks
Initializes a new instance of the ActivityGroupService class. An application-scoped cache is required. The parameter default allows dependency injection to report the corrective registration diagnostic when it is missing; it does not provide a cache fallback.
Exceptions
- InvalidOperationException
The application-scoped cache is missing.
Methods
ExistsAsync(string, string, CancellationToken)
Checks whether tenantId has an activity group with the specified name.
public Task<bool> ExistsAsync(string tenantId, string activityGroupName, CancellationToken cancellationToken)
Parameters
tenantIdstringThe tenant identifier. Required; must be non-empty.
activityGroupNamestringThe name of the activity group to check for existence.
cancellationTokenCancellationTokenA token to cancel the asynchronous operation.
Returns
- Task<bool>
A Task<TResult> that resolves to
trueiftenantIdhas a group so named; otherwise,false.
Remarks
The tenant term is part of the question rather than a filter on it: a group name is unique only within a tenant, so a bare-name check answers estate-wide and reports another tenant's group as this tenant's. This member is a pass-through, and a pass-through that drops the tenant would leave the hole one layer above the store that closed it.
Exceptions
- InvalidOperationException
The application-scoped cache is missing.
SyncActivityGroupGrantsAsync(string, CancellationToken)
Synchronizes the grants (permissions or roles) of the activity groups for a specific user.
public Task SyncActivityGroupGrantsAsync(string userId, CancellationToken cancellationToken)
Parameters
userIdstringThe unique identifier of the user whose grants will be synchronized.
cancellationTokenCancellationTokenA token to cancel the asynchronous operation.
Returns
Exceptions
- InvalidOperationException
The application-scoped cache is missing.
SyncActivityGroupsAsync(CancellationToken)
Synchronizes all activity groups by updating or creating them based on the current state of the source data.
public Task SyncActivityGroupsAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenA token to cancel the asynchronous operation.
Returns
Exceptions
- InvalidOperationException
The application-scoped cache is missing.
SyncAllActivityGroupGrantsAsync(CancellationToken)
Synchronizes the grants (permissions or roles) for all users across all activity groups.
public Task SyncAllActivityGroupGrantsAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenA token to cancel the asynchronous operation.
Returns
Exceptions
- InvalidOperationException
The application-scoped cache is missing.