Split out backup settings from general ops settings
This commit is contained in:
@@ -13,13 +13,13 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
[ApiController]
|
||||
[ApiVersion("8.0")]
|
||||
[Route("api/v{version:apiVersion}/global-ops-setting")]
|
||||
[Route("api/v{version:apiVersion}/global-ops-backup-setting")]
|
||||
[Produces("application/json")]
|
||||
[Authorize]
|
||||
public class GlobalOpsSettingsController : ControllerBase
|
||||
public class GlobalOpsBackupSettingsController : ControllerBase
|
||||
{
|
||||
private readonly AyContext ct;
|
||||
private readonly ILogger<GlobalOpsSettingsController> log;
|
||||
private readonly ILogger<GlobalOpsBackupSettingsController> log;
|
||||
private readonly ApiServerState serverState;
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace AyaNova.Api.Controllers
|
||||
/// <param name="dbcontext"></param>
|
||||
/// <param name="logger"></param>
|
||||
/// <param name="apiServerState"></param>
|
||||
public GlobalOpsSettingsController(AyContext dbcontext, ILogger<GlobalOpsSettingsController> logger, ApiServerState apiServerState)
|
||||
public GlobalOpsBackupSettingsController(AyContext dbcontext, ILogger<GlobalOpsBackupSettingsController> logger, ApiServerState apiServerState)
|
||||
{
|
||||
ct = dbcontext;
|
||||
log = logger;
|
||||
@@ -48,7 +48,7 @@ namespace AyaNova.Api.Controllers
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
|
||||
//Instantiate the business object handler
|
||||
GlobalOpsSettingsBiz biz = GlobalOpsSettingsBiz.GetBiz(ct, HttpContext);
|
||||
GlobalOpsBackupSettingsBiz biz = GlobalOpsBackupSettingsBiz.GetBiz(ct, HttpContext);
|
||||
|
||||
if (!Authorized.HasReadFullRole(HttpContext.Items, biz.BizType))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
@@ -70,13 +70,13 @@ namespace AyaNova.Api.Controllers
|
||||
/// <param name="global"></param>
|
||||
/// <returns>nothing</returns>
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> ReplaceGlobalOpsSettings([FromBody] GlobalOpsSettings global)
|
||||
public async Task<IActionResult> ReplaceGlobalOpsSettings([FromBody] GlobalOpsBackupSettings global)
|
||||
{
|
||||
if (serverState.IsClosed)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
GlobalOpsSettingsBiz biz = GlobalOpsSettingsBiz.GetBiz(ct, HttpContext);
|
||||
GlobalOpsBackupSettingsBiz biz = GlobalOpsBackupSettingsBiz.GetBiz(ct, HttpContext);
|
||||
if (!Authorized.HasModifyRole(HttpContext.Items, biz.BizType))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
try
|
||||
@@ -104,7 +104,7 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
if (serverState.IsClosed)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
GlobalOpsSettingsBiz biz = GlobalOpsSettingsBiz.GetBiz(ct, HttpContext);
|
||||
GlobalOpsBackupSettingsBiz biz = GlobalOpsBackupSettingsBiz.GetBiz(ct, HttpContext);
|
||||
//this route is available to Ops role user only
|
||||
if (!Authorized.HasReadFullRole(HttpContext.Items, biz.BizType))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
|
||||
Reference in New Issue
Block a user