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