From ff26081d6ba33ea3ef8b14bd645d3afd471fc349 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 21 Jan 2020 01:14:57 +0000 Subject: [PATCH] --- server/AyaNova/DataList/DataListFactory.cs | 20 +++++++ .../AyaNova/DataList/TestWidgetUserEmail.cs | 56 +++++++++++++++++++ server/AyaNova/biz/AuthorizationRoles.cs | 6 +- 3 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 server/AyaNova/DataList/DataListFactory.cs create mode 100644 server/AyaNova/DataList/TestWidgetUserEmail.cs diff --git a/server/AyaNova/DataList/DataListFactory.cs b/server/AyaNova/DataList/DataListFactory.cs new file mode 100644 index 00000000..d3f4bc2a --- /dev/null +++ b/server/AyaNova/DataList/DataListFactory.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using AyaNova.Biz; +namespace AyaNova.DataList +{ + internal static class DataListFactory + { + internal const string TEST_WIDGET_USER_EMAIL_ADDRESS_LIST_KEY = "TEST_WIDGET_USER_EMAIL_ADDRESS_LIST";//for development testing, not a real thing going forward + + internal static IAyaDataList GetAyaDataList(string ListKey) + { + switch (ListKey) + { + case TEST_WIDGET_USER_EMAIL_ADDRESS_LIST_KEY: + return new TestWidgetUserEmail(); + default: + throw new System.ArgumentOutOfRangeException($"DataListFactory: Unknown key \"{ListKey}\""); + } + } + } +} \ No newline at end of file diff --git a/server/AyaNova/DataList/TestWidgetUserEmail.cs b/server/AyaNova/DataList/TestWidgetUserEmail.cs new file mode 100644 index 00000000..a3a97b18 --- /dev/null +++ b/server/AyaNova/DataList/TestWidgetUserEmail.cs @@ -0,0 +1,56 @@ +using System.Collections.Generic; +using AyaNova.Biz; +namespace AyaNova.DataList +{ + internal class TestWidgetUserEmail : IAyaDataList + { + + public string ListKey => DataListFactory.TEST_WIDGET_USER_EMAIL_ADDRESS_LIST_KEY; + + public string SQLFrom => "throw new System.NotImplementedException()"; + + public List FieldDefinitions + { + get + { + List l = new List(); + l.Add(new AyaDataListFieldDefinition { FieldKey = "df", AyaObjectType = (int)AyaType.Widget, SqlIdColumnName = "awidget.id" }); + l.Add(new AyaDataListFieldDefinition + { + FieldKey = "widgetname", + LtKey = "WidgetName", + UiFieldDataType = (int)AyaUiFieldDataType.Text, + AyaObjectType = (int)AyaType.Widget, + SqlIdColumnName = "awidget.id", + SqlValueColumnName = "awidget.name" + }); + l.Add(new AyaDataListFieldDefinition + { + FieldKey = "username", + LtKey = "User", + UiFieldDataType = (int)AyaUiFieldDataType.Text, + AyaObjectType = (int)AyaType.User, + SqlIdColumnName = "auser.id", + SqlValueColumnName = "auser.name" + }); + l.Add(new AyaDataListFieldDefinition + { + LtKey = "UserEmailAddress", + FieldKey = "emailaddress", + SqlValueColumnName = "auseroptions.emailaddress", + UiFieldDataType = (int)AyaUiFieldDataType.EmailAddress + }); + l.Add(new AyaDataListFieldDefinition + { + LtKey = "Active", + FieldKey = "widgetactive", + SqlValueColumnName = "awidget.active", + UiFieldDataType = (int)AyaUiFieldDataType.Bool + }); + } + } + + public AuthorizationRoles AllowedRoles => AuthorizationRoles.AllInternalStaff;//anyone but clients and subcontractors (just for test) + } + +} \ No newline at end of file diff --git a/server/AyaNova/biz/AuthorizationRoles.cs b/server/AyaNova/biz/AuthorizationRoles.cs index 2eb8b743..03cb6c86 100644 --- a/server/AyaNova/biz/AuthorizationRoles.cs +++ b/server/AyaNova/biz/AuthorizationRoles.cs @@ -53,7 +53,11 @@ namespace AyaNova.Biz ///Anyone of any role All = BizAdminLimited | BizAdminFull | DispatchLimited | DispatchFull | InventoryLimited | InventoryFull | AccountingFull | TechLimited | TechFull | SubContractorLimited | - SubContractorFull | ClientLimited | ClientFull | OpsAdminLimited | OpsAdminFull | SalesFull | SalesLimited + SubContractorFull | ClientLimited | ClientFull | OpsAdminLimited | OpsAdminFull | SalesFull | SalesLimited, + + ///Anyone inside company + AllInternalStaff = BizAdminLimited | BizAdminFull | DispatchLimited | DispatchFull | InventoryLimited | + InventoryFull | AccountingFull | TechLimited | TechFull | OpsAdminLimited | OpsAdminFull | SalesFull | SalesLimited }//end AuthorizationRoles //, 65536, 131072, 262144, 524288, 1,048,576