Class CatalogPermissionResolver<TUser>
- Namespace
- Stratara.Identity.EntityFrameworkCore
- Assembly
- Stratara.Identity.EntityFrameworkCore.dll
Default IPermissionResolver spanning both role levels: the user's active
tenant-scoped membership roles and their global ASP.NET Identity roles (platform
roles) are mapped through the application's PermissionCatalog role grants —
so a grant like GrantToRole("PlatformAdmin", ...) works regardless of which level the
role lives on.
public sealed class CatalogPermissionResolver<TUser> : IPermissionResolver where TUser : class
Type Parameters
TUserThe host's ASP.NET Identity user entity.
- Inheritance
-
CatalogPermissionResolver<TUser>
- Implements
- Inherited Members
- Extension Methods
Remarks
Register scoped; resolved sets are memoized per (userId, tenantId) within the scope.
Fail-closed: unknown users and non-active memberships contribute no roles.
Constructors
CatalogPermissionResolver(ITenantMembershipStore, UserManager<TUser>, PermissionCatalog)
Default IPermissionResolver spanning both role levels: the user's active
tenant-scoped membership roles and their global ASP.NET Identity roles (platform
roles) are mapped through the application's PermissionCatalog role grants —
so a grant like GrantToRole("PlatformAdmin", ...) works regardless of which level the
role lives on.
public CatalogPermissionResolver(ITenantMembershipStore membershipStore, UserManager<TUser> userManager, PermissionCatalog catalog)
Parameters
membershipStoreITenantMembershipStoreThe membership store the tenant-scoped roles are read from.
userManagerUserManager<TUser>The Identity user manager the global roles are read from.
catalogPermissionCatalogThe application's permission catalog (role grants).
Remarks
Register scoped; resolved sets are memoized per (userId, tenantId) within the scope.
Fail-closed: unknown users and non-active memberships contribute no roles.
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.