This commit is contained in:
2020-12-04 20:49:05 +00:00
parent 55433a8ace
commit cd016efbfb
12 changed files with 89 additions and 58 deletions

View File

@@ -17,7 +17,7 @@ namespace AyaNova.Biz
internal class UserBiz : BizObject, IJobObject, ISearchAbleObject, IReportAbleObject
{
public bool SeedOrImportRelaxedRulesMode { get; set; }
internal UserBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles userRoles)
{
@@ -26,7 +26,6 @@ namespace AyaNova.Biz
UserTranslationId = userTranslationId;
CurrentUserRoles = userRoles;
BizType = AyaType.User;
SeedOrImportRelaxedRulesMode = false;//default
}
//This is where active tech license consumers are accounted for
@@ -448,6 +447,9 @@ namespace AyaNova.Biz
//Can save or update?
private async Task ValidateAsync(User proposedObj, User currentObj)
{
//skip validation if seeding
if(ServerBootConfig.SEEDING) return;
//run validation and biz rules
bool isNew = currentObj == null;
@@ -535,7 +537,7 @@ namespace AyaNova.Biz
}
//Validate customer type user
if (!SeedOrImportRelaxedRulesMode && proposedObj.UserType == UserType.Customer)
if (proposedObj.UserType == UserType.Customer)
{
if (proposedObj.CustomerId == null || proposedObj.CustomerId == 0)
{
@@ -550,7 +552,7 @@ namespace AyaNova.Biz
}
//Validate headoffice type user
if (!SeedOrImportRelaxedRulesMode && proposedObj.UserType == UserType.HeadOffice)
if (proposedObj.UserType == UserType.HeadOffice)
{
if (proposedObj.HeadOfficeId == null || proposedObj.HeadOfficeId == 0)
{
@@ -565,7 +567,7 @@ namespace AyaNova.Biz
}
//Validate subcontractor type user
if (!SeedOrImportRelaxedRulesMode && proposedObj.UserType == UserType.ServiceContractor)
if (proposedObj.UserType == UserType.ServiceContractor)
{
if (proposedObj.VendorId == null || proposedObj.VendorId == 0)
{