This commit is contained in:
2021-07-12 19:28:18 +00:00
parent 56d8cc27cb
commit f7e2f5c5ac
10 changed files with 80 additions and 17 deletions

2
.vscode/launch.json vendored
View File

@@ -53,7 +53,7 @@
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
"AYANOVA_SERVER_TEST_MODE": "false",
"AYANOVA_SERVER_TEST_MODE": "true",
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "large",
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"

View File

@@ -64,7 +64,7 @@ Response:
"v": true
},
{
"v": "Doug Effertz 17 - OpsAdminFull",
"v": "Doug Effertz 17 - OpsAdmin",
"i": 18
}
],

View File

@@ -4,8 +4,8 @@ ROLES AND RIGHTS:
Modify automated backup settings
Trigger backup
DownloadBackup file
OpsFull
Ops
View Backup settings
OpsFull, opslimited
Ops, opsrestricted

View File

@@ -793,7 +793,7 @@ namespace AyaNova.Biz
//
roles.Add(AyaType.FormCustom, new BizRoleSet()
{
//Only BizAdminFull can modify forms
//Only BizAdmin can modify forms
Change = AuthorizationRoles.BizAdmin,
//Anyone can read it because they need to to open a form, but also in UI
//only the BizAdminRestricted actually gets a link to see the customization page

View File

@@ -25,7 +25,7 @@ namespace AyaNova.Biz
u.Salt = Hasher.GenerateSalt();
u.Login = "superuser";
u.Password = Hasher.hash(u.Salt, "l3tm3in");
u.Roles = AuthorizationRoles.All;//AuthorizationRoles.BizAdminFull | AuthorizationRoles.OpsAdminFull | AuthorizationRoles.ServiceFull | AuthorizationRoles.InventoryFull;
u.Roles = AuthorizationRoles.All;
u.UserType = UserType.NotService;

View File

@@ -227,7 +227,7 @@ namespace AyaNova.Biz
private async Task ValidateAsync(Review proposedObj, Review currentObj)
{
/*
- RULE Roles: BizAdminFull, ServiceFull, InventoryFull, Accounting, SalesFull can create and assign to anyone else.
- RULE Roles: BizAdmin, Service, Inventory, Accounting, Sales can create and assign to anyone else.
- RULE Any other inside role can create for themselves only. (outside roles have no rights to this object so no need to check)
- RULE Restricted roles can only set completed date and enter completion notes not otherwise change or create or delete.
- BIZ RULE users with more than restricted roles can assign other users

View File

@@ -27,7 +27,7 @@
// if (httpContext != null)
// return new ServiceBankBiz(ct, UserIdFromContext.Id(httpContext.Items), UserTranslationIdFromContext.Id(httpContext.Items), UserRolesFromContext.Roles(httpContext.Items));
// else
// return new ServiceBankBiz(ct, 1, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, AuthorizationRoles.BizAdminFull);
// return new ServiceBankBiz(ct, 1, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, AuthorizationRoles.BizAdmin);
// }
// ////////////////////////////////////////////////////////////////////////////////////////////////

View File

@@ -17,7 +17,6 @@ namespace AyaNova.Biz
internal class WorkOrderBiz : BizObject, IJobObject, ISearchAbleObject, IReportAbleObject, IExportAbleObject
{
// //Feature specific roles
// internal static AuthorizationRoles RolesAllowedToChangeSerial = AuthorizationRoles.BizAdminFull | AuthorizationRoles.ServiceFull | AuthorizationRoles.AccountingFull;
internal WorkOrderBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
{
@@ -2150,6 +2149,9 @@ namespace AyaNova.Biz
}
}
if (string.IsNullOrWhiteSpace(proposedObj.Notes))//negative quantities are not allowed
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Notes");
//Any form customizations to validate?
var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItem.ToString());
if (FormCustomization != null)
@@ -3022,6 +3024,24 @@ namespace AyaNova.Biz
}
//Start date AND end date must both be null or both contain values
if (proposedObj.ServiceStartDate == null && proposedObj.ServiceStopDate != null)
AddError(ApiErrorCode.VALIDATION_REQUIRED, "ServiceStartDate");
if (proposedObj.ServiceStartDate != null && proposedObj.ServiceStopDate == null)
AddError(ApiErrorCode.VALIDATION_REQUIRED, "ServiceStopDate");
//Start date before end date
if (proposedObj.ServiceStartDate != null && proposedObj.ServiceStopDate != null)
if (proposedObj.ServiceStartDate > proposedObj.ServiceStopDate)
AddError(ApiErrorCode.VALIDATION_STARTDATE_AFTER_ENDDATE, "ServiceStartDate");
if (proposedObj.ServiceRateQuantity < 0)//negative quantities are not allowed
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "ServiceRateQuantity");
if (proposedObj.NoChargeQuantity < 0)//negative quantities are not allowed
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "NoChargeQuantity");
//Any form customizations to validate?
var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemLabor.ToString());
if (FormCustomization != null)
@@ -3399,6 +3419,8 @@ namespace AyaNova.Biz
if (proposedObj.LoanUnitId < 1 || !await ct.LoanUnit.AnyAsync(x => x.Id == proposedObj.LoanUnitId))
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "LoanUnitId");
if (proposedObj.Quantity < 0)//negative quantities are not allowed
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Quantity");
//Any form customizations to validate?
@@ -3714,6 +3736,7 @@ namespace AyaNova.Biz
if (proposedObj.UnitId < 1 || !await ct.Unit.AnyAsync(x => x.Id == proposedObj.UnitId))
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "UnitId");
//Any form customizations to validate?
var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemOutsideService.ToString());
if (FormCustomization != null)
@@ -4440,9 +4463,17 @@ namespace AyaNova.Biz
AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "generalerror", await Translate("WorkOrderErrorLocked"));
return;//this is a completely disqualifying error
}
}
if (!await BizObjectExistsInDatabase.ExistsAsync(AyaType.Part, proposedObj.PartId, ct))
{
AddError(ApiErrorCode.NOT_FOUND, "PartId");
return;
}
if (proposedObj.Quantity < 0)//negative quantities are not allowed
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Quantity");
//Any form customizations to validate?
var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemPart.ToString());
if (FormCustomization != null)
@@ -4692,9 +4723,18 @@ namespace AyaNova.Biz
AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "generalerror", await Translate("WorkOrderErrorLocked"));
return;//this is a completely disqualifying error
}
}
if (!await BizObjectExistsInDatabase.ExistsAsync(AyaType.Part, proposedObj.PartId, ct))
{
AddError(ApiErrorCode.NOT_FOUND, "PartId");
return;
}
if (proposedObj.Quantity < 0)//negative quantities are not allowed
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Quantity");
//Any form customizations to validate?
var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemPartRequest.ToString());
if (FormCustomization != null)
@@ -4933,6 +4973,22 @@ namespace AyaNova.Biz
}
}
if (proposedObj.EstimatedQuantity < 0)//negative quantities are not allowed
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "EstimatedQuantity");
//Start date AND end date must both be null or both contain values
if (proposedObj.StartDate == null && proposedObj.StopDate != null)
AddError(ApiErrorCode.VALIDATION_REQUIRED, "StopDate");
if (proposedObj.StartDate != null && proposedObj.StopDate == null)
AddError(ApiErrorCode.VALIDATION_REQUIRED, "StopDate");
//Start date before end date
if (proposedObj.StartDate != null && proposedObj.StopDate != null)
if (proposedObj.StartDate > proposedObj.StopDate)
AddError(ApiErrorCode.VALIDATION_STARTDATE_AFTER_ENDDATE, "StartDate");
//Scheduling conflict?
if (!AyaNova.Util.ServerGlobalBizSettings.Cache.AllowScheduleConflicts
&& proposedObj.UserId != null
@@ -5793,9 +5849,14 @@ namespace AyaNova.Biz
AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "generalerror", await Translate("WorkOrderErrorLocked"));
return;//this is a completely disqualifying error
}
}
if (proposedObj.TravelRateQuantity < 0)//negative quantities are not allowed
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "TravelRateQuantity");
if (proposedObj.NoChargeQuantity < 0)//negative quantities are not allowed
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "NoChargeQuantity");
//Any form customizations to validate?
var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemTravel.ToString());
if (FormCustomization != null)

View File

@@ -22,7 +22,9 @@ namespace AyaNova.Models
[NotMapped]
public string ServiceRateViz { get; set; }
public string ServiceDetails { get; set; }
[Required]
public decimal ServiceRateQuantity { get; set; }
[Required]
public decimal NoChargeQuantity { get; set; }
//public long? ServiceBankId { get; set; }
public long? TaxCodeSaleId { get; set; }

View File

@@ -529,7 +529,7 @@ namespace AyaNova.Util
///////////////////////////////////////////
// Check if DB has evaluation user accounts
// CALLED BY by login ping from licent via notify controller
// CALLED BY by login ping from client via notify controller
internal static async Task<bool> DBHasTrialUsersAsync(AyContext ct, ILogger _log)
{
_log.LogDebug("DB trial users presence check");
@@ -539,11 +539,11 @@ namespace AyaNova.Util
//just check for a few for testing
if (await ct.User.AsNoTracking()
.Where(z =>
z.Login == "BizAdminFull" ||
z.Login == "ServiceFull" ||
z.Login == "InventoryFull" ||
z.Login == "BizAdmin" ||
z.Login == "Service" ||
z.Login == "Inventory" ||
z.Login == "Accounting" ||
z.Login == "TechFull"
z.Login == "Tech"
).LongCountAsync() < 5) return false;
return true;