This commit is contained in:
@@ -13,7 +13,7 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
[ApiController]
|
||||
[ApiVersion("8.0")]
|
||||
[Route("api/v{version:apiVersion}/global-biz-setting")]
|
||||
[Route("api/v{version:apiVersion}/global-ops-setting")]
|
||||
[Produces("application/json")]
|
||||
[Authorize]
|
||||
public class GlobalOpsSettingsController : ControllerBase
|
||||
@@ -40,7 +40,7 @@ namespace AyaNova.Api.Controllers
|
||||
/// <summary>
|
||||
/// Get GlobalOpsSettings
|
||||
/// </summary>
|
||||
/// <returns>Global settings object</returns>
|
||||
/// <returns>Global ops settings object</returns>
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> GetGlobalOpsSettings()
|
||||
{
|
||||
@@ -74,16 +74,11 @@ namespace AyaNova.Api.Controllers
|
||||
{
|
||||
if (serverState.IsClosed)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
|
||||
//Instantiate the business object handler
|
||||
GlobalOpsSettingsBiz biz = GlobalOpsSettingsBiz.GetBiz(ct, HttpContext);
|
||||
|
||||
if (!Authorized.HasModifyRole(HttpContext.Items, biz.BizType))
|
||||
if (!Authorized.HasModifyRole(HttpContext.Items, biz.BizType))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
|
||||
try
|
||||
{
|
||||
if (!await biz.ReplaceAsync(global))
|
||||
@@ -101,32 +96,24 @@ namespace AyaNova.Api.Controllers
|
||||
/// </summary>
|
||||
/// <returns>Global settings object</returns>
|
||||
[HttpGet("client")]
|
||||
public ActionResult GetClientGlobalOpsSettings()
|
||||
public async Task<ActionResult> GetClientGlobalOpsSettings()
|
||||
{
|
||||
//NOTE: currently this looks like a dupe of get above and it is
|
||||
//but it's kept here in case want to return a subset of the settings only to client users
|
||||
//where some internal server only stuff might not be desired to send to user
|
||||
|
||||
if (serverState.IsClosed)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
|
||||
//Instantiate the business object handler
|
||||
// GlobalOpsSettingsBiz biz = GlobalOpsSettingsBiz.GetBiz(ct, HttpContext);
|
||||
|
||||
//this route is available to any logged in user as it contains a subset of limited options relevant to any logged in user
|
||||
// if (!Authorized.HasReadFullRole(HttpContext.Items, biz.BizType))
|
||||
// return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
GlobalOpsSettingsBiz biz = GlobalOpsSettingsBiz.GetBiz(ct, HttpContext);
|
||||
//this route is available to Ops role user only
|
||||
if (!Authorized.HasReadFullRole(HttpContext.Items, biz.BizType))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
|
||||
// var o = await biz.GetAsync();
|
||||
// if (o == null)
|
||||
// return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||
|
||||
//new object with only relevant items in it
|
||||
var ret = new
|
||||
{
|
||||
SearchCaseSensitiveOnly = AyaNova.Util.ServerGlobalOpsSettings.SearchCaseSensitiveOnly
|
||||
};
|
||||
|
||||
return Ok(ApiOkResponse.Response(ret));
|
||||
var o = await biz.GetAsync();
|
||||
if (o == null)
|
||||
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||
return Ok(ApiOkResponse.Response(o));
|
||||
}
|
||||
|
||||
}//eoc
|
||||
|
||||
Reference in New Issue
Block a user