This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -52,7 +52,7 @@
|
||||
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
|
||||
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
|
||||
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
|
||||
"AYANOVA_SERVER_TEST_MODE": "false",
|
||||
"AYANOVA_SERVER_TEST_MODE": "true",
|
||||
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
|
||||
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
|
||||
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\PostgreSQLPortable_12.0\\App\\PgSQL\\bin\\"
|
||||
|
||||
@@ -79,38 +79,45 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
/// <summary>
|
||||
/// Bulk add tags to list of object id's specified
|
||||
/// </summary>
|
||||
/// <param name="ayaType"></param>
|
||||
/// </summary>
|
||||
/// <param name="tag"></param>
|
||||
/// <param name="idList"></param>
|
||||
/// <param name="dataListSelection"></param>
|
||||
/// <returns>Job Id</returns>
|
||||
[HttpPost("bulk-add/{ayaType}/{tag}")]
|
||||
public async Task<IActionResult> BulkAdd([FromRoute] AyaType ayaType, [FromRoute] string tag, [FromBody] List<long> idList)
|
||||
[HttpPost("bulk-add/{tag}")]
|
||||
public async Task<IActionResult> BulkAdd([FromRoute] string tag, [FromBody] DataListSelection dataListSelection)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
if (!ayaType.HasAttribute(typeof(CoreBizObjectAttribute)))
|
||||
|
||||
if (dataListSelection.IsEmpty)
|
||||
return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_REQUIRED, null, "DataListSelection is required"));
|
||||
|
||||
if (!dataListSelection.ObjectType.HasAttribute(typeof(CoreBizObjectAttribute)))
|
||||
return BadRequest(new ApiErrorResponse(ApiErrorCode.INVALID_OPERATION, null, "Not a taggable object type"));
|
||||
if (!Authorized.HasModifyRole(HttpContext.Items, ayaType))
|
||||
|
||||
if (!Authorized.HasModifyRole(HttpContext.Items, dataListSelection.ObjectType))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
if (idList.Count == 0)
|
||||
return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_REQUIRED, null, "List of ids are required"));
|
||||
|
||||
tag = TagBiz.NormalizeTag(tag);
|
||||
if (string.IsNullOrWhiteSpace(tag))
|
||||
return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_REQUIRED, null, "tag required"));
|
||||
|
||||
await dataListSelection.RehydrateIdList(ct, UserRolesFromContext.Roles(HttpContext.Items), log);
|
||||
if (dataListSelection.SelectedRowIds.Length == 0)
|
||||
return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_REQUIRED, null, "List of ids"));
|
||||
|
||||
var JobName = $"Bulk operation: Add tag \"{tag}\" on {ayaType} ({idList.Count} specified)";
|
||||
var JobName = $"Bulk operation: Add tag \"{tag}\" on {dataListSelection.ObjectType} ({dataListSelection.SelectedRowIds.LongLength} specified)";
|
||||
JObject o = JObject.FromObject(new
|
||||
{
|
||||
idList = idList,
|
||||
idList = dataListSelection.SelectedRowIds,
|
||||
tag = tag
|
||||
});
|
||||
|
||||
OpsJob j = new OpsJob();
|
||||
j.Name = JobName;
|
||||
j.ObjectType = ayaType;
|
||||
j.ObjectType = dataListSelection.ObjectType;
|
||||
j.JobType = JobType.BulkCoreBizObjectOperation;
|
||||
j.SubType = JobSubType.TagAdd;
|
||||
j.Exclusive = false;
|
||||
|
||||
@@ -316,12 +316,11 @@ namespace AyaNova.Biz
|
||||
//REPORT DATA
|
||||
//Data fetched to return to report designer for Client report design usage
|
||||
|
||||
public async Task<Newtonsoft.Json.Linq.JArray> GetReportData(DataListSelection reportDataParam, AuthorizationRoles overrideRoles = AuthorizationRoles.NoRole)
|
||||
public async Task<Newtonsoft.Json.Linq.JArray> GetReportData(DataListSelection reportDataParam)
|
||||
{
|
||||
var log = AyaNova.Util.ApplicationLogging.CreateLogger("ReportBiz::GetReportData");
|
||||
AuthorizationRoles effectiveRoles = CurrentUserRoles;
|
||||
if (overrideRoles != AuthorizationRoles.NoRole)
|
||||
effectiveRoles = overrideRoles;
|
||||
|
||||
|
||||
if (!AyaNova.Api.ControllerHelpers.Authorized.HasReadFullRole(effectiveRoles, reportDataParam.ObjectType))
|
||||
{
|
||||
@@ -345,7 +344,7 @@ namespace AyaNova.Biz
|
||||
//RENDER
|
||||
//
|
||||
|
||||
public async Task<string> RenderReport(RenderReportParameter reportParam, string apiUrl, AuthorizationRoles overrideRoles = AuthorizationRoles.NoRole)
|
||||
public async Task<string> RenderReport(RenderReportParameter reportParam, string apiUrl)
|
||||
{
|
||||
var log = AyaNova.Util.ApplicationLogging.CreateLogger("ReportBiz::RenderReport");
|
||||
|
||||
@@ -358,9 +357,7 @@ namespace AyaNova.Biz
|
||||
}
|
||||
|
||||
AuthorizationRoles effectiveRoles = CurrentUserRoles;
|
||||
if (overrideRoles != AuthorizationRoles.NoRole)
|
||||
effectiveRoles = overrideRoles;
|
||||
|
||||
|
||||
|
||||
if (!AyaNova.Api.ControllerHelpers.Authorized.HasReadFullRole(effectiveRoles, report.ObjectType))
|
||||
{
|
||||
|
||||
@@ -288,7 +288,7 @@ namespace AyaNova.Biz
|
||||
public async Task<JArray> GetReportData(long[] idList)
|
||||
{
|
||||
//NOTE: Report widget is a superset of biz object widget
|
||||
//Biz objects will add and needed linked records here as extra fields with the data included
|
||||
//Biz objects will add and needed linked records here as extra fields with the data included
|
||||
//for example instead of a userid only there will be username added to the record
|
||||
//so the report designer can just select it as a field, no need to query seperately for it etc
|
||||
//REMEMBER: there is a name display format system and it should honour that so that the report
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
using System.Threading.Tasks;
|
||||
using AyaNova.Biz;
|
||||
using Newtonsoft.Json.Linq;
|
||||
namespace AyaNova.Models
|
||||
{
|
||||
//Used to drive processes that rely on selections made at client from a datalist
|
||||
//either a preselected list of id's or a datalist key and listview filter object that can
|
||||
//be used to rehydrate a list of id's
|
||||
public class DataListSelection
|
||||
{
|
||||
public AyaType ObjectType { get; set; }
|
||||
@@ -9,7 +12,18 @@ namespace AyaNova.Models
|
||||
public string DataListKey { get; set; }
|
||||
public string ListView { get; set; }//optional, if null or empty will use default list view built into DataList
|
||||
|
||||
}
|
||||
|
||||
public bool IsEmpty
|
||||
{
|
||||
get
|
||||
{
|
||||
return SelectedRowIds.LongLength == 0 && string.IsNullOrWhiteSpace(DataListKey);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task RehydrateIdList(AyContext ct, AuthorizationRoles userRoles, Microsoft.Extensions.Logging.ILogger log)
|
||||
{
|
||||
if (SelectedRowIds.Length == 0)
|
||||
SelectedRowIds = await AyaNova.DataList.DataListFetcher.GetIdListResponseAsync(DataListKey, ListView, ct, userRoles, log);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1876,6 +1876,7 @@
|
||||
"Event": "Veranstaltung",
|
||||
"Extensions": "Erweiterungen",
|
||||
"SelectedItems": "Ausgewählte Elemente",
|
||||
"AllItemsInList": "Alle Elemente in der Liste",
|
||||
"Remove": "Entfernen",
|
||||
"NotifyDeliveryMethod": "Benachrichtigungsversandmethode",
|
||||
"NotifyEventType": "Benachrichtigungsereignis",
|
||||
|
||||
@@ -1876,6 +1876,7 @@
|
||||
"Event": "Event",
|
||||
"Extensions": "Extensions",
|
||||
"SelectedItems": "Selected items",
|
||||
"AllItemsInList": "All items in list",
|
||||
"Remove": "Remove",
|
||||
"NotifyDeliveryMethod": "Notification delivery method",
|
||||
"NotifyEventType": "Notification event",
|
||||
|
||||
@@ -1876,6 +1876,7 @@
|
||||
"Event": "Evento",
|
||||
"Extensions": "Extensiones",
|
||||
"SelectedItems": "Elementos seleccionados",
|
||||
"AllItemsInList": "Todos los elementos de la lista",
|
||||
"Remove": "Eliminar",
|
||||
"NotifyDeliveryMethod": "Método de entrega de notificaciones",
|
||||
"NotifyEventType": "Evento de notificación",
|
||||
|
||||
@@ -1876,6 +1876,7 @@
|
||||
"Event": "Un événement",
|
||||
"Extensions": "Extensions",
|
||||
"SelectedItems": "Éléments sélectionnés",
|
||||
"AllItemsInList": "Tous les éléments de la liste",
|
||||
"Remove": "Retirer",
|
||||
"NotifyDeliveryMethod": "Méthode de remise des notifications",
|
||||
"NotifyEventType": "Événement de notification",
|
||||
|
||||
Reference in New Issue
Block a user