This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -53,7 +53,7 @@
|
|||||||
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
|
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
|
||||||
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
|
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
|
||||||
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
|
"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_SEEDLEVEL": "large",
|
||||||
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
|
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
|
||||||
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"
|
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ Response:
|
|||||||
"v": true
|
"v": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"v": "Doug Effertz 17 - OpsAdminFull",
|
"v": "Doug Effertz 17 - OpsAdmin",
|
||||||
"i": 18
|
"i": 18
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ ROLES AND RIGHTS:
|
|||||||
Modify automated backup settings
|
Modify automated backup settings
|
||||||
Trigger backup
|
Trigger backup
|
||||||
DownloadBackup file
|
DownloadBackup file
|
||||||
OpsFull
|
Ops
|
||||||
View Backup settings
|
View Backup settings
|
||||||
OpsFull, opslimited
|
Ops, opsrestricted
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -793,7 +793,7 @@ namespace AyaNova.Biz
|
|||||||
//
|
//
|
||||||
roles.Add(AyaType.FormCustom, new BizRoleSet()
|
roles.Add(AyaType.FormCustom, new BizRoleSet()
|
||||||
{
|
{
|
||||||
//Only BizAdminFull can modify forms
|
//Only BizAdmin can modify forms
|
||||||
Change = AuthorizationRoles.BizAdmin,
|
Change = AuthorizationRoles.BizAdmin,
|
||||||
//Anyone can read it because they need to to open a form, but also in UI
|
//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
|
//only the BizAdminRestricted actually gets a link to see the customization page
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace AyaNova.Biz
|
|||||||
u.Salt = Hasher.GenerateSalt();
|
u.Salt = Hasher.GenerateSalt();
|
||||||
u.Login = "superuser";
|
u.Login = "superuser";
|
||||||
u.Password = Hasher.hash(u.Salt, "l3tm3in");
|
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;
|
u.UserType = UserType.NotService;
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ namespace AyaNova.Biz
|
|||||||
private async Task ValidateAsync(Review proposedObj, Review currentObj)
|
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 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.
|
- 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
|
- BIZ RULE users with more than restricted roles can assign other users
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
// if (httpContext != null)
|
// if (httpContext != null)
|
||||||
// return new ServiceBankBiz(ct, UserIdFromContext.Id(httpContext.Items), UserTranslationIdFromContext.Id(httpContext.Items), UserRolesFromContext.Roles(httpContext.Items));
|
// return new ServiceBankBiz(ct, UserIdFromContext.Id(httpContext.Items), UserTranslationIdFromContext.Id(httpContext.Items), UserRolesFromContext.Roles(httpContext.Items));
|
||||||
// else
|
// 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);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
// ////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ namespace AyaNova.Biz
|
|||||||
internal class WorkOrderBiz : BizObject, IJobObject, ISearchAbleObject, IReportAbleObject, IExportAbleObject
|
internal class WorkOrderBiz : BizObject, IJobObject, ISearchAbleObject, IReportAbleObject, IExportAbleObject
|
||||||
{
|
{
|
||||||
// //Feature specific roles
|
// //Feature specific roles
|
||||||
// internal static AuthorizationRoles RolesAllowedToChangeSerial = AuthorizationRoles.BizAdminFull | AuthorizationRoles.ServiceFull | AuthorizationRoles.AccountingFull;
|
|
||||||
|
|
||||||
internal WorkOrderBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
|
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?
|
//Any form customizations to validate?
|
||||||
var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItem.ToString());
|
var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItem.ToString());
|
||||||
if (FormCustomization != null)
|
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?
|
//Any form customizations to validate?
|
||||||
var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemLabor.ToString());
|
var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemLabor.ToString());
|
||||||
if (FormCustomization != null)
|
if (FormCustomization != null)
|
||||||
@@ -3399,6 +3419,8 @@ namespace AyaNova.Biz
|
|||||||
if (proposedObj.LoanUnitId < 1 || !await ct.LoanUnit.AnyAsync(x => x.Id == proposedObj.LoanUnitId))
|
if (proposedObj.LoanUnitId < 1 || !await ct.LoanUnit.AnyAsync(x => x.Id == proposedObj.LoanUnitId))
|
||||||
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "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?
|
//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))
|
if (proposedObj.UnitId < 1 || !await ct.Unit.AnyAsync(x => x.Id == proposedObj.UnitId))
|
||||||
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "UnitId");
|
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "UnitId");
|
||||||
|
|
||||||
|
|
||||||
//Any form customizations to validate?
|
//Any form customizations to validate?
|
||||||
var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemOutsideService.ToString());
|
var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemOutsideService.ToString());
|
||||||
if (FormCustomization != null)
|
if (FormCustomization != null)
|
||||||
@@ -4440,9 +4463,17 @@ namespace AyaNova.Biz
|
|||||||
AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "generalerror", await Translate("WorkOrderErrorLocked"));
|
AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "generalerror", await Translate("WorkOrderErrorLocked"));
|
||||||
return;//this is a completely disqualifying error
|
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?
|
//Any form customizations to validate?
|
||||||
var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemPart.ToString());
|
var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemPart.ToString());
|
||||||
if (FormCustomization != null)
|
if (FormCustomization != null)
|
||||||
@@ -4692,9 +4723,18 @@ namespace AyaNova.Biz
|
|||||||
AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "generalerror", await Translate("WorkOrderErrorLocked"));
|
AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "generalerror", await Translate("WorkOrderErrorLocked"));
|
||||||
return;//this is a completely disqualifying error
|
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?
|
//Any form customizations to validate?
|
||||||
var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemPartRequest.ToString());
|
var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemPartRequest.ToString());
|
||||||
if (FormCustomization != null)
|
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?
|
//Scheduling conflict?
|
||||||
if (!AyaNova.Util.ServerGlobalBizSettings.Cache.AllowScheduleConflicts
|
if (!AyaNova.Util.ServerGlobalBizSettings.Cache.AllowScheduleConflicts
|
||||||
&& proposedObj.UserId != null
|
&& proposedObj.UserId != null
|
||||||
@@ -5793,9 +5849,14 @@ namespace AyaNova.Biz
|
|||||||
AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "generalerror", await Translate("WorkOrderErrorLocked"));
|
AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "generalerror", await Translate("WorkOrderErrorLocked"));
|
||||||
return;//this is a completely disqualifying error
|
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?
|
//Any form customizations to validate?
|
||||||
var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemTravel.ToString());
|
var FormCustomization = await ct.FormCustom.AsNoTracking().SingleOrDefaultAsync(z => z.FormKey == AyaType.WorkOrderItemTravel.ToString());
|
||||||
if (FormCustomization != null)
|
if (FormCustomization != null)
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ namespace AyaNova.Models
|
|||||||
[NotMapped]
|
[NotMapped]
|
||||||
public string ServiceRateViz { get; set; }
|
public string ServiceRateViz { get; set; }
|
||||||
public string ServiceDetails { get; set; }
|
public string ServiceDetails { get; set; }
|
||||||
|
[Required]
|
||||||
public decimal ServiceRateQuantity { get; set; }
|
public decimal ServiceRateQuantity { get; set; }
|
||||||
|
[Required]
|
||||||
public decimal NoChargeQuantity { get; set; }
|
public decimal NoChargeQuantity { get; set; }
|
||||||
//public long? ServiceBankId { get; set; }
|
//public long? ServiceBankId { get; set; }
|
||||||
public long? TaxCodeSaleId { get; set; }
|
public long? TaxCodeSaleId { get; set; }
|
||||||
|
|||||||
@@ -529,7 +529,7 @@ namespace AyaNova.Util
|
|||||||
|
|
||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
// Check if DB has evaluation user accounts
|
// 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)
|
internal static async Task<bool> DBHasTrialUsersAsync(AyContext ct, ILogger _log)
|
||||||
{
|
{
|
||||||
_log.LogDebug("DB trial users presence check");
|
_log.LogDebug("DB trial users presence check");
|
||||||
@@ -539,11 +539,11 @@ namespace AyaNova.Util
|
|||||||
//just check for a few for testing
|
//just check for a few for testing
|
||||||
if (await ct.User.AsNoTracking()
|
if (await ct.User.AsNoTracking()
|
||||||
.Where(z =>
|
.Where(z =>
|
||||||
z.Login == "BizAdminFull" ||
|
z.Login == "BizAdmin" ||
|
||||||
z.Login == "ServiceFull" ||
|
z.Login == "Service" ||
|
||||||
z.Login == "InventoryFull" ||
|
z.Login == "Inventory" ||
|
||||||
z.Login == "Accounting" ||
|
z.Login == "Accounting" ||
|
||||||
z.Login == "TechFull"
|
z.Login == "Tech"
|
||||||
).LongCountAsync() < 5) return false;
|
).LongCountAsync() < 5) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user