This commit is contained in:
@@ -42,9 +42,11 @@ namespace AyaNova.Api.ControllerHelpers
|
|||||||
internal void SetSystemLock(string reason)
|
internal void SetSystemLock(string reason)
|
||||||
{
|
{
|
||||||
//Lock down the server for license related issue
|
//Lock down the server for license related issue
|
||||||
//Still allows ops routes, treats as if server was set to closed even if they change it to open
|
//Only Manager account (id=1) can login or do anything, treats as if server was set to closed even if they change it to open
|
||||||
//only way to reset it is to fetch a valid license
|
//only way to reset it is to fetch a valid license
|
||||||
SetState(ServerState.OpsOnly, reason);
|
//
|
||||||
|
var msg=$"{reason}\r\nOnly *the* Manager account can login to make changes";
|
||||||
|
SetState(ServerState.OpsOnly, msg);
|
||||||
SYSTEM_LOCK = true;
|
SYSTEM_LOCK = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,11 @@ namespace AyaNova.Api.Controllers
|
|||||||
public async Task<IActionResult> GetGlobalBizSettings()
|
public async Task<IActionResult> GetGlobalBizSettings()
|
||||||
{
|
{
|
||||||
if (serverState.IsClosed)
|
if (serverState.IsClosed)
|
||||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
{
|
||||||
|
//Exception for manager account to handle licensing issues
|
||||||
|
if (UserIdFromContext.Id(HttpContext.Items) != 1)
|
||||||
|
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
|
}
|
||||||
|
|
||||||
//Instantiate the business object handler
|
//Instantiate the business object handler
|
||||||
GlobalBizSettingsBiz biz = GlobalBizSettingsBiz.GetBiz(ct, HttpContext);
|
GlobalBizSettingsBiz biz = GlobalBizSettingsBiz.GetBiz(ct, HttpContext);
|
||||||
|
|||||||
@@ -44,8 +44,9 @@ namespace AyaNova.Api.Controllers
|
|||||||
public ActionResult GetPreLoginPing()
|
public ActionResult GetPreLoginPing()
|
||||||
{
|
{
|
||||||
//note: this route is called by the client as the first action so it also acts like a ping to see if the server is up as well
|
//note: this route is called by the client as the first action so it also acts like a ping to see if the server is up as well
|
||||||
if (serverState.IsClosed)
|
// if (serverState.IsClosed)
|
||||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
// return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
|
//todo: check this route for dos attack potential??
|
||||||
return Ok(ApiOkResponse.Response(!AyaNova.Core.License.ActiveKey.TrialLicense));
|
return Ok(ApiOkResponse.Response(!AyaNova.Core.License.ActiveKey.TrialLicense));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -130,7 +130,11 @@ namespace AyaNova.Api.Controllers
|
|||||||
public async Task<IActionResult> SubSet([FromBody] List<string> inObj)
|
public async Task<IActionResult> SubSet([FromBody] List<string> inObj)
|
||||||
{
|
{
|
||||||
if (serverState.IsClosed)
|
if (serverState.IsClosed)
|
||||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
{
|
||||||
|
//Exception for manager account to handle licensing issues
|
||||||
|
if (UserIdFromContext.Id(HttpContext.Items) != 1)
|
||||||
|
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
|
}
|
||||||
|
|
||||||
//Instantiate the business object handler
|
//Instantiate the business object handler
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,11 @@ namespace AyaNova.Api.Controllers
|
|||||||
public async Task<IActionResult> GetUserOptions([FromRoute] long id)
|
public async Task<IActionResult> GetUserOptions([FromRoute] long id)
|
||||||
{
|
{
|
||||||
if (serverState.IsClosed)
|
if (serverState.IsClosed)
|
||||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
{
|
||||||
|
//Exception for manager account to handle licensing issues
|
||||||
|
if (UserIdFromContext.Id(HttpContext.Items) != 1)
|
||||||
|
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
|
}
|
||||||
|
|
||||||
if (!ModelState.IsValid)
|
if (!ModelState.IsValid)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user