feat(platform): harden governance and approval workflows
Some checks failed
ci / release-gate (push) Has been cancelled
Some checks failed
ci / release-gate (push) Has been cancelled
This commit is contained in:
@@ -3,6 +3,9 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Tiku.Api.Contracts;
|
||||
using Tiku.Application.Backoffice;
|
||||
using Tiku.Application.Security;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Tiku.Api.OpenApi;
|
||||
using Tiku.Application.PlatformAdmin;
|
||||
|
||||
namespace Tiku.Api.Controllers;
|
||||
|
||||
@@ -11,6 +14,7 @@ namespace Tiku.Api.Controllers;
|
||||
[Route("api/backoffice/platform")]
|
||||
public sealed class PlatformBackofficeController(
|
||||
IBackofficeService backofficeService,
|
||||
IPlatformApprovalService approvalService,
|
||||
ICurrentAccessContext currentAccessContext) : ControllerBase
|
||||
{
|
||||
[HttpGet("ui-bootstrap")]
|
||||
@@ -48,13 +52,17 @@ public sealed class PlatformBackofficeController(
|
||||
[HttpPut("roles/{roleId:guid}/bindings")]
|
||||
[Authorize(Policy = BackendPermissions.PlatformRoleManage)]
|
||||
[EndpointSummary("替换平台后台角色权限绑定")]
|
||||
[ProducesResponseType<BackofficeRoleItem>(StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<BackofficeRoleItem>> ReplaceRoleBindings(
|
||||
[PlatformOperationRisk("critical", PlatformApprovalPolicyCodes.SuperAdminGrant)]
|
||||
[ProducesResponseType<PlatformCommandSubmission>(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType<PlatformCommandSubmission>(StatusCodes.Status202Accepted)]
|
||||
public async Task<ActionResult<PlatformCommandSubmission>> ReplaceRoleBindings(
|
||||
Guid roleId,
|
||||
ReplaceRoleBindingsDto request,
|
||||
[FromHeader(Name = "Idempotency-Key"), Required] string idempotencyKey,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
return Ok(await backofficeService.ReplacePlatformRoleBindingsAsync(await ResolveActorAsync(cancellationToken), request.ToCommand(roleId), cancellationToken));
|
||||
var result = await approvalService.ReplaceRoleBindingsAsync(await ResolveActorAsync(cancellationToken), request.ToCommand(roleId), idempotencyKey, cancellationToken);
|
||||
return result.ExecutionStatus == "pending_approval" ? Accepted(result) : Ok(result);
|
||||
}
|
||||
|
||||
[HttpPut("users/{userId:guid}/roles")]
|
||||
|
||||
Reference in New Issue
Block a user