feat(security): add distributed authorization foundation

This commit is contained in:
2026-07-29 10:40:10 +08:00
parent c7f9a4e3c9
commit df88fa19cb
76 changed files with 22020 additions and 88 deletions

View File

@@ -30,8 +30,9 @@ public sealed class TaxonomyService(
}
return await tenantExecutionScope.ExecuteAsync(
tenantId,
"List platform taxonomy with tenant extensions",
new SystemScopeRequest(
tenantId, SystemScopeCallerType.PublicQuestionBank, nameof(TaxonomyService),
"List platform taxonomy with tenant extensions", Guid.NewGuid().ToString("N")),
async (provider, token) =>
{
var systemDbContext = provider.GetRequiredService<TikuDbContext>();
@@ -85,8 +86,9 @@ public sealed class TaxonomyService(
_ => throw new InvalidOperationException("A parent source is required when parentId is provided.")
};
parent = await tenantExecutionScope.ExecuteAsync(
tenantId,
"Validate taxonomy extension parent ownership",
new SystemScopeRequest(
tenantId, SystemScopeCallerType.PublicQuestionBank, nameof(TaxonomyService),
"Validate taxonomy extension parent ownership", Guid.NewGuid().ToString("N")),
async (provider, token) =>
{
var systemDbContext = provider.GetRequiredService<TikuDbContext>();
@@ -137,8 +139,9 @@ public sealed class TaxonomyService(
{
await accessPolicy.EnsureCanStartAsync(tenantId, cancellationToken);
return await tenantExecutionScope.ExecuteAsync(
tenantId,
"Resolve platform taxonomy owner",
new SystemScopeRequest(
tenantId, SystemScopeCallerType.PublicQuestionBank, nameof(TaxonomyService),
"Resolve platform taxonomy owner", Guid.NewGuid().ToString("N")),
async (provider, token) => await provider.GetRequiredService<TikuDbContext>()
.Tenants.AsNoTracking()
.Where(tenant => tenant.Mode == TenantMode.PlatformOwned)