This commit is contained in:
@@ -380,7 +380,7 @@ namespace AyaNova
|
||||
// ******************** TESTING WIPE DB *****************************
|
||||
//
|
||||
//Set this to true to wipe the db and reinstall a trial license and re-seed the data
|
||||
var TESTING_REFRESH_DB = false;//#############################################################################################
|
||||
var TESTING_REFRESH_DB = true;//#############################################################################################
|
||||
|
||||
#if (DEBUG)
|
||||
//TESTING
|
||||
|
||||
@@ -354,8 +354,12 @@ namespace AyaNova.Biz
|
||||
return v.First();
|
||||
}
|
||||
|
||||
public static long LocaleNameToIdStatic(string localeName, AyContext ct)
|
||||
public static long LocaleNameToIdStatic(string localeName, AyContext ct = null)
|
||||
{
|
||||
if (ct == null)
|
||||
{
|
||||
ct = ServiceProviderProvider.DBContext;
|
||||
}
|
||||
var v = ct.Locale.Where(c => c.Name == localeName).Select(x => x.Id);
|
||||
if (v.Count() < 1) return ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID;
|
||||
return v.First();
|
||||
|
||||
@@ -330,6 +330,13 @@ namespace AyaNova.Util
|
||||
|
||||
//TEST NOT ACTIVE - this is used for a test to see if inactive user can login
|
||||
GenSeedUser(log, 1, AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable, false, "TEST_INACTIVE", "TEST_INACTIVE");
|
||||
|
||||
//Alternate locale users for each stock locale
|
||||
GenSeedUser(log, 1, AuthorizationRoles.BizAdminFull, UserType.Administrator, true, "de", "de", LocaleBiz.LocaleNameToIdStatic("de"));
|
||||
GenSeedUser(log, 1, AuthorizationRoles.BizAdminFull, UserType.Administrator, true, "es", "es", LocaleBiz.LocaleNameToIdStatic("es"));
|
||||
GenSeedUser(log, 1, AuthorizationRoles.BizAdminFull, UserType.Administrator, true, "fr", "fr", LocaleBiz.LocaleNameToIdStatic("fr"));
|
||||
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -364,7 +371,7 @@ namespace AyaNova.Util
|
||||
|
||||
|
||||
|
||||
public static void GenSeedUser(ILogger log, int count, AuthorizationRoles roles, UserType userType, bool active = true, string login = null, string password = null)
|
||||
public static void GenSeedUser(ILogger log, int count, AuthorizationRoles roles, UserType userType, bool active = true, string login = null, string password = null, long localeId = 0)
|
||||
{
|
||||
|
||||
UserBiz Biz = UserBiz.GetBizInternal(ServiceProviderProvider.DBContext);
|
||||
@@ -392,7 +399,7 @@ namespace AyaNova.Util
|
||||
else
|
||||
u.Password = u.Login;
|
||||
u.Roles = roles;
|
||||
u.LocaleId = ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID;
|
||||
u.LocaleId = localeId == 0 ? ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID : localeId;
|
||||
u.UserType = userType;
|
||||
//TODO: After have USER and HEADOFFICE and VENDOR, if usertype is subcontractor or client or headoffice it needs to set a corresponding user's parent org record id to go with it
|
||||
|
||||
|
||||
Reference in New Issue
Block a user