Modify aygetname postgres function to handle translation of items that do not have a name, also code to back it at server
This commit is contained in:
@@ -85,10 +85,12 @@ namespace AyaNova.Api.Controllers
|
||||
DataListSavedFilterBiz filterbiz = DataListSavedFilterBiz.GetBiz(ct, HttpContext);
|
||||
SavedFilter = await filterbiz.GetAsync(tableRequest.FilterId);
|
||||
}
|
||||
var DataList = DataListFactory.GetAyaDataList(tableRequest.DataListKey);
|
||||
var DataList = DataListFactory.GetAyaDataList(tableRequest.DataListKey, UserTranslationIdFromContext.Id(HttpContext.Items));
|
||||
if (DataList == null)
|
||||
return BadRequest(new ApiErrorResponse(ApiErrorCode.NOT_FOUND, "DataListKey", $"DataList \"{tableRequest.DataListKey}\" specified does not exist"));
|
||||
|
||||
|
||||
|
||||
//check rights
|
||||
if (!UserRoles.HasAnyFlags(DataList.AllowedRoles))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
@@ -172,7 +174,7 @@ namespace AyaNova.Api.Controllers
|
||||
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);
|
||||
var DataList = DataListFactory.GetAyaDataList(DataListKey, UserTranslationIdFromContext.Id(HttpContext.Items));
|
||||
//was the name not found as a list?
|
||||
if (DataList == null)
|
||||
{
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace AyaNova.Api.Controllers
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
|
||||
var ret = await EventLogProcessor.GetLogForObjectAsync(opt, ct);
|
||||
var ret = await EventLogProcessor.GetLogForObjectAsync(opt, UserTranslationIdFromContext.Id(HttpContext.Items), ct);
|
||||
return Ok(ApiOkResponse.Response(ret));
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace AyaNova.Api.Controllers
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
}
|
||||
|
||||
var ret = await EventLogProcessor.GetLogForUserAsync(opt, ct);
|
||||
var ret = await EventLogProcessor.GetLogForUserAsync(opt, UserTranslationIdFromContext.Id(HttpContext.Items), ct);
|
||||
return Ok(ApiOkResponse.Response(ret));
|
||||
}
|
||||
|
||||
@@ -113,8 +113,8 @@ namespace AyaNova.Api.Controllers
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
|
||||
//NOTE: only bizadmin full and opsadminfull have this right so it's perfect for this task
|
||||
if (!Authorized.HasCreateRole(HttpContext.Items, AyaType.License))
|
||||
//NOTE: only bizadmin full and opsadminfull have this right so it's perfect for this task
|
||||
if (!Authorized.HasCreateRole(HttpContext.Items, AyaType.License))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
|
||||
if (!ModelState.IsValid)
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace AyaNova.Api.Controllers
|
||||
if (id == 0)
|
||||
return Ok(ApiOkResponse.Response(aType.ToString()));
|
||||
|
||||
return Ok(ApiOkResponse.Response(BizObjectNameFetcherDirect.Name(aType, id, ct)));
|
||||
return Ok(ApiOkResponse.Response(BizObjectNameFetcherDirect.Name(aType, id,UserTranslationIdFromContext.Id(HttpContext.Items), ct)));
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user