From 9478cd72b8910bc095f656901e9953d9137d585f Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 29 Nov 2018 18:07:37 +0000 Subject: [PATCH] --- .../AyaNova/Controllers/WidgetController.cs | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/server/AyaNova/Controllers/WidgetController.cs b/server/AyaNova/Controllers/WidgetController.cs index 4b32b444..78aa1f84 100644 --- a/server/AyaNova/Controllers/WidgetController.cs +++ b/server/AyaNova/Controllers/WidgetController.cs @@ -78,12 +78,38 @@ namespace AyaNova.Api.Controllers } + /// + /// Get filter options + /// + /// Required roles: + /// BizAdminFull, InventoryFull, BizAdminLimited, InventoryLimited, TechFull, TechLimited, Accounting + /// + /// + /// Filter options + [HttpGet("FilterOptions")] + public ActionResult FilterOptions() + { + 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.IsAuthorizedToReadFullRecord(HttpContext.Items, biz.BizType)) + return StatusCode(401, new ApiNotAuthorizedResponse()); + + return Ok(new + { + data = biz.FilterOptions + }); + } + /// /// Get paged list of widgets /// - /// Required roles: Any - /// + /// Required roles: + /// BizAdminFull, InventoryFull, BizAdminLimited, InventoryLimited, TechFull, TechLimited, Accounting /// /// 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