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,6 +1,8 @@
|
||||
using AutoMapper;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.SelfService.Portal.Core.API.Authorization;
|
||||
using Microsoft.SelfService.Portal.Core.API.Context;
|
||||
using Microsoft.SelfService.Portal.Core.API.Dto.DeploymentBatch.Add;
|
||||
using Microsoft.SelfService.Portal.Core.API.Dto.DeploymentBatch.Edit;
|
||||
@@ -15,6 +17,7 @@ namespace Microsoft.SelfService.Portal.Core.API.Controllers
|
||||
{
|
||||
[Route("api/deployment-batches")]
|
||||
[ApiController]
|
||||
[Authorize(Policy = ApiPolicies.DeploymentRead)]
|
||||
public class DeploymentBatchController : Controller
|
||||
{
|
||||
private readonly IDeploymentBatchInterface _deploymentBatchInterface;
|
||||
@@ -82,6 +85,7 @@ namespace Microsoft.SelfService.Portal.Core.API.Controllers
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Authorize(Policy = ApiPolicies.DeploymentWrite)]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
public IActionResult AddDeploymentBatch([FromBody] AddDeploymentBatchDto deploymentBatch)
|
||||
@@ -118,6 +122,7 @@ namespace Microsoft.SelfService.Portal.Core.API.Controllers
|
||||
}
|
||||
|
||||
[HttpDelete("{id}")]
|
||||
[Authorize(Policy = ApiPolicies.DeploymentWrite)]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
[ProducesResponseType(404)]
|
||||
@@ -144,6 +149,7 @@ namespace Microsoft.SelfService.Portal.Core.API.Controllers
|
||||
}
|
||||
|
||||
[HttpPut("{id}")]
|
||||
[Authorize(Policy = ApiPolicies.DeploymentWrite)]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(400)]
|
||||
[ProducesResponseType(404)]
|
||||
@@ -182,6 +188,7 @@ namespace Microsoft.SelfService.Portal.Core.API.Controllers
|
||||
}
|
||||
|
||||
[HttpPost("{id}/template-selections")]
|
||||
[Authorize(Policy = ApiPolicies.DeploymentWrite)]
|
||||
[ProducesResponseType(200, Type = typeof(Guid))]
|
||||
[ProducesResponseType(400)]
|
||||
[ProducesResponseType(404)]
|
||||
@@ -233,6 +240,7 @@ namespace Microsoft.SelfService.Portal.Core.API.Controllers
|
||||
}
|
||||
|
||||
[HttpDelete("{id}/template-selections/{selectionId}")]
|
||||
[Authorize(Policy = ApiPolicies.DeploymentWrite)]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(404)]
|
||||
public IActionResult DeleteTemplateSelection(Guid id, Guid selectionId)
|
||||
@@ -250,6 +258,7 @@ namespace Microsoft.SelfService.Portal.Core.API.Controllers
|
||||
}
|
||||
|
||||
[HttpPost("{id}/parameter-values")]
|
||||
[Authorize(Policy = ApiPolicies.DeploymentWrite)]
|
||||
[ProducesResponseType(200, Type = typeof(Guid))]
|
||||
[ProducesResponseType(400)]
|
||||
[ProducesResponseType(404)]
|
||||
@@ -299,6 +308,7 @@ namespace Microsoft.SelfService.Portal.Core.API.Controllers
|
||||
}
|
||||
|
||||
[HttpDelete("{id}/parameter-values/{parameterValueId}")]
|
||||
[Authorize(Policy = ApiPolicies.DeploymentWrite)]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(404)]
|
||||
public IActionResult DeleteParameterValue(Guid id, Guid parameterValueId)
|
||||
@@ -316,6 +326,7 @@ namespace Microsoft.SelfService.Portal.Core.API.Controllers
|
||||
}
|
||||
|
||||
[HttpPost("{id}/target-assignments")]
|
||||
[Authorize(Policy = ApiPolicies.DeploymentWrite)]
|
||||
[ProducesResponseType(200, Type = typeof(Guid))]
|
||||
[ProducesResponseType(400)]
|
||||
[ProducesResponseType(404)]
|
||||
@@ -367,6 +378,7 @@ namespace Microsoft.SelfService.Portal.Core.API.Controllers
|
||||
}
|
||||
|
||||
[HttpDelete("{id}/target-assignments/{targetAssignmentId}")]
|
||||
[Authorize(Policy = ApiPolicies.DeploymentWrite)]
|
||||
[ProducesResponseType(204)]
|
||||
[ProducesResponseType(404)]
|
||||
public IActionResult DeleteTargetAssignment(Guid id, Guid targetAssignmentId)
|
||||
|
||||
Reference in New Issue
Block a user