Table of Contents

Class RolePermissionRepository

Namespace
KadicAuth.Infrastructure.Repositories
Assembly
KadicAuth.Infrastructure.dll

Repository for querying role-permission mappings for authorization

public class RolePermissionRepository : IPermissionRepository
Inheritance
object
RolePermissionRepository
Implements
IPermissionRepository

Constructors

RolePermissionRepository(AuthDbContext)

public RolePermissionRepository(AuthDbContext context)

Parameters

context AuthDbContext

Methods

GetAllPermissionCodesAsync(CancellationToken)

Returns every permission code currently present in the catalog, ignoring roles and tenant scoping. Used exclusively by the platform-admin short-circuit in PermissionService so SuperAdmins appear to the UI as having every permission. Do NOT use from normal flows.

public Task<HashSet<string>> GetAllPermissionCodesAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task<HashSet<string>>

GetUserPermissionsAsync(Guid, Guid, Guid, CancellationToken)

Gets all unique permissions for a user based on their role assignments

public Task<HashSet<string>> GetUserPermissionsAsync(Guid userId, Guid tenantId, Guid tenantBranchId, CancellationToken cancellationToken = default)

Parameters

userId Guid

User ID

tenantId Guid

Tenant ID

tenantBranchId Guid

Current branch ID

cancellationToken CancellationToken

Cancellation token

Returns

Task<HashSet<string>>

Set of unique permission codes