diff --git a/server/AyaNova/biz/TagBiz.cs b/server/AyaNova/biz/TagBiz.cs index e430a3e9..eef6e317 100644 --- a/server/AyaNova/biz/TagBiz.cs +++ b/server/AyaNova/biz/TagBiz.cs @@ -169,6 +169,9 @@ namespace AyaNova.Biz //patch internal bool Patch(Tag dbObj, JsonPatchDocument objectPatch, uint concurrencyToken) { + //Validate Patch is allowed + if (!ValidateJsonPatch.Validate(this, objectPatch)) return false; + //Do the patching objectPatch.ApplyTo(dbObj); ct.Entry(dbObj).OriginalValues["ConcurrencyToken"] = concurrencyToken; diff --git a/server/AyaNova/biz/UserOptionsBiz.cs b/server/AyaNova/biz/UserOptionsBiz.cs index 8b2e00fb..f909eca8 100644 --- a/server/AyaNova/biz/UserOptionsBiz.cs +++ b/server/AyaNova/biz/UserOptionsBiz.cs @@ -64,22 +64,16 @@ namespace AyaNova.Biz //patch internal bool Patch(UserOptions dbObj, JsonPatchDocument objectPatch, uint concurrencyToken) { - //check for in-valid patches - if(objectPatch.Operations.Any(m=>m.path=="Id")) - { - AddError(ValidationErrorType.InvalidOperation,"Id"); - return false; - } - + //Validate Patch is allowed + if (!ValidateJsonPatch.Validate(this, objectPatch)) return false; + //Do the patching - objectPatch.ApplyTo(dbObj); - + objectPatch.ApplyTo(dbObj); ct.Entry(dbObj).OriginalValues["ConcurrencyToken"] = concurrencyToken; Validate(dbObj); if (HasErrors) return false; - return true; } diff --git a/server/AyaNova/biz/WidgetBiz.cs b/server/AyaNova/biz/WidgetBiz.cs index 68600af7..2d4176b9 100644 --- a/server/AyaNova/biz/WidgetBiz.cs +++ b/server/AyaNova/biz/WidgetBiz.cs @@ -154,6 +154,9 @@ namespace AyaNova.Biz //patch internal bool Patch(Widget dbObj, JsonPatchDocument objectPatch, uint concurrencyToken) { + //Validate Patch is allowed + if (!ValidateJsonPatch.Validate(this, objectPatch)) return false; + //Do the patching objectPatch.ApplyTo(dbObj); ct.Entry(dbObj).OriginalValues["ConcurrencyToken"] = concurrencyToken;