Properly let masterKey add fields

This commit is contained in:
Florent Vilmart
2016-03-30 20:27:12 -04:00
parent 7afc08abe4
commit 5d99075663
2 changed files with 55 additions and 34 deletions

View File

@@ -103,9 +103,14 @@ DatabaseController.prototype.redirectClassNameForKey = function(className, key)
// batch request, that could confuse other users of the schema.
DatabaseController.prototype.validateObject = function(className, object, query, options) {
let schema;
let isMaster = !('acl' in options);
var aclGroup = options.acl || [];
return this.loadSchema().then(s => {
schema = s;
return this.canAddField(schema, className, object, options.acl || []);
if (isMaster) {
return Promise.resolve();
}
return this.canAddField(schema, className, object, aclGroup);
}).then(() => {
return schema.validateObject(className, object, query);
});