@@ -1,11 +1,11 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
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.Backoffice;
|
||||
using Tiku.Application.PlatformAdmin;
|
||||
using Tiku.Application.Security;
|
||||
|
||||
namespace Tiku.Api.Controllers;
|
||||
|
||||
@@ -35,7 +35,8 @@ public sealed class PlatformBackofficeController(
|
||||
[ProducesResponseType<BackofficeBootstrap>(StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<BackofficeBootstrap>> GetBootstrap(CancellationToken cancellationToken)
|
||||
{
|
||||
return Ok(await backofficeService.GetPlatformBootstrapAsync(await ResolveActorAsync(cancellationToken), cancellationToken));
|
||||
return Ok(await backofficeService.GetPlatformBootstrapAsync(await ResolveActorAsync(cancellationToken),
|
||||
cancellationToken));
|
||||
}
|
||||
|
||||
[HttpPost("roles")]
|
||||
@@ -46,7 +47,8 @@ public sealed class PlatformBackofficeController(
|
||||
UpsertBackofficeRoleDto request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
return Ok(await backofficeService.UpsertPlatformRoleAsync(await ResolveActorAsync(cancellationToken), request.ToCommand(), cancellationToken));
|
||||
return Ok(await backofficeService.UpsertPlatformRoleAsync(await ResolveActorAsync(cancellationToken),
|
||||
request.ToCommand(), cancellationToken));
|
||||
}
|
||||
|
||||
[HttpPut("roles/{roleId:guid}/bindings")]
|
||||
@@ -58,10 +60,12 @@ public sealed class PlatformBackofficeController(
|
||||
public async Task<ActionResult<PlatformCommandSubmission>> ReplaceRoleBindings(
|
||||
Guid roleId,
|
||||
ReplaceRoleBindingsDto request,
|
||||
[FromHeader(Name = "Idempotency-Key"), Required] string idempotencyKey,
|
||||
[FromHeader(Name = "Idempotency-Key")] [Required]
|
||||
string idempotencyKey,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await approvalService.ReplaceRoleBindingsAsync(await ResolveActorAsync(cancellationToken), request.ToCommand(roleId), idempotencyKey, cancellationToken);
|
||||
var result = await approvalService.ReplaceRoleBindingsAsync(await ResolveActorAsync(cancellationToken),
|
||||
request.ToCommand(roleId), idempotencyKey, cancellationToken);
|
||||
return result.ExecutionStatus == "pending_approval" ? Accepted(result) : Ok(result);
|
||||
}
|
||||
|
||||
@@ -74,7 +78,8 @@ public sealed class PlatformBackofficeController(
|
||||
ReplaceUserRolesDto request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
await backofficeService.ReplacePlatformUserRolesAsync(await ResolveActorAsync(cancellationToken), request.ToCommand(userId), cancellationToken);
|
||||
await backofficeService.ReplacePlatformUserRolesAsync(await ResolveActorAsync(cancellationToken),
|
||||
request.ToCommand(userId), cancellationToken);
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
@@ -82,4 +87,4 @@ public sealed class PlatformBackofficeController(
|
||||
{
|
||||
return BackofficeActor.FromPlatformAccess(await currentAccessContext.GetAsync(cancellationToken));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user