This commit is contained in:
2020-02-07 23:55:40 +00:00
parent bae4b862ab
commit 9c85b6c462
4 changed files with 96 additions and 89 deletions

View File

@@ -632,9 +632,7 @@ namespace AyaNova.Biz
i.UserOptions = new UserOptions();
//TimeZone Offset
//Note: can be null value if not set so need to check for that here specially
var tzo = j["TimeZoneOffset"].Value<decimal?>() ?? 0;
i.UserOptions.TimeZoneOffset = tzo;
//NOT IMPORTED / SUPPORTED
//Email address

View File

@@ -18,9 +18,16 @@ namespace AyaNova.Models
/// 8.5 for 8:30 time difference or 12.75 for 12:45 time differnce for example
/// </summary>
/// <value></value>
public decimal TimeZoneOffset { get; set; }
public int UiColor { get; set; }
//browser forced overrides
public string LanguageOverride { get; set; }
public string TimeZoneOverride { get; set; }
public string CurrencyName { get; set; }
public bool Hour12 { get; set; }
//relations
//https://docs.microsoft.com/en-us/ef/core/modeling/relationships#other-relationship-patterns
[JsonIgnore]//hide from being returned (as null anyway) in routes
@@ -31,7 +38,8 @@ namespace AyaNova.Models
public UserOptions()
{
TimeZoneOffset = 0;
CurrencyName = "USD";
Hour12 = true;
UiColor = 0;
}
}

View File

@@ -177,7 +177,7 @@ namespace AyaNova.Util
//Add user options table
await ExecQueryAsync("CREATE TABLE auseroptions (id BIGSERIAL PRIMARY KEY, " +
"userid bigint not null, timezoneoffset decimal(19,5) not null default 0, emailaddress text, uicolor int not null default 0)");
"userid bigint not null, languageoverride text, timezoneoverride text, currencyname text, hour12 bool not null, emailaddress text, uicolor int not null default 0)");
//Prime the db with the default MANAGER account

View File

@@ -71,13 +71,13 @@ namespace AyaNova.Util
await DbUtil.EmptyBizDataFromDatabaseForSeedingOrImportingAsync(log);
//Set the time zone of the manager account
using (var cct = ServiceProviderProvider.DBContext)
{
var mgr = await cct.UserOptions.FirstAsync(m => m.Id == 1);
mgr.TimeZoneOffset = timeZoneOffset;
await cct.SaveChangesAsync();
}
// //Set the default user options of the manager account
// using (var cct = ServiceProviderProvider.DBContext)
// {
// var mgr = await cct.UserOptions.FirstAsync(m => m.Id == 1);
// mgr.TimeZoneOffset = timeZoneOffset;
// await cct.SaveChangesAsync();
// }
//WIDGET sample form customization
@@ -138,7 +138,7 @@ namespace AyaNova.Util
//Seed special test data for integration testing
//log.LogInformation("Seeding known users");
await SeedKnownUsersAsync(log, timeZoneOffset);
await SeedKnownUsersAsync(log);
//log.LogInformation("Seeding all other data");
switch (slevel)
@@ -152,10 +152,10 @@ namespace AyaNova.Util
var watch = new Stopwatch();
watch.Start();
//Generate owner and lead tech
await GenSeedUserAsync(log, 1, AuthorizationRoles.BizAdminFull | AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryFull | AuthorizationRoles.OpsAdminFull, UserType.Schedulable, timeZoneOffset);
await GenSeedUserAsync(log, 1, AuthorizationRoles.BizAdminFull | AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryFull | AuthorizationRoles.OpsAdminFull, UserType.Schedulable);
//Generate one office person / secretary
await GenSeedUserAsync(log, 1, AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryFull | AuthorizationRoles.AccountingFull, UserType.NonSchedulable, timeZoneOffset);
await GenSeedUserAsync(log, 1, AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryFull | AuthorizationRoles.AccountingFull, UserType.NonSchedulable);
//PERF
watch.Stop();
await LogStatusAsync(JobId, LogJob, log, $"{SeededUserCount} Users seeded in {watch.ElapsedMilliseconds} ms");
@@ -182,40 +182,40 @@ namespace AyaNova.Util
var watch = new Stopwatch();
watch.Start();
//One IT administrator, can change ops but nothing else
await GenSeedUserAsync(log, 1, AuthorizationRoles.OpsAdminFull, UserType.NonSchedulable, timeZoneOffset);
await GenSeedUserAsync(log, 1, AuthorizationRoles.OpsAdminFull, UserType.NonSchedulable);
//One business administrator, can view ops issues
await GenSeedUserAsync(log, 1, AuthorizationRoles.BizAdminFull | AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable, timeZoneOffset);
await GenSeedUserAsync(log, 1, AuthorizationRoles.BizAdminFull | AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable);
//One owner who doesn't control anything but views stuff
await GenSeedUserAsync(log, 1, AuthorizationRoles.BizAdminLimited | AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited | AuthorizationRoles.OpsAdminLimited | AuthorizationRoles.SalesLimited, UserType.NonSchedulable, timeZoneOffset);
await GenSeedUserAsync(log, 1, AuthorizationRoles.BizAdminLimited | AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited | AuthorizationRoles.OpsAdminLimited | AuthorizationRoles.SalesLimited, UserType.NonSchedulable);
//20 techs
await GenSeedUserAsync(log, 20, AuthorizationRoles.TechFull | AuthorizationRoles.DispatchLimited, UserType.Schedulable, timeZoneOffset);
await GenSeedUserAsync(log, 20, AuthorizationRoles.TechFull | AuthorizationRoles.DispatchLimited, UserType.Schedulable);
//2 subcontractors
await GenSeedUserAsync(log, 2, AuthorizationRoles.SubContractorFull, UserType.Subcontractor, timeZoneOffset);
await GenSeedUserAsync(log, 2, AuthorizationRoles.SubContractorFull, UserType.Subcontractor);
//3 generic office people people
await GenSeedUserAsync(log, 3, AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited, UserType.NonSchedulable, timeZoneOffset);
await GenSeedUserAsync(log, 3, AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited, UserType.NonSchedulable);
//2 Full sales people
await GenSeedUserAsync(log, 2, AuthorizationRoles.SalesFull, UserType.NonSchedulable, timeZoneOffset);
await GenSeedUserAsync(log, 2, AuthorizationRoles.SalesFull, UserType.NonSchedulable);
//1 dispatch manager
await GenSeedUserAsync(log, 1, AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryLimited, UserType.NonSchedulable, timeZoneOffset);
await GenSeedUserAsync(log, 1, AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryLimited, UserType.NonSchedulable);
//1 Inventory manager
await GenSeedUserAsync(log, 1, AuthorizationRoles.InventoryFull | AuthorizationRoles.DispatchLimited, UserType.NonSchedulable, timeZoneOffset);
await GenSeedUserAsync(log, 1, AuthorizationRoles.InventoryFull | AuthorizationRoles.DispatchLimited, UserType.NonSchedulable);
//1 accountant / bookkeeper
await GenSeedUserAsync(log, 1, AuthorizationRoles.AccountingFull | AuthorizationRoles.BizAdminLimited, UserType.NonSchedulable, timeZoneOffset);
await GenSeedUserAsync(log, 1, AuthorizationRoles.AccountingFull | AuthorizationRoles.BizAdminLimited, UserType.NonSchedulable);
//10 full on customer users
await GenSeedUserAsync(log, 10, AuthorizationRoles.CustomerLimited, UserType.Customer, timeZoneOffset);
await GenSeedUserAsync(log, 10, AuthorizationRoles.CustomerLimited, UserType.Customer);
//10 limited customer users
await GenSeedUserAsync(log, 10, AuthorizationRoles.CustomerLimited, UserType.Customer, timeZoneOffset);
await GenSeedUserAsync(log, 10, AuthorizationRoles.CustomerLimited, UserType.Customer);
//PERF
watch.Stop();
await LogStatusAsync(JobId, LogJob, log, $"{SeededUserCount} Users seeded in {watch.ElapsedMilliseconds} ms");
@@ -246,52 +246,52 @@ namespace AyaNova.Util
watch.Start();
//IT administrator, can change ops but nothing else
await GenSeedUserAsync(log, 2, AuthorizationRoles.OpsAdminFull, UserType.NonSchedulable, timeZoneOffset);
await GenSeedUserAsync(log, 2, AuthorizationRoles.OpsAdminFull, UserType.NonSchedulable);
//business administrator, can view ops issues
await GenSeedUserAsync(log, 2, AuthorizationRoles.BizAdminFull | AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable, timeZoneOffset);
await GenSeedUserAsync(log, 2, AuthorizationRoles.BizAdminFull | AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable);
//owner / upper management who doesn't control anything but views stuff
await GenSeedUserAsync(log, 5, AuthorizationRoles.BizAdminLimited | AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited | AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable, timeZoneOffset);
await GenSeedUserAsync(log, 5, AuthorizationRoles.BizAdminLimited | AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited | AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable);
//100 techs
await GenSeedUserAsync(log, 100, AuthorizationRoles.TechFull | AuthorizationRoles.DispatchLimited, UserType.Schedulable, timeZoneOffset);
await GenSeedUserAsync(log, 100, AuthorizationRoles.TechFull | AuthorizationRoles.DispatchLimited, UserType.Schedulable);
//limited techs
await GenSeedUserAsync(log, 50, AuthorizationRoles.TechLimited | AuthorizationRoles.DispatchLimited, UserType.Schedulable, timeZoneOffset);
await GenSeedUserAsync(log, 50, AuthorizationRoles.TechLimited | AuthorizationRoles.DispatchLimited, UserType.Schedulable);
//20 subcontractors
await GenSeedUserAsync(log, 20, AuthorizationRoles.SubContractorFull, UserType.Subcontractor, timeZoneOffset);
await GenSeedUserAsync(log, 20, AuthorizationRoles.SubContractorFull, UserType.Subcontractor);
//10 limited subcontractors
await GenSeedUserAsync(log, 10, AuthorizationRoles.SubContractorLimited, UserType.Subcontractor, timeZoneOffset);
await GenSeedUserAsync(log, 10, AuthorizationRoles.SubContractorLimited, UserType.Subcontractor);
//30 generic office people people
await GenSeedUserAsync(log, 30, AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited, UserType.NonSchedulable, timeZoneOffset);
await GenSeedUserAsync(log, 30, AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited, UserType.NonSchedulable);
//10 Full sales people
await GenSeedUserAsync(log, 10, AuthorizationRoles.SalesFull, UserType.NonSchedulable, timeZoneOffset);
await GenSeedUserAsync(log, 10, AuthorizationRoles.SalesFull, UserType.NonSchedulable);
//5 Limited sales people
await GenSeedUserAsync(log, 5, AuthorizationRoles.SalesLimited, UserType.NonSchedulable, timeZoneOffset);
await GenSeedUserAsync(log, 5, AuthorizationRoles.SalesLimited, UserType.NonSchedulable);
//5 dispatch manager
await GenSeedUserAsync(log, 5, AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryLimited, UserType.NonSchedulable, timeZoneOffset);
await GenSeedUserAsync(log, 5, AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryLimited, UserType.NonSchedulable);
//5 Inventory manager
await GenSeedUserAsync(log, 5, AuthorizationRoles.InventoryFull | AuthorizationRoles.DispatchLimited, UserType.NonSchedulable, timeZoneOffset);
await GenSeedUserAsync(log, 5, AuthorizationRoles.InventoryFull | AuthorizationRoles.DispatchLimited, UserType.NonSchedulable);
//10 Inventory manager assistants
await GenSeedUserAsync(log, 5, AuthorizationRoles.InventoryLimited, UserType.NonSchedulable, timeZoneOffset);
await GenSeedUserAsync(log, 5, AuthorizationRoles.InventoryLimited, UserType.NonSchedulable);
//5 accountant / bookkeeper
await GenSeedUserAsync(log, 5, AuthorizationRoles.AccountingFull | AuthorizationRoles.BizAdminLimited, UserType.NonSchedulable, timeZoneOffset);
await GenSeedUserAsync(log, 5, AuthorizationRoles.AccountingFull | AuthorizationRoles.BizAdminLimited, UserType.NonSchedulable);
//100 full on customer users
await GenSeedUserAsync(log, 20, AuthorizationRoles.CustomerFull, UserType.Customer, timeZoneOffset);
await GenSeedUserAsync(log, 20, AuthorizationRoles.CustomerFull, UserType.Customer);
//100 limited customer users
await GenSeedUserAsync(log, 20, AuthorizationRoles.CustomerLimited, UserType.Customer, timeZoneOffset);
await GenSeedUserAsync(log, 20, AuthorizationRoles.CustomerLimited, UserType.Customer);
//PERF
watch.Stop();
@@ -323,52 +323,52 @@ namespace AyaNova.Util
watch.Start();
//IT administrator, can change ops but nothing else
await GenSeedUserAsync(log, 10, AuthorizationRoles.OpsAdminFull, UserType.NonSchedulable, timeZoneOffset);
await GenSeedUserAsync(log, 10, AuthorizationRoles.OpsAdminFull, UserType.NonSchedulable);
//business administrator, can view ops issues
await GenSeedUserAsync(log, 10, AuthorizationRoles.BizAdminFull | AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable, timeZoneOffset);
await GenSeedUserAsync(log, 10, AuthorizationRoles.BizAdminFull | AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable);
//owner / upper management who doesn't control anything but views stuff
await GenSeedUserAsync(log, 20, AuthorizationRoles.BizAdminLimited | AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited | AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable, timeZoneOffset);
await GenSeedUserAsync(log, 20, AuthorizationRoles.BizAdminLimited | AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited | AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable);
//regular techs
await GenSeedUserAsync(log, 500, AuthorizationRoles.TechFull | AuthorizationRoles.DispatchLimited, UserType.Schedulable, timeZoneOffset);
await GenSeedUserAsync(log, 500, AuthorizationRoles.TechFull | AuthorizationRoles.DispatchLimited, UserType.Schedulable);
//limited techs
await GenSeedUserAsync(log, 200, AuthorizationRoles.TechLimited | AuthorizationRoles.DispatchLimited, UserType.Schedulable, timeZoneOffset);
await GenSeedUserAsync(log, 200, AuthorizationRoles.TechLimited | AuthorizationRoles.DispatchLimited, UserType.Schedulable);
//subcontractors
await GenSeedUserAsync(log, 80, AuthorizationRoles.SubContractorFull, UserType.Subcontractor, timeZoneOffset);
await GenSeedUserAsync(log, 80, AuthorizationRoles.SubContractorFull, UserType.Subcontractor);
//limited subcontractors
await GenSeedUserAsync(log, 40, AuthorizationRoles.SubContractorLimited, UserType.Subcontractor, timeZoneOffset);
await GenSeedUserAsync(log, 40, AuthorizationRoles.SubContractorLimited, UserType.Subcontractor);
//generic office people people
await GenSeedUserAsync(log, 200, AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited, UserType.NonSchedulable, timeZoneOffset);
await GenSeedUserAsync(log, 200, AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited, UserType.NonSchedulable);
//20 Full sales people
await GenSeedUserAsync(log, 20, AuthorizationRoles.SalesFull, UserType.NonSchedulable, timeZoneOffset);
await GenSeedUserAsync(log, 20, AuthorizationRoles.SalesFull, UserType.NonSchedulable);
//10 Limited sales people
await GenSeedUserAsync(log, 10, AuthorizationRoles.SalesLimited, UserType.NonSchedulable, timeZoneOffset);
await GenSeedUserAsync(log, 10, AuthorizationRoles.SalesLimited, UserType.NonSchedulable);
//dispatch manager
await GenSeedUserAsync(log, 20, AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryLimited, UserType.NonSchedulable, timeZoneOffset);
await GenSeedUserAsync(log, 20, AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryLimited, UserType.NonSchedulable);
//Inventory manager
await GenSeedUserAsync(log, 40, AuthorizationRoles.InventoryFull | AuthorizationRoles.DispatchLimited, UserType.NonSchedulable, timeZoneOffset);
await GenSeedUserAsync(log, 40, AuthorizationRoles.InventoryFull | AuthorizationRoles.DispatchLimited, UserType.NonSchedulable);
//Inventory manager assistants
await GenSeedUserAsync(log, 20, AuthorizationRoles.InventoryLimited, UserType.NonSchedulable, timeZoneOffset);
await GenSeedUserAsync(log, 20, AuthorizationRoles.InventoryLimited, UserType.NonSchedulable);
//accountant / bookkeeper
await GenSeedUserAsync(log, 20, AuthorizationRoles.AccountingFull | AuthorizationRoles.BizAdminLimited, UserType.NonSchedulable, timeZoneOffset);
await GenSeedUserAsync(log, 20, AuthorizationRoles.AccountingFull | AuthorizationRoles.BizAdminLimited, UserType.NonSchedulable);
//full on customer users
await GenSeedUserAsync(log, 200, AuthorizationRoles.CustomerFull, UserType.Customer, timeZoneOffset);
await GenSeedUserAsync(log, 200, AuthorizationRoles.CustomerFull, UserType.Customer);
//limited customer users
await GenSeedUserAsync(log, 50, AuthorizationRoles.CustomerLimited, UserType.Customer, timeZoneOffset);
await GenSeedUserAsync(log, 50, AuthorizationRoles.CustomerLimited, UserType.Customer);
//PERF
watch.Stop();
@@ -434,43 +434,43 @@ namespace AyaNova.Util
//////////////////////////////////////////////////////
//Seed test data for integration tests
//
public static async Task SeedKnownUsersAsync(ILogger log, decimal timeZoneOffset)
public static async Task SeedKnownUsersAsync(ILogger log)
{
try
{
//TEST USERS
//one of each role type
await GenSeedUserAsync(log, 1, AuthorizationRoles.BizAdminLimited, UserType.NonSchedulable, timeZoneOffset, "BizAdminLimited", "BizAdminLimited");
await GenSeedUserAsync(log, 1, AuthorizationRoles.BizAdminFull, UserType.NonSchedulable, timeZoneOffset, "BizAdminFull", "BizAdminFull");
await GenSeedUserAsync(log, 1, AuthorizationRoles.DispatchLimited, UserType.NonSchedulable, timeZoneOffset, "DispatchLimited", "DispatchLimited");
await GenSeedUserAsync(log, 1, AuthorizationRoles.DispatchFull, UserType.NonSchedulable, timeZoneOffset, "DispatchFull", "DispatchFull");
await GenSeedUserAsync(log, 1, AuthorizationRoles.InventoryLimited, UserType.NonSchedulable, timeZoneOffset, "InventoryLimited", "InventoryLimited");
await GenSeedUserAsync(log, 1, AuthorizationRoles.InventoryFull, UserType.NonSchedulable, timeZoneOffset, "InventoryFull", "InventoryFull");
await GenSeedUserAsync(log, 1, AuthorizationRoles.AccountingFull, UserType.NonSchedulable, timeZoneOffset, "Accounting", "Accounting");
await GenSeedUserAsync(log, 1, AuthorizationRoles.TechLimited, UserType.Schedulable, timeZoneOffset, "TechLimited", "TechLimited");
await GenSeedUserAsync(log, 1, AuthorizationRoles.TechFull, UserType.Schedulable, timeZoneOffset, "TechFull", "TechFull");
await GenSeedUserAsync(log, 1, AuthorizationRoles.SalesLimited, UserType.NonSchedulable, timeZoneOffset, "SalesLimited", "SalesLimited");
await GenSeedUserAsync(log, 1, AuthorizationRoles.SalesFull, UserType.NonSchedulable, timeZoneOffset, "SalesFull", "SalesFull");
await GenSeedUserAsync(log, 1, AuthorizationRoles.BizAdminLimited, UserType.NonSchedulable, "BizAdminLimited", "BizAdminLimited");
await GenSeedUserAsync(log, 1, AuthorizationRoles.BizAdminFull, UserType.NonSchedulable, "BizAdminFull", "BizAdminFull");
await GenSeedUserAsync(log, 1, AuthorizationRoles.DispatchLimited, UserType.NonSchedulable, "DispatchLimited", "DispatchLimited");
await GenSeedUserAsync(log, 1, AuthorizationRoles.DispatchFull, UserType.NonSchedulable, "DispatchFull", "DispatchFull");
await GenSeedUserAsync(log, 1, AuthorizationRoles.InventoryLimited, UserType.NonSchedulable, "InventoryLimited", "InventoryLimited");
await GenSeedUserAsync(log, 1, AuthorizationRoles.InventoryFull, UserType.NonSchedulable, "InventoryFull", "InventoryFull");
await GenSeedUserAsync(log, 1, AuthorizationRoles.AccountingFull, UserType.NonSchedulable, "Accounting", "Accounting");
await GenSeedUserAsync(log, 1, AuthorizationRoles.TechLimited, UserType.Schedulable, "TechLimited", "TechLimited");
await GenSeedUserAsync(log, 1, AuthorizationRoles.TechFull, UserType.Schedulable, "TechFull", "TechFull");
await GenSeedUserAsync(log, 1, AuthorizationRoles.SalesLimited, UserType.NonSchedulable, "SalesLimited", "SalesLimited");
await GenSeedUserAsync(log, 1, AuthorizationRoles.SalesFull, UserType.NonSchedulable, "SalesFull", "SalesFull");
await GenSeedUserAsync(log, 1, AuthorizationRoles.SubContractorLimited, UserType.Subcontractor, timeZoneOffset, "SubContractorLimited", "SubContractorLimited");
await GenSeedUserAsync(log, 1, AuthorizationRoles.SubContractorFull, UserType.Subcontractor, timeZoneOffset, "SubContractorFull", "SubContractorFull");
await GenSeedUserAsync(log, 1, AuthorizationRoles.CustomerLimited, UserType.Customer, timeZoneOffset, "CustomerLimited", "CustomerLimited");
await GenSeedUserAsync(log, 1, AuthorizationRoles.CustomerFull, UserType.Customer, timeZoneOffset, "CustomerFull", "CustomerFull");
await GenSeedUserAsync(log, 1, AuthorizationRoles.SubContractorLimited, UserType.Subcontractor, "SubContractorLimited", "SubContractorLimited");
await GenSeedUserAsync(log, 1, AuthorizationRoles.SubContractorFull, UserType.Subcontractor, "SubContractorFull", "SubContractorFull");
await GenSeedUserAsync(log, 1, AuthorizationRoles.CustomerLimited, UserType.Customer, "CustomerLimited", "CustomerLimited");
await GenSeedUserAsync(log, 1, AuthorizationRoles.CustomerFull, UserType.Customer, "CustomerFull", "CustomerFull");
await GenSeedUserAsync(log, 1, AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable, timeZoneOffset, "OpsAdminLimited", "OpsAdminLimited");
await GenSeedUserAsync(log, 1, AuthorizationRoles.OpsAdminFull, UserType.NonSchedulable, timeZoneOffset, "OpsAdminFull", "OpsAdminFull");
await GenSeedUserAsync(log, 1, AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable, "OpsAdminLimited", "OpsAdminLimited");
await GenSeedUserAsync(log, 1, AuthorizationRoles.OpsAdminFull, UserType.NonSchedulable, "OpsAdminFull", "OpsAdminFull");
//PRIVACY TEST USER - this is used for a test to see if user info leaks into the logs
await GenSeedUserAsync(log, 1, AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable, timeZoneOffset, "TEST_PRIVACY_USER_ACCOUNT", "TEST_PRIVACY_USER_ACCOUNT");
await GenSeedUserAsync(log, 1, AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable, "TEST_PRIVACY_USER_ACCOUNT", "TEST_PRIVACY_USER_ACCOUNT");
//TEST NOT ACTIVE - this is used for a test to see if inactive user can login
await GenSeedUserAsync(log, 1, AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable, timeZoneOffset, false, "TEST_INACTIVE", "TEST_INACTIVE");
await GenSeedUserAsync(log, 1, AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable, false, "TEST_INACTIVE", "TEST_INACTIVE");
//Alternate locale users for each stock locale
await GenSeedUserAsync(log, 1, AuthorizationRoles.All, UserType.Administrator, timeZoneOffset, true, "de", "de", await LocaleBiz.LocaleNameToIdStaticAsync("de"));
await GenSeedUserAsync(log, 1, AuthorizationRoles.All, UserType.Administrator, timeZoneOffset, true, "es", "es", await LocaleBiz.LocaleNameToIdStaticAsync("es"));
await GenSeedUserAsync(log, 1, AuthorizationRoles.All, UserType.Administrator, timeZoneOffset, true, "fr", "fr", await LocaleBiz.LocaleNameToIdStaticAsync("fr"));
await GenSeedUserAsync(log, 1, AuthorizationRoles.All, UserType.Administrator, true, "de", "de", await LocaleBiz.LocaleNameToIdStaticAsync("de"));
await GenSeedUserAsync(log, 1, AuthorizationRoles.All, UserType.Administrator, true, "es", "es", await LocaleBiz.LocaleNameToIdStaticAsync("es"));
await GenSeedUserAsync(log, 1, AuthorizationRoles.All, UserType.Administrator, true, "fr", "fr", await LocaleBiz.LocaleNameToIdStaticAsync("fr"));
}
@@ -489,15 +489,14 @@ namespace AyaNova.Util
/// <param name="log"></param>
/// <param name="count"></param>
/// <param name="roles"></param>
/// <param name="userType"></param>
/// <param name="timeZoneOffset"></param>
/// <param name="userType"></param>
/// <param name="login"></param>
/// <param name="password"></param>
public static async Task GenSeedUserAsync(ILogger log, int count, AuthorizationRoles roles, UserType userType, decimal timeZoneOffset, string login, string password)
public static async Task GenSeedUserAsync(ILogger log, int count, AuthorizationRoles roles, UserType userType, string login, string password)
{
try
{
await GenSeedUserAsync(log, count, roles, userType, timeZoneOffset, true, login, password);
await GenSeedUserAsync(log, count, roles, userType, true, login, password);
}
catch
{
@@ -507,7 +506,7 @@ namespace AyaNova.Util
public static async Task GenSeedUserAsync(ILogger log, int count, AuthorizationRoles roles, UserType userType, decimal timeZoneOffset,
public static async Task GenSeedUserAsync(ILogger log, int count, AuthorizationRoles roles, UserType userType,
bool active = true, string login = null, string password = null, long localeId = 0)
{
if (localeId == 0)
@@ -551,7 +550,9 @@ namespace AyaNova.Util
//Children and relations
u.UserOptions = new UserOptions();
u.UserOptions.EmailAddress = p.Email.Replace("gmail.com", "helloayanova.com").Replace("hotmail.com", "helloayanova.com").Replace("yahoo.com", "helloayanova.com");
u.UserOptions.TimeZoneOffset = timeZoneOffset;
u.UserOptions.Hour12 = true;
u.UserOptions.CurrencyName = "USD";
//this seems wrong but is actually faster!?