Table of Contents

Class RoleRepository

Namespace
KadicAuth.Infrastructure.Repositories
Assembly
KadicAuth.Infrastructure.dll
public class RoleRepository : IRoleRepository
Inheritance
object
RoleRepository
Implements

Constructors

RoleRepository(AuthDbContext)

public RoleRepository(AuthDbContext context)

Parameters

context AuthDbContext

Methods

AddAsync(TenantRole, CancellationToken)

public Task AddAsync(TenantRole role, CancellationToken cancellationToken = default)

Parameters

role TenantRole
cancellationToken CancellationToken

Returns

Task

AssignPermissionsBatchAsync(Guid, List<Guid>, CancellationToken)

public Task AssignPermissionsBatchAsync(Guid roleId, List<Guid> permissionIds, CancellationToken cancellationToken = default)

Parameters

roleId Guid
permissionIds List<Guid>
cancellationToken CancellationToken

Returns

Task

CodeExistsAsync(string, Guid, Guid?, CancellationToken)

public Task<bool> CodeExistsAsync(string code, Guid tenantId, Guid? excludeId = null, CancellationToken cancellationToken = default)

Parameters

code string
tenantId Guid
excludeId Guid?
cancellationToken CancellationToken

Returns

Task<bool>

DeleteAsync(TenantRole, CancellationToken)

public Task DeleteAsync(TenantRole role, CancellationToken cancellationToken = default)

Parameters

role TenantRole
cancellationToken CancellationToken

Returns

Task

ExistsAsync(Guid, CancellationToken)

public Task<bool> ExistsAsync(Guid id, CancellationToken cancellationToken = default)

Parameters

id Guid
cancellationToken CancellationToken

Returns

Task<bool>

GetAllAsync(Guid, int, int, Guid?, CancellationToken)

public Task<PagedList<TenantRole>> GetAllAsync(Guid tenantId, int pageNumber, int pageSize, Guid? roleId = null, CancellationToken cancellationToken = default)

Parameters

tenantId Guid
pageNumber int
pageSize int
roleId Guid?
cancellationToken CancellationToken

Returns

Task<PagedList<TenantRole>>

GetByCodeAsync(Guid, string, CancellationToken)

public Task<TenantRole?> GetByCodeAsync(Guid tenantId, string code, CancellationToken cancellationToken = default)

Parameters

tenantId Guid
code string
cancellationToken CancellationToken

Returns

Task<TenantRole>

GetByIdAsync(Guid, CancellationToken)

public Task<TenantRole?> GetByIdAsync(Guid id, CancellationToken cancellationToken = default)

Parameters

id Guid
cancellationToken CancellationToken

Returns

Task<TenantRole>

GetByIdWithPermissionsAsync(Guid, Guid, CancellationToken)

public Task<TenantRole?> GetByIdWithPermissionsAsync(Guid id, Guid tenantId, CancellationToken cancellationToken = default)

Parameters

id Guid
tenantId Guid
cancellationToken CancellationToken

Returns

Task<TenantRole>

GetExistingIdsAsync(IEnumerable<Guid>, CancellationToken)

public Task<HashSet<Guid>> GetExistingIdsAsync(IEnumerable<Guid> ids, CancellationToken cancellationToken = default)

Parameters

ids IEnumerable<Guid>
cancellationToken CancellationToken

Returns

Task<HashSet<Guid>>

GetExistingIdsByTenantAsync(Guid, IEnumerable<Guid>, CancellationToken)

public Task<HashSet<Guid>> GetExistingIdsByTenantAsync(Guid tenantId, IEnumerable<Guid> ids, CancellationToken cancellationToken = default)

Parameters

tenantId Guid
ids IEnumerable<Guid>
cancellationToken CancellationToken

Returns

Task<HashSet<Guid>>

GetRolePermissionIdsAsync(Guid, CancellationToken)

public Task<List<Guid>> GetRolePermissionIdsAsync(Guid roleId, CancellationToken cancellationToken = default)

Parameters

roleId Guid
cancellationToken CancellationToken

Returns

Task<List<Guid>>

GetTenantIdByRoleIdAsync(Guid, CancellationToken)

public Task<Guid?> GetTenantIdByRoleIdAsync(Guid roleId, CancellationToken cancellationToken = default)

Parameters

roleId Guid
cancellationToken CancellationToken

Returns

Task<Guid?>

GetTenantIdByRoleIdIgnoringFiltersAsync(Guid, CancellationToken)

Looks up the tenant of a role while bypassing the global TenantId query filter. Reserved for platform-admin flows that need to operate cross-tenant (e.g. the tenant-360 wizard). Do NOT call from normal tenant-scoped handlers — that would defeat the isolation model.

public Task<Guid?> GetTenantIdByRoleIdIgnoringFiltersAsync(Guid roleId, CancellationToken cancellationToken = default)

Parameters

roleId Guid
cancellationToken CancellationToken

Returns

Task<Guid?>

RemovePermissionAsync(Guid, Guid, CancellationToken)

public Task RemovePermissionAsync(Guid roleId, Guid permissionId, CancellationToken cancellationToken = default)

Parameters

roleId Guid
permissionId Guid
cancellationToken CancellationToken

Returns

Task

RemovePermissionsBatchAsync(Guid, List<Guid>, CancellationToken)

public Task RemovePermissionsBatchAsync(Guid roleId, List<Guid> permissionIds, CancellationToken cancellationToken = default)

Parameters

roleId Guid
permissionIds List<Guid>
cancellationToken CancellationToken

Returns

Task

UpdateAsync(TenantRole, CancellationToken)

public Task UpdateAsync(TenantRole role, CancellationToken cancellationToken = default)

Parameters

role TenantRole
cancellationToken CancellationToken

Returns

Task