Lift no-query-ACL validation out of transformWhere

This commit is contained in:
Drew Gross
2016-05-18 13:49:31 -07:00
parent 66b8a8474e
commit 559205bc64
3 changed files with 15 additions and 3 deletions

View File

@@ -184,6 +184,9 @@ DatabaseController.prototype.update = function(className, query, update, {
throw error;
})
.then(parseFormatSchema => {
if (query.ACL) {
throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Cannot query on ACL.');
}
var mongoWhere = this.transform.transformWhere(className, query, {validate: !this.skipValidation}, parseFormatSchema);
mongoUpdate = this.transform.transformUpdate(
schemaController,
@@ -668,6 +671,9 @@ DatabaseController.prototype.find = function(className, query, {
if (!isMaster) {
query = addReadACL(query, aclGroup);
}
if (query.ACL) {
throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Cannot query on ACL.');
}
let mongoWhere = this.transform.transformWhere(className, query, {}, schema);
if (count) {
delete mongoOptions.limit;