This commit is contained in:
2020-04-01 00:36:02 +00:00
parent 88c974d857
commit 7d4476f299

View File

@@ -498,7 +498,9 @@ namespace AyaNova.Util
{ {
try try
{ {
var KnownUserTags=new List<string>();
KnownUserTags.Add("known-user");
KnownUserTags.Add("test-role-user");
//TEST USERS //TEST USERS
//one of each role type //one of each role type
await GenSeedUserAsync(log, 1, AuthorizationRoles.BizAdminLimited, UserType.NonSchedulable, "BizAdminLimited", "BizAdminLimited"); await GenSeedUserAsync(log, 1, AuthorizationRoles.BizAdminLimited, UserType.NonSchedulable, "BizAdminLimited", "BizAdminLimited");
@@ -545,18 +547,12 @@ namespace AyaNova.Util
/// <summary> /// <summary>
/// Generate seed user with active=true /// Generate seed user with active=true
/// (override to save typing) /// (override to save typing)
/// </summary> /// </summary>
/// <param name="log"></param> public static async Task GenSeedUserAsync(ILogger log, int count, AuthorizationRoles roles, UserType userType, string login, string password, List<string> tags = null)
/// <param name="count"></param>
/// <param name="roles"></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, string login, string password)
{ {
try try
{ {
await GenSeedUserAsync(log, count, roles, userType, true, login, password); await GenSeedUserAsync(log, count, roles, userType, true, login, password, 0, tags);
} }
catch catch
{ {
@@ -567,7 +563,7 @@ namespace AyaNova.Util
public static async Task GenSeedUserAsync(ILogger log, int count, AuthorizationRoles roles, UserType userType, public static async Task GenSeedUserAsync(ILogger log, int count, AuthorizationRoles roles, UserType userType,
bool active = true, string login = null, string password = null, long translationId = 0) bool active = true, string login = null, string password = null, long translationId = 0, List<string> tags = null)
{ {
if (translationId == 0) if (translationId == 0)
translationId = ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID; translationId = ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID;
@@ -604,9 +600,13 @@ namespace AyaNova.Util
u.UserType = userType; u.UserType = userType;
u.EmployeeNumber = "A-" + (454 + SeededUserCount).ToString() + "-Y"; u.EmployeeNumber = "A-" + (454 + SeededUserCount).ToString() + "-Y";
u.Notes = Fake.Lorem.Sentence();//Fake.Lorem.Paragraph(2); u.Notes = Fake.Lorem.Sentence();//Fake.Lorem.Paragraph(2);
//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 //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
u.Tags = RandomTags(Fake); //use provided tags or generate them
if (tags == null)
u.Tags = RandomTags(Fake);
else
u.Tags = tags;
//Children and relations //Children and relations
u.UserOptions = new UserOptions(); u.UserOptions = new UserOptions();
u.UserOptions.TranslationId = translationId; u.UserOptions.TranslationId = translationId;