This commit is contained in:
@@ -201,7 +201,7 @@ namespace AyaNova.Util
|
||||
{
|
||||
LogUpdateMessage(log);
|
||||
|
||||
exec("CREATE TABLE atag (id BIGSERIAL PRIMARY KEY, ownerid bigint not null, name varchar(35) not null)");
|
||||
exec("CREATE TABLE atag (id BIGSERIAL PRIMARY KEY, ownerid bigint not null, name varchar(255) not null)");
|
||||
exec("CREATE UNIQUE INDEX tagname_idx ON atag (name);");
|
||||
exec("CREATE TABLE atagmap (id BIGSERIAL PRIMARY KEY, ownerid bigint not null," +
|
||||
"tagid bigint not null REFERENCES atag (id), tagtoobjectid bigint not null, tagtoobjecttype integer not null)");
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace AyaNova.Util
|
||||
|
||||
public enum SeedLevel { SmallOneManShopTrialDataSet, MediumLocalServiceCompanyTrialDataSet, LargeCorporateMultiRegionalTrialDataSet };
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
//Seed database for trial and testing purposes
|
||||
//
|
||||
@@ -199,6 +199,9 @@ namespace AyaNova.Util
|
||||
//PRIVACY TEST USER - this is used for a test to see if user info leaks into the logs
|
||||
GenSeedUser(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
|
||||
GenSeedUser(1, AuthorizationRoles.OpsAdminLimited, UserType.NonSchedulable, false, "TEST_INACTIVE", "TEST_INACTIVE");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -206,17 +209,32 @@ namespace AyaNova.Util
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Generate seed user with active=true
|
||||
/// (override to save typing)
|
||||
/// </summary>
|
||||
/// <param name="count"></param>
|
||||
/// <param name="roles"></param>
|
||||
/// <param name="userType"></param>
|
||||
/// <param name="login"></param>
|
||||
/// <param name="password"></param>
|
||||
public static void GenSeedUser(int count, AuthorizationRoles roles, UserType userType, string login, string password)
|
||||
{
|
||||
GenSeedUser(count, roles, userType, true, login, password);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
//Seed user - default login / pw is first name
|
||||
//
|
||||
public static void GenSeedUser(int count, AuthorizationRoles roles, UserType userType, string login = null, string password = null)
|
||||
public static void GenSeedUser(int count, AuthorizationRoles roles, UserType userType, bool active = true, string login = null, string password = null)
|
||||
{
|
||||
AyContext ct = ServiceProviderProvider.DBContext;
|
||||
|
||||
for (int x = 0; x < count; x++)
|
||||
{
|
||||
User u = new User();
|
||||
u.OwnerId=1;
|
||||
u.Active = active;
|
||||
u.OwnerId = 1;
|
||||
var p = new Bogus.Person();
|
||||
u.Name = p.FullName;
|
||||
u.Salt = Hasher.GenerateSalt();
|
||||
|
||||
Reference in New Issue
Block a user