Files
tiku-backend.net/Tiku.Api/Controllers/TenantOnboardingController.cs
xiong c497a3ca8d
Some checks failed
ci / release-gate (push) Has been cancelled
清理代码
2026-08-03 12:31:39 +08:00

25 lines
1010 B
C#

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Tiku.Application.Security;
using Tiku.Application.Tenancy;
namespace Tiku.Api.Controllers;
[ApiController]
[Tags("租户端-开通引导")]
[Route("api/tenant/onboarding")]
[Authorize(Policy = BackendPermissions.TenantSettingsManage)]
public sealed class TenantOnboardingController(
ITenantOnboardingService onboardingService,
ICurrentAccessContext accessContext) : ControllerBase
{
[HttpGet("status")]
[EndpointSummary("查询租户开通引导状态")]
public async Task<TenantOnboardingStatus> Status(CancellationToken cancellationToken)
{
var access = await accessContext.GetAsync(cancellationToken);
if (access.TenantId is not { } tenantId || !access.IsCurrentTenantMember)
throw new TenantExternalProviderException("Tenant onboarding access is denied.", "tenant_access_denied");
return await onboardingService.GetStatusAsync(tenantId, cancellationToken);
}
}