Table of Contents

Class UiMenuTenantProvisioningService

Namespace
KadicAuth.Infrastructure.Services
Assembly
KadicAuth.Infrastructure.dll

Keeps the UI_MENU module (and all its submodules) assigned to a tenant whenever ANY business module gets assigned to it.

public sealed class UiMenuTenantProvisioningService : IUiMenuTenantProvisioningService
Inheritance
object
UiMenuTenantProvisioningService
Implements

Remarks

Bug #9001. Sidebar item visibility is gated by its own catalog module (UI_MENU, see KadicErp.Core.Abstractions.Authorization.UiMenu) with permissions like UI_MENU_ACADEMY_VIEW — entirely separate from the business permissions (ACADEMY_*) that actually gate the feature. Nothing ever assigned UI_MENU to a tenant automatically, so a tenant could have a business module fully purchased and granted to a role and still have no way to navigate to it: the matching sidebar permission was never assignable because its submodule was never in Auth.TenantsSubModules for that tenant.

This only makes the UI_MENU_* permissions available to grant from the role-permissions editor — it does NOT grant them to any role. Granting stays a deliberate admin action, same as any other permission.

Constructors

UiMenuTenantProvisioningService(IModuleRepository, ISubModuleRepository, ITenantModuleRepository, ITenantSubModuleRepository, ILogger<UiMenuTenantProvisioningService>)

public UiMenuTenantProvisioningService(IModuleRepository moduleRepository, ISubModuleRepository subModuleRepository, ITenantModuleRepository tenantModuleRepository, ITenantSubModuleRepository tenantSubModuleRepository, ILogger<UiMenuTenantProvisioningService> logger)

Parameters

moduleRepository IModuleRepository
subModuleRepository ISubModuleRepository
tenantModuleRepository ITenantModuleRepository
tenantSubModuleRepository ITenantSubModuleRepository
logger ILogger<UiMenuTenantProvisioningService>

Methods

EnsureUiMenuAssignedAsync(Guid, CancellationToken)

Idempotent: assigns the UI_MENU module and any of its submodules the tenant doesn't already have. No-ops if the catalog has no UI_MENU module (nothing to assign) or the tenant already has everything.

public Task EnsureUiMenuAssignedAsync(Guid tenantId, CancellationToken cancellationToken = default)

Parameters

tenantId Guid
cancellationToken CancellationToken

Returns

Task