This commit is contained in:
@@ -25,7 +25,7 @@ namespace AyaNova.Biz
|
||||
/// <summary>
|
||||
/// If true, relaxes validation rules so that incomplete data can be imported
|
||||
/// </summary>
|
||||
bool V7ValidationImportMode { get; set; }
|
||||
bool SeedOrImportRelaxedRulesMode { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -21,14 +21,14 @@ namespace AyaNova.Biz
|
||||
private readonly AyContext ct;
|
||||
public readonly long userId;
|
||||
private readonly AuthorizationRoles userRoles;
|
||||
public bool V7ValidationImportMode { get; set; }
|
||||
public bool SeedOrImportRelaxedRulesMode { get; set; }
|
||||
|
||||
internal LocaleBiz(AyContext dbcontext, long currentUserId, AuthorizationRoles UserRoles)
|
||||
{
|
||||
ct = dbcontext;
|
||||
userId = currentUserId;
|
||||
userRoles = UserRoles;
|
||||
V7ValidationImportMode = false;//default
|
||||
SeedOrImportRelaxedRulesMode = false;//default
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -21,14 +21,14 @@ namespace AyaNova.Biz
|
||||
public readonly long userId;
|
||||
private readonly AuthorizationRoles userRoles;
|
||||
|
||||
public bool V7ValidationImportMode { get; set; }
|
||||
public bool SeedOrImportRelaxedRulesMode { get; set; }
|
||||
|
||||
internal TagBiz(AyContext dbcontext, long currentUserId, AuthorizationRoles UserRoles)
|
||||
{
|
||||
ct = dbcontext;
|
||||
userId = currentUserId;
|
||||
userRoles = UserRoles;
|
||||
V7ValidationImportMode = false;//default
|
||||
SeedOrImportRelaxedRulesMode = false;//default
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace AyaNova.Biz
|
||||
public readonly long UserId;
|
||||
public readonly long UserLocaleId;
|
||||
private readonly AuthorizationRoles userRoles;
|
||||
public bool V7ValidationImportMode { get; set; }
|
||||
public bool SeedOrImportRelaxedRulesMode { get; set; }
|
||||
|
||||
internal UserBiz(AyContext dbcontext, long currentUserId, long userLocaleId, AuthorizationRoles UserRoles)
|
||||
{
|
||||
@@ -31,7 +31,7 @@ namespace AyaNova.Biz
|
||||
UserId = currentUserId;
|
||||
UserLocaleId = userLocaleId;
|
||||
userRoles = UserRoles;
|
||||
V7ValidationImportMode = false;//default
|
||||
SeedOrImportRelaxedRulesMode = false;//default
|
||||
}
|
||||
|
||||
//todo:
|
||||
@@ -68,7 +68,7 @@ namespace AyaNova.Biz
|
||||
User outObj = inObj;
|
||||
outObj.OwnerId = UserId;
|
||||
//Seeder sets user options in advance so no need to create them here in that case
|
||||
if(outObj.UserOptions==null)
|
||||
if (outObj.UserOptions == null)
|
||||
outObj.UserOptions = new UserOptions(UserId);
|
||||
|
||||
await ct.User.AddAsync(outObj);
|
||||
@@ -383,7 +383,7 @@ namespace AyaNova.Biz
|
||||
}
|
||||
|
||||
//Validate client type user
|
||||
if (!V7ValidationImportMode && proposedObj.UserType == UserType.Client)
|
||||
if (!SeedOrImportRelaxedRulesMode && proposedObj.UserType == UserType.Client)
|
||||
{
|
||||
if (proposedObj.ClientId == null || proposedObj.ClientId == 0)
|
||||
{
|
||||
@@ -397,7 +397,7 @@ namespace AyaNova.Biz
|
||||
}
|
||||
|
||||
//Validate headoffice type user
|
||||
if (!V7ValidationImportMode && proposedObj.UserType == UserType.HeadOffice)
|
||||
if (!SeedOrImportRelaxedRulesMode && proposedObj.UserType == UserType.HeadOffice)
|
||||
{
|
||||
if (proposedObj.HeadOfficeId == null || proposedObj.HeadOfficeId == 0)
|
||||
{
|
||||
@@ -411,7 +411,7 @@ namespace AyaNova.Biz
|
||||
}
|
||||
|
||||
//Validate headoffice type user
|
||||
if (!V7ValidationImportMode && proposedObj.UserType == UserType.Subcontractor)
|
||||
if (!SeedOrImportRelaxedRulesMode && proposedObj.UserType == UserType.Subcontractor)
|
||||
{
|
||||
if (proposedObj.SubVendorId == null || proposedObj.SubVendorId == 0)
|
||||
{
|
||||
@@ -667,7 +667,7 @@ namespace AyaNova.Biz
|
||||
|
||||
#endregion v7 record format
|
||||
|
||||
V7ValidationImportMode = true;
|
||||
SeedOrImportRelaxedRulesMode = true;
|
||||
|
||||
//some types need to import from more than one source hence the seemingly redundant switch statement for futureproofing
|
||||
switch (j["IMPORT_TASK"].Value<string>())
|
||||
|
||||
@@ -242,7 +242,8 @@ namespace AyaNova.Util
|
||||
public async static void GenSeedUser(ILogger log, int count, AuthorizationRoles roles, UserType userType, bool active = true, string login = null, string password = null)
|
||||
{
|
||||
UserBiz Biz = UserBiz.GetBizInternal(ServiceProviderProvider.DBContext);
|
||||
// Biz.CreateAsync()
|
||||
//allow creation of not entirely ready users (missing client id or subcontractor vendor id etc)
|
||||
Biz.SeedOrImportRelaxedRulesMode = true;
|
||||
|
||||
for (int x = 0; x < count; x++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user