This commit is contained in:
@@ -48,7 +48,7 @@ namespace AyaNova.Api.Controllers
|
||||
[HttpGet("{listKey}")]
|
||||
public async Task<IActionResult> GetDataListColumnView([FromRoute] string listKey)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
if (!serverState.IsOpen && UserIdFromContext.Id(HttpContext.Items) != 1)//bypass for superuser to fix fundamental problems
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
DataListColumnViewBiz biz = DataListColumnViewBiz.GetBiz(ct, HttpContext);
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace AyaNova.Api.Controllers
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> ReplaceDataListColumnView([FromBody] DataListColumnView newObject, ApiVersion apiVersion)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
if (!serverState.IsOpen && UserIdFromContext.Id(HttpContext.Items) != 1)//bypass for superuser to fix fundamental problems
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
DataListColumnViewBiz biz = DataListColumnViewBiz.GetBiz(ct, HttpContext);
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace AyaNova.Api.Controllers
|
||||
[HttpDelete("{listKey}")]
|
||||
public async Task<IActionResult> ResetDataListColumnView([FromRoute] string listKey)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
if (!serverState.IsOpen && UserIdFromContext.Id(HttpContext.Items) != 1)//bypass for superuser to fix fundamental problems
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
@@ -115,7 +115,7 @@ namespace AyaNova.Api.Controllers
|
||||
[HttpPost("sort")]
|
||||
public async Task<IActionResult> SetSort([FromBody] DataListSortRequest sortRequest, ApiVersion apiVersion)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
if (!serverState.IsOpen && UserIdFromContext.Id(HttpContext.Items) != 1)//bypass for superuser to fix fundamental problems
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
DataListColumnViewBiz biz = DataListColumnViewBiz.GetBiz(ct, HttpContext);
|
||||
|
||||
|
||||
@@ -53,7 +53,8 @@ namespace AyaNova.Api.Controllers
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> List([FromBody] DataListTableRequest tableRequest)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
var UserId = UserIdFromContext.Id(HttpContext.Items);
|
||||
if (!serverState.IsOpen && UserId != 1)//bypass for superuser to view list of Users to fix license issues
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
@@ -69,7 +70,7 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
|
||||
var UserRoles = UserRolesFromContext.Roles(HttpContext.Items);
|
||||
var UserId = UserIdFromContext.Id(HttpContext.Items);
|
||||
|
||||
var UType = UserTypeFromContext.Type(HttpContext.Items);
|
||||
|
||||
try
|
||||
@@ -168,7 +169,7 @@ namespace AyaNova.Api.Controllers
|
||||
[HttpGet("listfields")]
|
||||
public ActionResult GetDataListFields([FromQuery] string DataListKey)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
if (!serverState.IsOpen && UserIdFromContext.Id(HttpContext.Items) != 1)//bypass for superuser to fix fundamental problems
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
|
||||
var DataList = DataListFactory.GetAyaDataList(DataListKey);
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace AyaNova.Api.Controllers
|
||||
[HttpGet("list", Name = nameof(DataListSavedFilterList))]
|
||||
public async Task<IActionResult> DataListSavedFilterList([FromQuery] string ListKey)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
if (!serverState.IsOpen && UserIdFromContext.Id(HttpContext.Items) != 1)//bypass for superuser to fix fundamental problems
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
|
||||
if (!ModelState.IsValid)
|
||||
@@ -112,7 +112,7 @@ namespace AyaNova.Api.Controllers
|
||||
else
|
||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||
}
|
||||
return Ok(ApiOkResponse.Response(new { Concurrency = o.Concurrency }));
|
||||
return Ok(ApiOkResponse.Response(new { Concurrency = o.Concurrency }));
|
||||
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace AyaNova.Api.Controllers
|
||||
//Instantiate the business object handler
|
||||
DataListSavedFilterBiz biz = DataListSavedFilterBiz.GetBiz(ct, HttpContext);
|
||||
|
||||
|
||||
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
|
||||
@@ -180,7 +180,7 @@ namespace AyaNova.Api.Controllers
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//------------
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace AyaNova.Api.Controllers
|
||||
[HttpGet("list/{enumkey}")]
|
||||
public async Task<IActionResult> GetList([FromRoute] string enumkey)
|
||||
{
|
||||
if (serverState.IsClosed)
|
||||
if (serverState.IsClosed && UserIdFromContext.Id(HttpContext.Items) != 1)//bypass for superuser to fix fundamental problems
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
var ret = await GetEnumList(enumkey, UserTranslationIdFromContext.Id(HttpContext.Items), UserRolesFromContext.Roles(HttpContext.Items));
|
||||
return Ok(ApiOkResponse.Response(ret));
|
||||
@@ -76,7 +76,7 @@ namespace AyaNova.Api.Controllers
|
||||
ret.Add(new KeyValuePair<string, string>("outsideusertype", "AyaNova user account types for customer / headoffice users"));
|
||||
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(AuthorizationRoles).ToString()), "AyaNova user account role types"));
|
||||
ret.Add(new KeyValuePair<string, string>(StringUtil.TrimTypeName(typeof(AyaType).ToString()), "All AyaNova object types untranslated"));
|
||||
ret.Add(new KeyValuePair<string, string>("alltranslated", "All AyaNova object types translated"));
|
||||
ret.Add(new KeyValuePair<string, string>("alltranslated", "All AyaNova object types translated"));
|
||||
ret.Add(new KeyValuePair<string, string>("coreall", "All Core AyaNova business object types"));
|
||||
ret.Add(new KeyValuePair<string, string>("coreview", "All Core AyaNova business object types current user is allowed to view"));
|
||||
ret.Add(new KeyValuePair<string, string>("coreedit", "All Core AyaNova business object types current user is allowed to edit"));
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -11,11 +10,6 @@ using Microsoft.Extensions.Logging;
|
||||
using AyaNova.Models;
|
||||
using AyaNova.Api.ControllerHelpers;
|
||||
using AyaNova.Biz;
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Linq;
|
||||
using AyaNova.Util;
|
||||
using System.IO;
|
||||
|
||||
@@ -65,8 +59,9 @@ namespace AyaNova.Api.Controllers
|
||||
[HttpGet("{size}")]
|
||||
public async Task<IActionResult> DownloadLogo([FromRoute] string size)
|
||||
{
|
||||
if (serverState.IsClosed)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
//allowing this because it messes up the login form needlessly
|
||||
// if (serverState.IsClosed)
|
||||
// return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
|
||||
|
||||
@@ -68,9 +68,10 @@ namespace AyaNova.Api.Controllers
|
||||
[HttpGet("new-count")]
|
||||
public async Task<IActionResult> GetNewCount()
|
||||
{
|
||||
if (serverState.IsClosed)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
var UserId = UserIdFromContext.Id(HttpContext.Items);
|
||||
if (serverState.IsClosed && UserId!=1)//bypass for superuser to fix fundamental problems
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
|
||||
return Ok(ApiOkResponse.Response(await ct.InAppNotification.CountAsync(z => z.UserId == UserId && z.Fetched == false)));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user