forked from xiongyuxing/tiku-backend.net
feat(security): add distributed authorization foundation
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user