Add migration to update ApiClients with centralized authorization scopes
This migration updates the ScopesJson for the ApiClient with Id 91000000-0000-0000-0000-000000000001 to include additional authorization scopes for improved API access control. The Down method reverts the changes if necessary.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using AutoMapper;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.SelfService.Portal.Core.API.Authorization;
|
||||
using Microsoft.SelfService.Portal.Core.API.Dto.Deployment.Add;
|
||||
using Microsoft.SelfService.Portal.Core.API.Dto.Deployment.Get;
|
||||
using Microsoft.SelfService.Portal.Core.API.Dto.Deployment.Edit;
|
||||
@@ -13,6 +15,7 @@ namespace Microsoft.SelfService.Portal.Core.API.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
[Authorize(Policy = ApiPolicies.DeploymentRead)]
|
||||
public class DeploymentController : Controller
|
||||
{
|
||||
private readonly IDeploymentInterface _deploymentInterface;
|
||||
@@ -62,6 +65,7 @@ namespace Microsoft.SelfService.Portal.Core.API.Controllers
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Authorize(Policy = ApiPolicies.DeploymentWrite)]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult AddDeploymentById([FromBody] AddDeploymentDto deployment)
|
||||
@@ -93,6 +97,7 @@ namespace Microsoft.SelfService.Portal.Core.API.Controllers
|
||||
}
|
||||
|
||||
[HttpPost("Request")]
|
||||
[Authorize(Policy = ApiPolicies.DeploymentWrite)]
|
||||
[ProducesResponseType(200)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult AddDeploymentRequest([FromBody] AddDeploymentRequestDto request)
|
||||
@@ -234,6 +239,7 @@ namespace Microsoft.SelfService.Portal.Core.API.Controllers
|
||||
}
|
||||
|
||||
[HttpPost("QueueJobs/{Id}/Retry")]
|
||||
[Authorize(Policy = ApiPolicies.QueueProcess)]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(404)]
|
||||
public IActionResult RetryQueueJob(Guid Id)
|
||||
@@ -245,6 +251,7 @@ namespace Microsoft.SelfService.Portal.Core.API.Controllers
|
||||
}
|
||||
|
||||
[HttpPost("QueueJobs/Steps/{stepId}/Approve")]
|
||||
[Authorize(Policy = ApiPolicies.QueueProcess)]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(404)]
|
||||
public IActionResult ApproveQueueJobStep(Guid stepId, [FromBody] QueueJobStepApprovalDto? payload)
|
||||
@@ -257,6 +264,7 @@ namespace Microsoft.SelfService.Portal.Core.API.Controllers
|
||||
}
|
||||
|
||||
[HttpPost("QueueJobs/Steps/{stepId}/Reject")]
|
||||
[Authorize(Policy = ApiPolicies.QueueProcess)]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(404)]
|
||||
public IActionResult RejectQueueJobStep(Guid stepId, [FromBody] QueueJobStepApprovalDto? payload)
|
||||
@@ -269,6 +277,7 @@ namespace Microsoft.SelfService.Portal.Core.API.Controllers
|
||||
}
|
||||
|
||||
[HttpDelete("{Id}")]
|
||||
[Authorize(Policy = ApiPolicies.DeploymentWrite)]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
[ProducesResponseType(404)]
|
||||
@@ -291,6 +300,7 @@ namespace Microsoft.SelfService.Portal.Core.API.Controllers
|
||||
}
|
||||
|
||||
[HttpDelete("Batch/{deploymentBatchId}/Target/{targetId}")]
|
||||
[Authorize(Policy = ApiPolicies.DeploymentWrite)]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
[ProducesResponseType(404)]
|
||||
@@ -317,6 +327,7 @@ namespace Microsoft.SelfService.Portal.Core.API.Controllers
|
||||
}
|
||||
|
||||
[HttpPut("{Id}")]
|
||||
[Authorize(Policy = ApiPolicies.DeploymentWrite)]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
[ProducesResponseType(404)]
|
||||
|
||||
Reference in New Issue
Block a user