Class CatalogPermissionResolver
- Namespace
- Stratara.Identity.EntityFrameworkCore
- Assembly
- Stratara.Identity.EntityFrameworkCore.dll
Default IPermissionResolver: maps the user's active tenant-scoped membership roles through the application's PermissionCatalog role grants. Use the generic variant (CatalogPermissionResolver<TUser>) when global ASP.NET Identity roles (platform roles) should also grant permissions.
public sealed class CatalogPermissionResolver : IPermissionResolver
- Inheritance
-
CatalogPermissionResolver
- Implements
- Inherited Members
- Extension Methods
Remarks
Register scoped; resolved sets are memoized per (userId, tenantId) within the scope,
so repeated checks in one request incur one membership lookup. Fail-closed: no membership or
a non-active membership yields an empty set.
Constructors
CatalogPermissionResolver(ITenantMembershipStore, PermissionCatalog)
Default IPermissionResolver: maps the user's active tenant-scoped membership roles through the application's PermissionCatalog role grants. Use the generic variant (CatalogPermissionResolver<TUser>) when global ASP.NET Identity roles (platform roles) should also grant permissions.
public CatalogPermissionResolver(ITenantMembershipStore membershipStore, PermissionCatalog catalog)
Parameters
membershipStoreITenantMembershipStoreThe membership store the roles are read from.
catalogPermissionCatalogThe application's permission catalog (role grants).
Remarks
Register scoped; resolved sets are memoized per (userId, tenantId) within the scope,
so repeated checks in one request incur one membership lookup. Fail-closed: no membership or
a non-active membership yields an empty set.
Methods
ResolvePermissionsAsync(Guid, Guid, CancellationToken)
Resolves every permission the user effectively holds within the tenant.
public ValueTask<IReadOnlySet<string>> ResolvePermissionsAsync(Guid userId, Guid tenantId, CancellationToken cancellationToken = default)
Parameters
userIdGuidThe user whose permissions to resolve (typically the session's actor).
tenantIdGuidThe tenant scope (typically the session's data-owner tenant).
cancellationTokenCancellationTokenToken to observe while resolving.
Returns
- ValueTask<IReadOnlySet<string>>
The effective permission set; empty when the user holds none.