Ensure _acl is updated when _rperm and _wperm updated (#2701)

* Ensure _acl is updated when _rperm and _wperm updated

* alternative solution

* Only try to apply $set for permission updates
This commit is contained in:
Steven Shipton
2016-09-17 05:05:33 -10:00
committed by Florent Vilmart
parent f6312a1b98
commit 0773523bc2
2 changed files with 25 additions and 6 deletions

View File

@@ -330,8 +330,8 @@ const parseObjectToMongoObjectForCreate = (className, restCreate, schema) => {
// Main exposed method to help update old objects.
const transformUpdate = (className, restUpdate, parseFormatSchema) => {
let mongoUpdate = {};
let acl = addLegacyACL(restUpdate)._acl;
if (acl) {
let acl = addLegacyACL(restUpdate);
if (acl._rperm || acl._wperm || acl._acl) {
mongoUpdate.$set = {};
if (acl._rperm) {
mongoUpdate.$set._rperm = acl._rperm;