This commit is contained in:
2021-04-27 21:16:02 +00:00
parent 14cd300413
commit 1c90c4f9de

View File

@@ -714,6 +714,25 @@ namespace AyaNova.Biz
AddError(ApiErrorCode.VALIDATION_NOT_UNIQUE, "Login");
}
//SUPERUSER ACCOUNT CAN"T BE MODIFIED IN SOME WAYS
if(!isNew && proposedObj.Id==1){
//prevent certain changes to superuser account like roles etc
if(proposedObj.Roles!=currentObj.Roles)
AddError(ApiErrorCode.NOT_AUTHORIZED, "Roles");
if(proposedObj.Active!=currentObj.Active)
AddError(ApiErrorCode.NOT_AUTHORIZED, "Active");
if(proposedObj.Name!=currentObj.Name)
AddError(ApiErrorCode.NOT_AUTHORIZED, "Name");
if(proposedObj.UserType!=currentObj.UserType)
AddError(ApiErrorCode.NOT_AUTHORIZED, "UserType");
}
//TODO: Validation rules that require future other objects that aren't present yet:
/*