| 12345678910111213141516 |
- using Microsoft.Extensions.Configuration;
- namespace Admin.NET.Plugin.AiDOP.SmartOps;
- public static class KpiDemoImportGuard
- {
- public static void EnsureAllowed(IConfiguration configuration, long tenantId)
- {
- var enabled = configuration.GetValue("Aidop:KpiDemoImport:Enabled", true);
- if (!enabled)
- throw new KpiDemoImportForbiddenException("当前环境禁止 Demo 数据导入");
- var allowed = configuration.GetSection("Aidop:KpiDemoImport:AllowedTenantIds").Get<long[]>() ?? [];
- if (allowed.Length > 0 && !allowed.Contains(tenantId))
- throw new KpiDemoImportForbiddenException("当前租户不允许 Demo 数据导入");
- }
- }
|