From 784ea46fd17a62bc4a4fe898430902c3bf0f4d65 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 23 Jan 2020 22:56:01 +0000 Subject: [PATCH] --- .../AyaNova/Controllers/ApiRootController.cs | 679 +++++++++--------- .../Controllers/AttachmentController.cs | 2 +- .../Controllers/AyaEnumPickListController.cs | 4 - .../AyaNova/Controllers/AyaTypeController.cs | 2 - .../AyaNova/Controllers/DataListController.cs | 6 +- .../Controllers/DataListFilterController.cs | 17 - .../Controllers/DataListTemplateController.cs | 12 - .../AyaNova/Controllers/EventLogController.cs | 6 +- .../Controllers/FormCustomController.cs | 50 +- .../FormFieldsDefinitionsController.cs | 7 +- .../Controllers/ImportAyaNova7Controller.cs | 12 +- .../Controllers/JobOperationsController.cs | 10 - .../AyaNova/Controllers/LicenseController.cs | 11 - .../AyaNova/Controllers/LocaleController.cs | 55 +- .../AyaNova/Controllers/LogFilesController.cs | 7 - .../AyaNova/Controllers/MetricsController.cs | 6 - .../AyaNova/Controllers/SearchController.cs | 3 - .../Controllers/ServerStateController.cs | 12 +- .../AyaNova/Controllers/TagListController.cs | 29 - server/AyaNova/Controllers/UserController.cs | 84 --- .../Controllers/UserOptionsController.cs | 10 - .../AyaNova/Controllers/WidgetController.cs | 137 +--- server/AyaNova/biz/DataListFilterBiz.cs | 16 +- server/AyaNova/biz/WidgetBiz.cs | 90 +-- 24 files changed, 365 insertions(+), 902 deletions(-) diff --git a/server/AyaNova/Controllers/ApiRootController.cs b/server/AyaNova/Controllers/ApiRootController.cs index 68a33a8a..499eff36 100644 --- a/server/AyaNova/Controllers/ApiRootController.cs +++ b/server/AyaNova/Controllers/ApiRootController.cs @@ -13,8 +13,8 @@ namespace AyaNova.Api.Controllers /// [ApiVersion("8.0")] [Route("api/v{version:apiVersion}/")] - [AllowAnonymous] - [ApiController] + [AllowAnonymous] + [ApiController] public class ApiMetaController : ControllerBase { private readonly ApiServerState serverState; @@ -89,351 +89,348 @@ namespace AyaNova.Api.Controllers } #region sigtest script -/* + /* -
-
-

SIGTEST - 1

-

This is the signature header

- -

- Your browser does not support signing
- The following browsers are supported:
- IE 9.0 +, FIREFOX 3.0 +, SAFARI 3.0 +, CHROME 3.0 +, OPERA 10.0 +, IPAD 1.0 +, IPHONE - 1.0 +, ANDROID 1.0 +

-
-
- {SigScript()} +
+
+

SIGTEST - 1

+

This is the signature header

+ +

+ Your browser does not support signing
+ The following browsers are supported:
+ IE 9.0 +, FIREFOX 3.0 +, SAFARI 3.0 +, CHROME 3.0 +, OPERA 10.0 +, IPAD 1.0 +, IPHONE + 1.0 +, ANDROID 1.0 +

+
+
+ {SigScript()} - private string SigScript(){ - return @""; -} - */ + + $('#sigpad').sigpad(); + }); + + (function ($) { + $.fn.extend( + { + sigpad: function (options) { + // Default options + var defaults = { + lineWidth: 3.0, + lineCap: 'round', + lineJoin: 'round', + miterLimit: 10, + strokeStyle: 'black', + fillStyle: 'none', + showClear: false, + clearLabel: 'Clear', + clearStyle: 'button' + }; + + options = $.extend(defaults, options); + + return this.each(function () { + if (this.nodeName === 'CANVAS') { + $(this).css('cursor', 'pointer'); + //$(this).attr('onclick', 'function onclick(event) { void 1; }'); + $(this).click('function onclick(event) { void 1; }'); + + if (this.getContext) { + var canvas = this; + var context = this.getContext('2d'); + var id = $(this).attr('id'); + + $(this).after('
'); + + context.underInteractionEnabled = true; + + // Overrides with passed options + context.lineWidth = options.lineWidth; + context.lineCap = options.lineCap; + context.lineJoin = options.lineJoin; + context.miterLimit = options.miterLimit; + context.strokeStyle = options.strokeStyle; + context.fillStyle = options.fillStyle; + + + var data_input = id + '-data'; + $(this).after(''); + + //case 1975 + //add hidden to form dirty tracking + $('form').trigger('rescan.areYouSure'); + + // Defines all our tracking variables + var drawing = false; + var height = $('#' + id).height(); + var width = $('#' + id).width(); + var svg_path = ''; + var scrollLeft = 0; + var scrollTop = 0; + + // var offsetX = $(this).attr('offsetLeft'); + // var offsetY = $(this).attr('offsetTop'); + + var offsetX = 0; + var offsetY = 0; + + + var inside = false; + var prevX = false; + var prevY = false; + var x = false; + var y = false; + + // Mouse events + $(document).mousedown(function (e) { drawingStart(e); }); + $(document).mousemove(function (e) { drawingMove(e); }); + $(document).mouseup(function () { drawingStop(); }); + + // Touch events + $(document).bind('touchstart', function (e) { drawingStart(e); }); + $(document).bind('touchmove', function (e) { drawingMove(e); }); + $(document).bind('touchend', function () { drawingStop(); }); + $(document).bind('touchcancel', function () { drawingStop(); }); + + // Adds the clear button / link + if (options.showClear === true) { + // var clear_tag = (options.clearStyle == 'link' ? 'div' : 'button'); + + // $('#' + id + '-controls').append('<' + clear_tag + ' id=""' + id + '-clear"" style=""float:left"">' + options.clearLabel + '
'); + $('#' + id + '-controls').append('
' + + '
'); + + clear = true; + } + + // Clearing the canvas + $('#' + id + '-clear').click(function (e) { + context.save(); + context.beginPath(); + context.closePath(); + context.restore(); + context.clearRect(0, 0, $(canvas).width(), $(canvas).height()); + + $('#' + data_input).val(''); + }); + + function getTouch(e) { + + //console.log(e);//3566 + // iPhone/iPad/iPod uses event.touches and not the passed event + if (typeof (event) != ""undefined"" && typeof (event.touches) != ""undefined"") { + e = event.touches.item(0); + + scrollLeft = document.body.scrollLeft; + scrollTop = document.body.scrollTop; + } + else { + scrollLeft = $(document).scrollLeft(); + scrollTop = $(document).scrollTop(); + } + + //console.log(""scrollLeft:"" + scrollLeft.toString()); + //console.log(""scrollTop:"" + scrollTop.toString()); + + // Tracks last position to handle dots (as opposed to lines) + if (x != false) { + prevX = x; + prevY = y; + } + + // Calculates the X and Y values + x = e.clientX - (offsetX - scrollLeft); + y = e.clientY - (offsetY - scrollTop); + return e; + } + + + + function draw(type) { + if (type != 'stop') { + if (type == 'start') { + inside = false; + prevX = false; + prevY = false; + + context.beginPath(); + context.moveTo(x, y); + + if (svg_path == '') { + //timestamp and dimentions + var currentDate = new Date(); + var captured = currentDate.getFullYear() + ':' + (currentDate.getMonth() + 1) + ':' + currentDate.getDate() + ':' + currentDate.getHours() + ':' + currentDate.getMinutes() + ':' + currentDate.getSeconds(); + svg_path = '{version=1 width=' + width + ' height=' + height + ' captured=' + captured + '}'; + } + + if (svg_path != '') { + svg_path += 'X'; + } + //svg_path = '{polyline points=""'; + } + else { + // If there's no previous increment since it's a . + if (prevX == false) { + x = x + 1; + y = y + 1; + } + + context.lineTo(x, y); + } + + context.stroke(); + + if (svg_path.length > 0 && svg_path.substring(svg_path.length - 1) != '""') { + svg_path = svg_path + ' '; + } + + svg_path = svg_path + x + ',' + y; + + if ((x > 0 && x <= width) && (y > 0 && y <= height)) { + inside = true; + //console.log(""INSIDE""); + } else { + //console.log(""OUTSIDE X="" + x.toString() + "", Y="" + y.toString() + "", WIDTH="" + width.toString() + "", HEIGHT="" + height.toString()); + } + } + else { + draw('move'); + + if (inside == true) { + // Closes the polyline (with style info) and adds the closing svg tag + //svg_path = svg_path + '"" style=""fill:' + options.fillStyle + ';stroke:' + context.strokeStyle + ';stroke-width:' + context.lineWidth + '"" /}{/svg}'; + + var element = $('#' + data_input); + + + + var svg_data = element.val(); + + // Adds the opening and closing SVG tags + // if (svg_data == '') + // { + // svg_data = '{?xml version=""1.0"" standalone=""no""?}{!DOCTYPE svg PUBLIC ""-//W3C//DTD SVG 1.1//EN"" ""http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd""}{svg width=""' + width + '"" height=""' + height + '"" version=""1.1"" xmlns=""http://www.w3.org/2000/svg""}{/svg}'; + // } + + // Appends the recorded path + //element.val(svg_data.substring(0, svg_data.length - 6) + svg_path); + element.val(svg_path); + + //rescan hidden field form changed + //case 1975 + $('form').trigger('checkform.areYouSure'); + } + } + } + + function drawingStart(e) { + // console.log(""drawing start"");//3566 + setCanvasOffset(); + // Prevent the default action (scrolling) from occurring + if (inside == true) { + e.preventDefault(); + } + + drawing = true; + + e = getTouch(e); + + context.strokeStyle = $('#' + id + '-colors div.selected').css('backgroundColor'); + + draw('start'); + } + + function drawingMove(e) { + //console.log(""drawing move""); + // Prevent the default action (scrolling) from occurring + if (inside == true) { + e.preventDefault(); + } + + if (drawing == true) { + e = getTouch(e); + + draw('move'); + } + + return false; + } + + function drawingStop() { + //console.log(""drawing STOP""); + drawing = false; + + // Draws one last line so we can draw dots (e.g. i) + draw('stop'); + } + + + //=========================== + + function setCanvasOffset() { + canvasOffset = Offset(document.getElementById(id)); + offsetX = canvasOffset.left; + offsetY = canvasOffset.top; + } + + function Offset(element) { + if (element === undefined) return null; + var obj = element.getBoundingClientRect(); + return { + left: obj.left + window.pageXOffset, + top: obj.top + window.pageYOffset + }; + } + + //=============== + + } + // else { + // alert('Your browser does not support the CANVAS element required for signing. The following browsers will work: IE 9.0+, FIREFOX 3.0+, SAFARI 3.0+, CHROME 3.0+, OPERA 10.0+, IPAD 1.0+, IPHONE 1.0+, ANDROID 1.0+'); + // } + } + else { + alert('Not a CANVAS element'); + } + }); + } + }); + })(jQuery); + + "; + } + */ #endregion /// - /// Get API server info for general display - /// - /// Required roles: Any - /// + /// Get API server info for general display /// /// API server info [HttpGet("ServerInfo")] @@ -455,9 +452,6 @@ document.body.addEventListener(""touchmove"", function (e) { #if (DEBUG) /// /// Get build mode of server, used for automated testing purposes - /// - /// Required roles: Any - /// /// /// "DEBUG" or "RELEASE" [HttpGet("BuildMode")] @@ -466,11 +460,8 @@ document.body.addEventListener(""touchmove"", function (e) { return Ok(new { data = new { BuildMode = "DEBUG" } }); } #else - /// + /// /// Get build mode of server, used for automated testing purposes - /// - /// Required roles: Any - /// /// /// "DEBUG" or "RELEASE" [HttpGet("BuildMode")] diff --git a/server/AyaNova/Controllers/AttachmentController.cs b/server/AyaNova/Controllers/AttachmentController.cs index 0309b723..40fb699d 100644 --- a/server/AyaNova/Controllers/AttachmentController.cs +++ b/server/AyaNova/Controllers/AttachmentController.cs @@ -115,7 +115,7 @@ namespace AyaNova.Api.Controllers /// /// Upload attachment file /// - /// Required roles: Same roles as object that file is being attached to + /// Requires same Authorization roles as object that file is being attached to /// /// /// NameValue list of filenames and attachment id's diff --git a/server/AyaNova/Controllers/AyaEnumPickListController.cs b/server/AyaNova/Controllers/AyaEnumPickListController.cs index bb21e38f..17b91dea 100644 --- a/server/AyaNova/Controllers/AyaEnumPickListController.cs +++ b/server/AyaNova/Controllers/AyaEnumPickListController.cs @@ -43,8 +43,6 @@ namespace AyaNova.Api.Controllers /// /// Get name value localized display value list of AyaNova enumerated types for list specified - /// - /// Required roles: Any /// /// The key name of the enumerated type /// List @@ -157,8 +155,6 @@ namespace AyaNova.Api.Controllers /// /// Get all possible enumerated values picklist key names - /// - /// Required roles: Any /// /// List of AyaNova enumerated type list key names that can be fetched from the AyaEnumPickList/GetPickListRoute [HttpGet("listkeys")] diff --git a/server/AyaNova/Controllers/AyaTypeController.cs b/server/AyaNova/Controllers/AyaTypeController.cs index c5a4159f..4a942898 100644 --- a/server/AyaNova/Controllers/AyaTypeController.cs +++ b/server/AyaNova/Controllers/AyaTypeController.cs @@ -43,8 +43,6 @@ namespace AyaNova.Api.Controllers /// /// Get name value list of AyaNova business object types - /// - /// Required roles: Any /// /// List [HttpGet] diff --git a/server/AyaNova/Controllers/DataListController.cs b/server/AyaNova/Controllers/DataListController.cs index a6bbdc6c..6a07f6a1 100644 --- a/server/AyaNova/Controllers/DataListController.cs +++ b/server/AyaNova/Controllers/DataListController.cs @@ -43,7 +43,7 @@ namespace AyaNova.Api.Controllers /// /// Get list of data for selection / viewing /// - /// Required roles: Varies by list, if not allowed will return 403 - Not Authorized + /// Authorization varies list by list, will return 403 - Not Authorized if user has insufficient role /// /// /// List key, Paging, filtering and sorting options @@ -78,8 +78,6 @@ namespace AyaNova.Api.Controllers /// /// List of all DataList keys available - /// - /// Required roles: Any /// /// List of strings [HttpGet("ListKeys")] @@ -96,8 +94,6 @@ namespace AyaNova.Api.Controllers /// /// List of all fields for data list key specified - /// - /// Required roles: Any /// /// List of DataListFieldDefinition [HttpGet("ListFields")] diff --git a/server/AyaNova/Controllers/DataListFilterController.cs b/server/AyaNova/Controllers/DataListFilterController.cs index 06702e6d..19b9b5c1 100644 --- a/server/AyaNova/Controllers/DataListFilterController.cs +++ b/server/AyaNova/Controllers/DataListFilterController.cs @@ -47,9 +47,6 @@ namespace AyaNova.Api.Controllers /// /// Get full DataFilter object - /// - /// Required roles: - /// Any (for public filter), owned only for private filter /// /// /// A single DataFilter @@ -79,9 +76,6 @@ namespace AyaNova.Api.Controllers /// /// Get DataFilter pick list - /// - /// Required roles: Any - /// /// /// List of public or owned data filters for listKey provided [HttpGet("PickList", Name = nameof(DataFilterPickList))] @@ -104,10 +98,6 @@ namespace AyaNova.Api.Controllers /// /// Put (update) DataFilter - /// - /// Required roles: - /// Any (public filter) or owned only (private filter) - /// /// /// /// @@ -149,9 +139,6 @@ namespace AyaNova.Api.Controllers /// /// Post DataFilter - /// - /// Required roles: - /// BizAdminFull, InventoryFull, TechFull /// /// /// Automatically filled from route path, no need to specify in body @@ -185,10 +172,6 @@ namespace AyaNova.Api.Controllers /// /// Delete DataFilter - /// - /// Required roles: - /// Any if public otherwise creator only - /// /// /// /// Ok diff --git a/server/AyaNova/Controllers/DataListTemplateController.cs b/server/AyaNova/Controllers/DataListTemplateController.cs index ca3ca325..e20e9f48 100644 --- a/server/AyaNova/Controllers/DataListTemplateController.cs +++ b/server/AyaNova/Controllers/DataListTemplateController.cs @@ -43,9 +43,6 @@ namespace AyaNova.Api.Controllers /// /// Get full DataListTemplate object - /// - /// Required roles: - /// Any /// /// /// A single DataListTemplate @@ -79,8 +76,6 @@ namespace AyaNova.Api.Controllers /// /// List of all DataList keys available - /// - /// Required roles: Any /// /// List of strings [HttpGet("ListKeys")] @@ -97,10 +92,6 @@ namespace AyaNova.Api.Controllers /// /// Put (update) DataListTemplate - /// - /// Required roles: - /// BizAdminFull - /// /// /// /// @@ -150,9 +141,6 @@ namespace AyaNova.Api.Controllers /// /// Delete DataListTemplate /// (Reset DataListTemplate to default) - /// Required roles: - /// BizAdminFull - /// /// /// /// Ok diff --git a/server/AyaNova/Controllers/EventLogController.cs b/server/AyaNova/Controllers/EventLogController.cs index 3c6ecdf2..fe51943a 100644 --- a/server/AyaNova/Controllers/EventLogController.cs +++ b/server/AyaNova/Controllers/EventLogController.cs @@ -49,8 +49,7 @@ namespace AyaNova.Api.Controllers /// /// Get event log for object and date range specified /// - /// Required roles: - /// Read rights to object type specified + /// Required Role: Read full object properties rights to object type specified /// /// /// Event log entry list for object @@ -76,8 +75,7 @@ namespace AyaNova.Api.Controllers /// /// Get event log entries for a specified user and date range /// - /// Required roles: - /// Read rights to User object or UserId specified must be requestor Id + /// Required Role: Read rights to User object or User's own data /// /// /// Event log for user diff --git a/server/AyaNova/Controllers/FormCustomController.cs b/server/AyaNova/Controllers/FormCustomController.cs index eafafaea..f88f2f9b 100644 --- a/server/AyaNova/Controllers/FormCustomController.cs +++ b/server/AyaNova/Controllers/FormCustomController.cs @@ -49,11 +49,6 @@ namespace AyaNova.Api.Controllers /// /// Get form customizations for Client form display - /// Returns 304 not modified if concurrency token provided and unchanged - /// - /// Required roles: - /// Any - /// /// /// The official form key used by AyaNova /// A prior concurrency token used to check if there are any changes without using up bandwidth sending unnecessary data @@ -95,7 +90,7 @@ namespace AyaNova.Api.Controllers - + @@ -104,10 +99,6 @@ namespace AyaNova.Api.Controllers /// Used to build UI for customizing a form /// These values are a subset of the AyaDataTypes values /// which can be fetched from the EnumPickList route - /// - /// Required roles: - /// BizAdminFull only has rights to customize forms - /// /// /// A list of valid values for custom field types [HttpGet("AvailableCustomTypes")] @@ -128,10 +119,6 @@ namespace AyaNova.Api.Controllers /// /// Get a list of all customizable form keys /// Used to build UI for customizing a form - /// - /// Required roles: - /// BizAdminFull only has rights to customize forms - /// /// /// A list of string formKey values valid for customization [HttpGet("AvailableCustomizableFormKeys")] @@ -153,9 +140,6 @@ namespace AyaNova.Api.Controllers /// /// Put (update) FormCustom - /// - /// Required roles: BizAdminFull - /// /// /// /// @@ -195,38 +179,6 @@ namespace AyaNova.Api.Controllers } - // /// - // /// Post FormCustom - // /// - // /// Required roles: BizAdminFull - // /// - // /// - // /// Automatically filled from route path, no need to specify in body - // /// - // [HttpPost] - // public async Task PostFormCustom([FromBody] FormCustom inObj, ApiVersion apiVersion) - // { - // if (!serverState.IsOpen) - // return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason)); - - // //Instantiate the business object handler - // FormCustomBiz biz = FormCustomBiz.GetBiz(ct, HttpContext); - - // //check rights - // if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) - // return StatusCode(403, new ApiNotAuthorizedResponse()); - - // if (!ModelState.IsValid) - // return BadRequest(new ApiErrorResponse(ModelState)); - - // //Create and validate - // FormCustom o = await biz.CreateAsync(inObj); - // if (o == null) - // return BadRequest(new ApiErrorResponse(biz.Errors)); - // else - // return CreatedAtAction(nameof(FormCustomController.GetFormCustom), new { formkey = o.FormKey, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); - - // } diff --git a/server/AyaNova/Controllers/FormFieldsDefinitionsController.cs b/server/AyaNova/Controllers/FormFieldsDefinitionsController.cs index 414042da..67421d85 100644 --- a/server/AyaNova/Controllers/FormFieldsDefinitionsController.cs +++ b/server/AyaNova/Controllers/FormFieldsDefinitionsController.cs @@ -38,11 +38,8 @@ namespace AyaNova.Api.Controllers /// - /// Get available fields for object specified - /// Used to build UI for customizing forms, lists etc - /// - /// Required roles: Any - /// + /// Get available fields for Form specified + /// Used at UI for customizing forms /// /// /// List of form fields and their properties diff --git a/server/AyaNova/Controllers/ImportAyaNova7Controller.cs b/server/AyaNova/Controllers/ImportAyaNova7Controller.cs index eafc2be2..1d980b6e 100644 --- a/server/AyaNova/Controllers/ImportAyaNova7Controller.cs +++ b/server/AyaNova/Controllers/ImportAyaNova7Controller.cs @@ -58,7 +58,6 @@ namespace AyaNova.Api.Controllers /// /// Upload AyaNova 7 import file - /// Required roles: OpsAdminFull /// /// NameValue list of filenames and id's [HttpPost] @@ -145,8 +144,6 @@ namespace AyaNova.Api.Controllers /// /// Delete import file - /// - /// Required roles: OpsAdminFull /// /// /// Ok @@ -180,8 +177,6 @@ namespace AyaNova.Api.Controllers /// /// Get AyaNova 7 data dump uploaded files list - /// - /// Required roles: OpsAdminFull /// /// List of uploaded data dump files [HttpGet] @@ -212,14 +207,11 @@ namespace AyaNova.Api.Controllers /// /// *ERASE DATABASE and start import of previously uploaded import file /// **This will permanently erase all current data in database without further warning as the first step in the import process** - /// - /// Required roles: OpsAdminFull - /// /// /// /// Ok - [HttpPost("startImport/{filename}")] - public ActionResult StartImport([FromRoute] string filename) + [HttpPost("EraseDatabaseAndStartImport/{filename}")] + public ActionResult EraseDatabaseAndStartImport([FromRoute] string filename) { //Open or opsOnly and user is opsadminfull if (!serverState.IsOpenOrOpsOnly || (serverState.IsOpsOnly && !Authorized.HasAnyRole(HttpContext.Items, AuthorizationRoles.OpsAdminFull))) diff --git a/server/AyaNova/Controllers/JobOperationsController.cs b/server/AyaNova/Controllers/JobOperationsController.cs index fa1595fe..27fc036f 100644 --- a/server/AyaNova/Controllers/JobOperationsController.cs +++ b/server/AyaNova/Controllers/JobOperationsController.cs @@ -48,11 +48,6 @@ namespace AyaNova.Api.Controllers /// /// Get Operations jobs list - /// - /// Required roles: OpsAdminFull, OpsAdminLimited, BizAdminFull, BizAdminLimited - /// - /// This list cannot be filtered or queried as there are typically not many jobs - /// /// /// List of operations jobs [HttpGet] @@ -86,11 +81,6 @@ namespace AyaNova.Api.Controllers /// /// Get Operations log for a job - /// - /// Required roles: OpsAdminFull, OpsAdminLimited, BizAdminFull, BizAdminLimited - /// - /// This list cannot be filtered or queried as there are typically not many jobs - /// /// /// /// A tag diff --git a/server/AyaNova/Controllers/LicenseController.cs b/server/AyaNova/Controllers/LicenseController.cs index 7115a491..bd2d061e 100644 --- a/server/AyaNova/Controllers/LicenseController.cs +++ b/server/AyaNova/Controllers/LicenseController.cs @@ -46,10 +46,6 @@ namespace AyaNova.Api.Controllers /// /// Get License info - /// - /// Required roles: - /// AuthorizationRoles.BizAdminFull | AuthorizationRoles.OpsAdminFull | - /// AuthorizationRoles.BizAdminLimited | AuthorizationRoles.OpsAdminLimited /// /// Information about the currently installed license in AyaNova [HttpGet()] @@ -79,9 +75,6 @@ namespace AyaNova.Api.Controllers /// /// Posting to this route causes AyaNova to attempt to refresh it's license /// from the AyaNova license server - /// - /// Required roles: - /// AuthorizationRoles.BizAdminFull | AuthorizationRoles.OpsAdminFull /// /// On success returns information about the currently installed license in AyaNova [HttpPost] @@ -140,10 +133,6 @@ namespace AyaNova.Api.Controllers /// /// Posting to this route causes AyaNova to request a trial license key from the AyaNova license server /// Database must be empty and unlicensed or trial license - /// - /// Required roles: - /// [OpsFull, BizAdminFull] - /// /// /// /// HTTP 204 No Content result code on success or fail code with explanation diff --git a/server/AyaNova/Controllers/LocaleController.cs b/server/AyaNova/Controllers/LocaleController.cs index 169cf925..34a9e808 100644 --- a/server/AyaNova/Controllers/LocaleController.cs +++ b/server/AyaNova/Controllers/LocaleController.cs @@ -53,8 +53,6 @@ namespace AyaNova.Api.Controllers /// /// Get Locale all values - /// - /// Required roles: Any /// /// /// A single Locale and it's values @@ -90,8 +88,6 @@ namespace AyaNova.Api.Controllers /// /// Get Locale pick list - /// Required roles: Any - /// /// /// Picklist in alphabetical order of all locales [HttpGet("PickList")] @@ -114,8 +110,6 @@ namespace AyaNova.Api.Controllers #if (DEBUG) /// /// Get a coverage report of locale keys used versus unused - /// Required roles: Any - /// /// /// Report of all unique locale keys requested since last server reboot [HttpGet("LocaleKeyCoverage")] @@ -138,8 +132,6 @@ namespace AyaNova.Api.Controllers /// /// Get subset of locale values - /// Required roles: Any - /// /// /// List of locale key strings /// A key value array of localized text values @@ -163,10 +155,7 @@ namespace AyaNova.Api.Controllers /// - /// Duplicates an existing locale with a new name - /// - /// Required roles: OpsAdminFull | BizAdminFull - /// + /// Duplicates an existing locale with a new name /// /// NameIdItem object containing source locale Id and new name /// Automatically filled from route path, no need to specify in body @@ -192,7 +181,7 @@ namespace AyaNova.Api.Controllers } else { - return CreatedAtAction(nameof(LocaleController.GetLocale), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); + return CreatedAtAction(nameof(LocaleController.GetLocale), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); } } @@ -200,11 +189,7 @@ namespace AyaNova.Api.Controllers /// /// Put (UpdateLocaleItemDisplayText) - /// - /// Required roles: OpsAdminFull | BizAdminFull - /// /// Update a single key with new display text - /// /// /// NewText/Id/Concurrency token object. NewText is new display text, Id is LocaleItem Id, concurrency token is required /// @@ -271,12 +256,8 @@ namespace AyaNova.Api.Controllers } /// - /// Put (UpdateLocaleName) - /// - /// Required roles: OpsAdminFull | BizAdminFull - /// + /// Put (UpdateLocaleName) /// Update a locale to change the name (non-stock locales only) - /// /// /// NewText/Id/Concurrency token object. NewText is new locale name, Id is Locale Id, concurrency token is required /// @@ -339,10 +320,6 @@ namespace AyaNova.Api.Controllers /// /// Delete Locale - /// - /// Required roles: - /// BizAdminFull, InventoryFull - /// /// /// /// Ok @@ -395,32 +372,6 @@ namespace AyaNova.Api.Controllers } - - - // private bool LocaleExists(long id) - // { - // return ct.Locale.Any(e => e.Id == id); - // } - - - - - //------------ - - // public class LocaleSubsetParam - // { - // [System.ComponentModel.DataAnnotations.Required] - // public long LocaleId { get; set; } - // [System.ComponentModel.DataAnnotations.Required] - // public List Keys { get; set; } - - // public LocaleSubsetParam() - // { - // Keys = new List(); - // } - - // } - #if (DEBUG) public class LocaleCoverageInfo { diff --git a/server/AyaNova/Controllers/LogFilesController.cs b/server/AyaNova/Controllers/LogFilesController.cs index 0430e39b..59423038 100644 --- a/server/AyaNova/Controllers/LogFilesController.cs +++ b/server/AyaNova/Controllers/LogFilesController.cs @@ -46,9 +46,6 @@ namespace AyaNova.Api.Controllers /// /// Get server log - /// - /// Required roles: - /// OpsAdminFull | OpsAdminLimited /// /// /// A single log file in plain text @@ -93,10 +90,6 @@ namespace AyaNova.Api.Controllers /// /// Get list of operations logs - /// - /// Required roles: - /// OpsAdminFull | OpsAdminLimited - /// /// /// [HttpGet()] diff --git a/server/AyaNova/Controllers/MetricsController.cs b/server/AyaNova/Controllers/MetricsController.cs index 3efa733b..a0bae851 100644 --- a/server/AyaNova/Controllers/MetricsController.cs +++ b/server/AyaNova/Controllers/MetricsController.cs @@ -47,9 +47,6 @@ namespace AyaNova.Api.Controllers /// /// Get metrics as text document - /// - /// Required roles: - /// OpsAdminFull | OpsAdminLimited /// /// Snapshot of metrics [HttpGet("TextSnapShot")] @@ -77,9 +74,6 @@ namespace AyaNova.Api.Controllers /// /// Get metrics as json object - /// - /// Required roles: - /// OpsAdminFull | OpsAdminLimited /// /// Snapshot of metrics [HttpGet("JsonSnapShot")] diff --git a/server/AyaNova/Controllers/SearchController.cs b/server/AyaNova/Controllers/SearchController.cs index 773ba608..c48c3f15 100644 --- a/server/AyaNova/Controllers/SearchController.cs +++ b/server/AyaNova/Controllers/SearchController.cs @@ -47,11 +47,8 @@ namespace AyaNova.Api.Controllers /// /// Post search parameters - /// Required roles: Any /// MaxResults defaults to 500 /// MaxResults = 0 returns all results - /// There is no paging as this is a dynamic response - /// /// /// /// SearchResult list diff --git a/server/AyaNova/Controllers/ServerStateController.cs b/server/AyaNova/Controllers/ServerStateController.cs index 5a133910..76221602 100644 --- a/server/AyaNova/Controllers/ServerStateController.cs +++ b/server/AyaNova/Controllers/ServerStateController.cs @@ -33,7 +33,7 @@ namespace AyaNova.Api.Controllers /// public ServerStateController(ILogger logger, ApiServerState apiServerState, AyContext dbcontext) { - ct = dbcontext; + ct = dbcontext; log = logger; serverState = apiServerState; } @@ -41,9 +41,6 @@ namespace AyaNova.Api.Controllers /// /// Get server state - /// - /// Required roles: - /// [NONE / authentication not required] /// /// Current server state (Closed, OpsOnly, Open) [HttpGet] @@ -55,13 +52,8 @@ namespace AyaNova.Api.Controllers /// /// Set server state - /// - /// Required roles: - /// [OpsFull, BizAdminFull] - /// /// Valid parameters: /// One of "Closed", "OpsOnly" or "Open" - /// /// /// {"NewState":"Closed"} /// NoContent 204 @@ -97,7 +89,7 @@ namespace AyaNova.Api.Controllers //Log EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.ServerState, AyaEvent.ServerStateChange, $"{state.ServerState}-{state.Reason}"), ct); - + return NoContent(); } diff --git a/server/AyaNova/Controllers/TagListController.cs b/server/AyaNova/Controllers/TagListController.cs index 651419e6..bbd44305 100644 --- a/server/AyaNova/Controllers/TagListController.cs +++ b/server/AyaNova/Controllers/TagListController.cs @@ -43,8 +43,6 @@ namespace AyaNova.Api.Controllers /// /// Get tag picklist - /// - /// Required roles: Any /// /// The query to filter the returned list by /// Filtered list (maximum 25 items are returned for any query) @@ -63,8 +61,6 @@ namespace AyaNova.Api.Controllers /// /// Get tag cloud list - /// - /// Required roles: Any /// /// The query to filter the returned list by /// List @@ -81,30 +77,5 @@ namespace AyaNova.Api.Controllers - // /// - // /// Get all possible enumerated values picklist key names - // /// - // /// Required roles: Any - // /// - // /// List of AyaNova enumerated type list key names that can be fetched from the AyaEnumPickList/GetPickListRoute - // [HttpGet("listkeys")] - // public ActionResult GetTypesList() - // { - // if (!serverState.IsOpen) - // { - // return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason)); - // } - - // List> ret = new List>(); - // ret.Add(new KeyValuePair("usertypes", "AyaNova user account types")); - // ret.Add(new KeyValuePair("authorizationroles", "AyaNova user account role types")); - // ret.Add(new KeyValuePair("AyaType", "All AyaNova object types, use the AyaTypeController route to fetch these")); - - // return Ok(ApiOkResponse.Response(ret)); - // } - - - - }//eoc }//ens \ No newline at end of file diff --git a/server/AyaNova/Controllers/UserController.cs b/server/AyaNova/Controllers/UserController.cs index 4310118f..845e6ea8 100644 --- a/server/AyaNova/Controllers/UserController.cs +++ b/server/AyaNova/Controllers/UserController.cs @@ -49,9 +49,6 @@ namespace AyaNova.Api.Controllers /// /// Get User - /// - /// Required roles: - /// BizAdminFull, BizAdminLimited /// /// /// A single User @@ -88,78 +85,9 @@ namespace AyaNova.Api.Controllers } - // /// - // /// Get paged list of Users - // /// - // /// Required roles: - // /// BizAdminFull, BizAdminLimited - // /// - // /// - // /// Paged collection of Users with paging data - // [HttpGet("ListUsers", Name = nameof(ListUsers))]//We MUST have a "Name" defined or we can't get the link for the pagination, non paged urls don't need a name - // public async Task ListUsers([FromQuery] ListOptions pagingOptions) - // { - - // if (serverState.IsClosed) - // { - // return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason)); - // } - - // //Instantiate the business object handler - // UserBiz biz = UserBiz.GetBiz(ct, HttpContext); - - // if (!Authorized.HasReadFullRole(HttpContext.Items, biz.BizType)) - // { - // return StatusCode(403, new ApiNotAuthorizedResponse()); - // } - - // if (!ModelState.IsValid) - // { - // return BadRequest(new ApiErrorResponse(ModelState)); - // } - - - - // ApiPagedResponse pr = await biz.GetManyAsync(Url, nameof(ListUsers), pagingOptions); - // return Ok(new ApiOkWithPagingResponse(pr)); - // } - - - - // /// - // /// Get User pick list - // /// - // /// Required roles: Any - // /// - // /// - // /// Paging, filtering and sorting options - // /// Paged id/name collection with paging data - // [HttpGet("PickList", Name = nameof(UserPickList))] - // public ActionResult UserPickList([FromQuery] ListOptions pagingOptions) - // { - // if (serverState.IsClosed) - // { - // return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason)); - // } - - // if (!ModelState.IsValid) - // { - // return BadRequest(new ApiErrorResponse(ModelState)); - // } - - // //Instantiate the business object handler - // UserBiz biz = UserBiz.GetBiz(ct, HttpContext); - // ApiPagedResponse pr = biz.GetPickList(Url, nameof(UserPickList), pagingOptions); - // return Ok(new ApiOkWithPagingResponse(pr)); - // } - /// /// Put (update) User - /// - /// Required roles: - /// BizAdminFull - /// /// /// /// @@ -220,10 +148,6 @@ namespace AyaNova.Api.Controllers /// /// Patch (update) User - /// - /// Required roles: - /// BizAdminFull - /// /// /// /// @@ -282,10 +206,6 @@ namespace AyaNova.Api.Controllers /// /// Post User - /// - /// Required roles: - /// BizAdminFull - /// /// /// /// Automatically filled from route path, no need to specify in body @@ -337,10 +257,6 @@ namespace AyaNova.Api.Controllers /// /// Delete User - /// - /// Required roles: - /// BizAdminFull - /// /// /// /// Ok diff --git a/server/AyaNova/Controllers/UserOptionsController.cs b/server/AyaNova/Controllers/UserOptionsController.cs index b0bd47fc..f7c84778 100644 --- a/server/AyaNova/Controllers/UserOptionsController.cs +++ b/server/AyaNova/Controllers/UserOptionsController.cs @@ -47,9 +47,6 @@ namespace AyaNova.Api.Controllers /// /// Get full UserOptions object - /// - /// Required roles: - /// BizAdminFull, BizAdminLimited or be users own record /// /// UserId /// A single UserOptions @@ -92,10 +89,6 @@ namespace AyaNova.Api.Controllers /// /// Put (update) UserOptions - /// - /// Required roles: - /// BizAdminFull or be users own record - /// /// /// User id /// @@ -156,9 +149,6 @@ namespace AyaNova.Api.Controllers /// /// Patch (update) UserOptions - /// - /// Required roles: - /// BizAdminFull or be users own record /// /// UserId /// diff --git a/server/AyaNova/Controllers/WidgetController.cs b/server/AyaNova/Controllers/WidgetController.cs index 22e36596..abf01b60 100644 --- a/server/AyaNova/Controllers/WidgetController.cs +++ b/server/AyaNova/Controllers/WidgetController.cs @@ -51,9 +51,6 @@ namespace AyaNova.Api.Controllers /// /// Get full widget object - /// - /// Required roles: - /// BizAdminFull, InventoryFull, BizAdminLimited, InventoryLimited /// /// /// A single widget @@ -84,120 +81,9 @@ namespace AyaNova.Api.Controllers } - - // /// - // /// Get list for selection / viewing - // /// - // /// Required roles: Any in-house staff (some roles might have restrictions on exact fields that are returned) - // /// - // /// - // /// Paging, filtering and sorting options - // /// Collection with paging data - // [HttpGet("List", Name = nameof(List))] - // public ActionResult List([FromQuery] ListOptions pagingOptions) - // { - // if (serverState.IsClosed) - // return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason)); - - // if (!ModelState.IsValid) - // return BadRequest(new ApiErrorResponse(ModelState)); - - // //Instantiate the business object handler - // WidgetBiz biz = WidgetBiz.GetBiz(ct, HttpContext); - - // ApiPagedResponse pr = biz.GetList(Url, nameof(List), pagingOptions).Result; - // return Ok(new ApiOkWithPagingResponse(pr)); - - // } - - // /// - // /// TEST list with relationships - // /// - // /// Required roles: Any in-house staff (some roles might have restrictions on exact fields that are returned) - // /// - // /// - // /// Paging, filtering and sorting options - // /// Collection with paging data - // [HttpGet("TestGetWidgetUserEmailList", Name = nameof(TestGetWidgetUserEmailList))] - // public ActionResult TestGetWidgetUserEmailList([FromQuery] ListOptions pagingOptions) - // { - // if (serverState.IsClosed) - // return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason)); - - // if (!ModelState.IsValid) - // return BadRequest(new ApiErrorResponse(ModelState)); - - // //Instantiate the business object handler - // WidgetBiz biz = WidgetBiz.GetBiz(ct, HttpContext); - - // ApiPagedResponse pr = biz.TestGetWidgetUserEmailList(Url, nameof(TestGetWidgetUserEmailList), pagingOptions).Result; - // return Ok(new ApiOkWithPagingResponse(pr)); - // // string ret= biz.GetList(Url, nameof(List), pagingOptions).Result; - // // return Ok(ret); - // } - - - - - // /// - // /// Get paged list of widgets - // /// - // /// Required roles: - // /// BizAdminFull, InventoryFull, BizAdminLimited, InventoryLimited - // /// - // /// Paged collection of widgets with paging data - // [HttpGet("ListWidgets", Name = nameof(ListWidgets))]//We MUST have a "Name" defined or we can't get the link for the pagination, non paged urls don't need a name - // public async Task ListWidgets([FromQuery] ListOptions pagingOptions) - // { - // if (serverState.IsClosed) - // return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason)); - - // //Instantiate the business object handler - // WidgetBiz biz = WidgetBiz.GetBiz(ct, HttpContext); - - // if (!Authorized.HasReadFullRole(HttpContext.Items, biz.BizType)) - // return StatusCode(403, new ApiNotAuthorizedResponse()); - - // if (!ModelState.IsValid) - // return BadRequest(new ApiErrorResponse(ModelState)); - - // ApiPagedResponse pr = await biz.GetManyAsync(Url, nameof(ListWidgets), pagingOptions); - // return Ok(new ApiOkWithPagingResponse(pr)); - // } - - - - // /// - // /// Get pick list - // /// - // /// Required roles: Any - // /// - // /// - // /// Paging, filtering and sorting options - // /// Paged id/name collection with paging data - // [HttpGet("PickList", Name = nameof(WidgetPickList))] - // public ActionResult WidgetPickList([FromQuery] ListOptions pagingOptions) - // { - // if (serverState.IsClosed) - // return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason)); - - // if (!ModelState.IsValid) - // return BadRequest(new ApiErrorResponse(ModelState)); - - // //Instantiate the business object handler - // WidgetBiz biz = WidgetBiz.GetBiz(ct, HttpContext); - - // ApiPagedResponse pr = biz.GetPickList(Url, nameof(WidgetPickList), pagingOptions); - // return Ok(new ApiOkWithPagingResponse(pr)); - // } - /// /// Put (update) widget - /// - /// Required roles: - /// BizAdminFull, InventoryFull - /// /// /// /// @@ -214,7 +100,7 @@ namespace AyaNova.Api.Controllers //Instantiate the business object handler WidgetBiz biz = WidgetBiz.GetBiz(ct, HttpContext); - var o = await biz.GetNoLogAsync(id); + var o = await biz.GetAsync(id, false); if (o == null) return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND)); @@ -240,10 +126,6 @@ namespace AyaNova.Api.Controllers /// /// Patch (update) widget - /// - /// Required roles: - /// BizAdminFull, InventoryFull - /// /// /// /// @@ -263,7 +145,7 @@ namespace AyaNova.Api.Controllers //Instantiate the business object handler WidgetBiz biz = WidgetBiz.GetBiz(ct, HttpContext); - var o = await biz.GetNoLogAsync(id); + var o = await biz.GetAsync(id, false); if (o == null) return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND)); @@ -289,9 +171,6 @@ namespace AyaNova.Api.Controllers /// /// Post widget - /// - /// Required roles: - /// BizAdminFull, InventoryFull /// /// /// Automatically filled from route path, no need to specify in body @@ -324,9 +203,6 @@ namespace AyaNova.Api.Controllers /// /// Duplicate widget - /// - /// Required roles: - /// BizAdminFull, InventoryFull /// /// Create a duplicate of this items id /// Automatically filled from route path, no need to specify in body @@ -347,7 +223,7 @@ namespace AyaNova.Api.Controllers if (!ModelState.IsValid) return BadRequest(new ApiErrorResponse(ModelState)); - var oSrc = await biz.GetNoLogAsync(id); + var oSrc = await biz.GetAsync(id, false); if (oSrc == null) return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND)); @@ -364,11 +240,6 @@ namespace AyaNova.Api.Controllers /// /// Delete widget - /// - /// Required roles: - /// BizAdminFull, InventoryFull - /// - /// /// /// /// Ok @@ -384,7 +255,7 @@ namespace AyaNova.Api.Controllers //Instantiate the business object handler WidgetBiz biz = WidgetBiz.GetBiz(ct, HttpContext); - var o = await biz.GetNoLogAsync(id); + var o = await biz.GetAsync(id, false); if (o == null) return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND)); diff --git a/server/AyaNova/biz/DataListFilterBiz.cs b/server/AyaNova/biz/DataListFilterBiz.cs index 07b12c5c..91936cfc 100644 --- a/server/AyaNova/biz/DataListFilterBiz.cs +++ b/server/AyaNova/biz/DataListFilterBiz.cs @@ -43,13 +43,7 @@ namespace AyaNova.Biz return await ct.DataListFilter.AnyAsync(e => e.Id == id); } - //////////////////////////////////////////////////////////////////////////////////////////////// - /// GET - internal async Task GetNoLogAsync(long fetchId) - { - //This is simple so nothing more here, but often will be copying to a different output object or some other ops - return await ct.DataListFilter.SingleOrDefaultAsync(m => m.Id == fetchId); - } + //////////////////////////////////////////////////////////////////////////////////////////////// //CREATE @@ -127,6 +121,14 @@ namespace AyaNova.Biz return ret; } + //////////////////////////////////////////////////////////////////////////////////////////////// + /// GET + internal async Task GetNoLogAsync(long fetchId) + { + //This is simple so nothing more here, but often will be copying to a different output object or some other ops + return await ct.DataListFilter.SingleOrDefaultAsync(m => m.Id == fetchId); + } + //get picklist (NOT PAGED) internal async Task> GetPickListAsync(string listKey) diff --git a/server/AyaNova/biz/WidgetBiz.cs b/server/AyaNova/biz/WidgetBiz.cs index fcb24ef1..52d7898a 100644 --- a/server/AyaNova/biz/WidgetBiz.cs +++ b/server/AyaNova/biz/WidgetBiz.cs @@ -47,21 +47,13 @@ namespace AyaNova.Biz //////////////////////////////////////////////////////////////////////////////////////////////// /// GET /// - /// + /// - //Get without logging - internal async Task GetNoLogAsync(long fetchId) - { - //This is simple so nothing more here, but often will be copying to a different output object or some other ops - return await ct.Widget.SingleOrDefaultAsync(m => m.Id == fetchId); - } - - //Get one with logging - internal async Task GetAsync(long fetchId) + internal async Task GetAsync(long fetchId, bool log = true) { //This is simple so nothing more here, but often will be copying to a different output object or some other ops var ret = await ct.Widget.SingleOrDefaultAsync(m => m.Id == fetchId); - if (ret != null) + if (log && ret != null) { //Log EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, fetchId, BizType, AyaEvent.Retrieved), ct); @@ -264,53 +256,6 @@ namespace AyaNova.Biz - //////////////////////////////////////////////////////////////////////////////////////////////// - // LISTS - // - - - - - //Generic list of widgets - #region GetList - - // internal async Task GetList(IUrlHelper Url, string routeName, ListOptions listOptions) - // { - - // //TODO: Get template (MOCKED FOR NOW UNTIL PROOF OF CONCEPT) - - // var MOCK_WIDGET_DISPLAY_TEMPLATE_JSON = @" - // { - // ""full"":[""widgetname"",""widgetserial"",""widgetdollaramount"",""widgetroles"",""widgetstartdate"",""widgetactive"",""username""], - // ""mini"":[""widgetname"",""widgetserial""] - // } - // "; - // return await DataListFetcher.GetResponse(nameof(WidgetDataList), ct, Url, routeName, listOptions, MOCK_WIDGET_DISPLAY_TEMPLATE_JSON, UserId); - // } - - #endregion - - //TEST WIDGET->USER->EMAILADDRESS multi table list - //once this is working can replicate at will - #region TestGetWidgetUserEmailList - - // internal async Task TestGetWidgetUserEmailList(IUrlHelper Url, string routeName, ListOptions listOptions) - // { - // //var dlist=AyaNova.DataList.DataListFactory.GetListOfAllDataListKeyNames(); - - // //TODO: Get template (MOCKED FOR NOW UNTIL PROOF OF CONCEPT) - // var MOCK_WIDGET_USER_EMAIL_DISPLAY_TEMPLATE_JSON = @" - // { - // ""full"":[""widgetname"",""username"",""emailaddress"",""widgetactive""], - // ""mini"":[""widgetname"",""username"",""emailaddress""] - // } - // "; - - // return await DataListFetcher.GetResponse(nameof(TestWidgetUserEmailDataList), ct, Url, routeName, listOptions, MOCK_WIDGET_USER_EMAIL_DISPLAY_TEMPLATE_JSON, UserId); - // } - - #endregion - //////////////////////////////////////////////////////////////////////////////////////////////// //VALIDATION // @@ -324,18 +269,6 @@ namespace AyaNova.Biz //run validation and biz rules bool isNew = currentObj == null; - // if (isNew) - // { - // //WARNING: this is not really the "current" object, it's been modified already by caller - - // // //NEW widgets must be active - // // if (inObj.Active == null || ((bool)inObj.Active) == false) - // // { - // // AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Active", "New widget must be active"); - // // } - // } - - //Name required if (string.IsNullOrWhiteSpace(proposedObj.Name)) AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name"); @@ -387,23 +320,6 @@ namespace AyaNova.Biz CustomFieldsValidator.Validate(this, FormCustomization, proposedObj.CustomFields); } - //for debug purposes -#if (DEBUG) - //TESTING - //make a fake server error for ui testing purposes - // if (proposedObj.Count == 666) - // { - // AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Count", "Test field server error"); - // } - - //removed because seeding huge kept triggering this - // if (proposedObj.DollarAmount == 666.66M) - // { - // AddError(ApiErrorCode.INVALID_OPERATION, null, "This is a test of a general server error"); - // } - - //TESTING -#endif return; }