This commit is contained in:
@@ -27,10 +27,10 @@ namespace AyaNova.Biz
|
||||
u.Login = "manager";
|
||||
u.Password = Hasher.hash(u.Salt, "l3tm3in");
|
||||
u.Roles = AuthorizationRoles.AnyRole;//AuthorizationRoles.BizAdminFull | AuthorizationRoles.OpsAdminFull | AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryFull;
|
||||
u.OwnerId = 1;
|
||||
|
||||
u.LocaleId = ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID;//Ensure primeLocales is called first
|
||||
u.UserType = UserType.Administrator;
|
||||
u.UserOptions = new UserOptions(1);
|
||||
u.UserOptions = new UserOptions();
|
||||
ct.User.Add(u);
|
||||
ct.SaveChanges();
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace AyaNova.Biz
|
||||
|
||||
Locale l = new Locale();
|
||||
l.Name = localeCode;
|
||||
l.OwnerId = 1;
|
||||
|
||||
l.Stock = true;
|
||||
l.CjkIndex = false;
|
||||
|
||||
|
||||
@@ -761,7 +761,7 @@ namespace AyaNova.Biz
|
||||
}
|
||||
|
||||
//User options
|
||||
i.UserOptions = new UserOptions(i.OwnerId);
|
||||
i.UserOptions = new UserOptions();
|
||||
|
||||
//TimeZone Offset
|
||||
//Note: can be null value if not set so need to check for that here specially
|
||||
|
||||
@@ -45,12 +45,10 @@ namespace AyaNova.Biz
|
||||
//put
|
||||
internal bool Put(UserOptions dbObj, UserOptions inObj)
|
||||
{
|
||||
//preserve the owner ID if none was specified
|
||||
if (inObj.OwnerId == 0)
|
||||
inObj.OwnerId = dbObj.OwnerId;
|
||||
|
||||
|
||||
//Replace the db object with the PUT object
|
||||
CopyObject.Copy(inObj, dbObj, "Id, UserId, OwnerId");
|
||||
CopyObject.Copy(inObj, dbObj, "Id, UserId");
|
||||
//Set "original" value of concurrency token to input token
|
||||
//this will allow EF to check it out
|
||||
ct.Entry(dbObj).OriginalValues["ConcurrencyToken"] = inObj.ConcurrencyToken;
|
||||
@@ -98,11 +96,8 @@ namespace AyaNova.Biz
|
||||
//UserOptions is never new, it's created with the User object so were only here for an edit
|
||||
|
||||
|
||||
//OwnerId required
|
||||
if (inObj.OwnerId == 0)
|
||||
AddError(ApiErrorCode.VALIDATION_REQUIRED, "OwnerId");
|
||||
|
||||
//OwnerId required
|
||||
//UserId required
|
||||
if (inObj.UserId == 0)
|
||||
AddError(ApiErrorCode.VALIDATION_REQUIRED, "UserId");
|
||||
|
||||
|
||||
@@ -37,12 +37,7 @@ namespace AyaNova.Biz
|
||||
IsValid = false;
|
||||
}
|
||||
|
||||
if (objectPatch.Operations.Any(m => m.path == "/ownerid"))
|
||||
{
|
||||
biz.AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "OwnerId");
|
||||
IsValid = false;
|
||||
}
|
||||
|
||||
|
||||
if (objectPatch.Operations.Any(m => m.path == "/serial"))
|
||||
{
|
||||
biz.AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "Serial");
|
||||
|
||||
@@ -170,7 +170,7 @@ namespace AyaNova.Biz
|
||||
internal bool Patch(Widget dbObj, JsonPatchDocument<Widget> objectPatch, uint concurrencyToken)
|
||||
{
|
||||
//Validate Patch is allowed
|
||||
//Note: Id, OwnerId and Serial are all checked for and disallowed in the validate code by default
|
||||
//Note: Id and Serial are all checked for and disallowed in the validate code by default
|
||||
if (!ValidateJsonPatch<Widget>.Validate(this, objectPatch)) return false;
|
||||
|
||||
//make a snapshot of the original for validation but update the original to preserve workflow
|
||||
|
||||
Reference in New Issue
Block a user