diff --git a/.vscode/launch.json b/.vscode/launch.json
index 3390857f..d0c5b057 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -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\\"
diff --git a/server/AyaNova/Controllers/TagController.cs b/server/AyaNova/Controllers/TagController.cs
index 027eba24..94359d25 100644
--- a/server/AyaNova/Controllers/TagController.cs
+++ b/server/AyaNova/Controllers/TagController.cs
@@ -79,38 +79,45 @@ namespace AyaNova.Api.Controllers
///
/// Bulk add tags to list of object id's specified
- ///
- ///
+ ///
///
- ///
+ ///
/// Job Id
- [HttpPost("bulk-add/{ayaType}/{tag}")]
- public async Task BulkAdd([FromRoute] AyaType ayaType, [FromRoute] string tag, [FromBody] List idList)
+ [HttpPost("bulk-add/{tag}")]
+ public async Task 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;
diff --git a/server/AyaNova/biz/ReportBiz.cs b/server/AyaNova/biz/ReportBiz.cs
index 57b5d5db..fb081efa 100644
--- a/server/AyaNova/biz/ReportBiz.cs
+++ b/server/AyaNova/biz/ReportBiz.cs
@@ -316,12 +316,11 @@ namespace AyaNova.Biz
//REPORT DATA
//Data fetched to return to report designer for Client report design usage
- public async Task GetReportData(DataListSelection reportDataParam, AuthorizationRoles overrideRoles = AuthorizationRoles.NoRole)
+ public async Task 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 RenderReport(RenderReportParameter reportParam, string apiUrl, AuthorizationRoles overrideRoles = AuthorizationRoles.NoRole)
+ public async Task 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))
{
diff --git a/server/AyaNova/biz/WidgetBiz.cs b/server/AyaNova/biz/WidgetBiz.cs
index 76e86d7a..bae11b1f 100644
--- a/server/AyaNova/biz/WidgetBiz.cs
+++ b/server/AyaNova/biz/WidgetBiz.cs
@@ -288,7 +288,7 @@ namespace AyaNova.Biz
public async Task 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
diff --git a/server/AyaNova/models/dto/DataListSelection.cs b/server/AyaNova/models/dto/DataListSelection.cs
index f79e0105..d9886895 100644
--- a/server/AyaNova/models/dto/DataListSelection.cs
+++ b/server/AyaNova/models/dto/DataListSelection.cs
@@ -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);
+ }
+ }
}
diff --git a/server/AyaNova/resource/de.json b/server/AyaNova/resource/de.json
index 70bf819c..6f70a58d 100644
--- a/server/AyaNova/resource/de.json
+++ b/server/AyaNova/resource/de.json
@@ -1876,6 +1876,7 @@
"Event": "Veranstaltung",
"Extensions": "Erweiterungen",
"SelectedItems": "Ausgewählte Elemente",
+ "AllItemsInList": "Alle Elemente in der Liste",
"Remove": "Entfernen",
"NotifyDeliveryMethod": "Benachrichtigungsversandmethode",
"NotifyEventType": "Benachrichtigungsereignis",
diff --git a/server/AyaNova/resource/en.json b/server/AyaNova/resource/en.json
index 9e84a7f8..3e6d692e 100644
--- a/server/AyaNova/resource/en.json
+++ b/server/AyaNova/resource/en.json
@@ -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",
diff --git a/server/AyaNova/resource/es.json b/server/AyaNova/resource/es.json
index 0dfd334e..23a56f19 100644
--- a/server/AyaNova/resource/es.json
+++ b/server/AyaNova/resource/es.json
@@ -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",
diff --git a/server/AyaNova/resource/fr.json b/server/AyaNova/resource/fr.json
index 8099bd13..c40e25dc 100644
--- a/server/AyaNova/resource/fr.json
+++ b/server/AyaNova/resource/fr.json
@@ -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",