Move acl adding into parse server (#1601)

* Move writeACL knowledge out of mongoAdapter

* Remove write ACL from mongo adapter

* Remove readACL from Mongo Transform
This commit is contained in:
Drew
2016-04-22 18:44:03 -07:00
committed by Florent Vilmart
parent d33dd68cc5
commit d14d451028
3 changed files with 25 additions and 22 deletions

View File

@@ -163,10 +163,8 @@ export class MongoStorageAdapter {
// If no objects match, reject with OBJECT_NOT_FOUND. If objects are found and deleted, resolve with undefined.
// If there is some other error, reject with INTERNAL_SERVER_ERROR.
// Currently accepts the acl, schemaController, validate
// for lecacy reasons, Parse Server should later integrate acl into the query. Database adapters
// shouldn't know about acl.
deleteObjectsByQuery(className, query, acl, schemaController, validate) {
// Currently accepts the schemaController, and validate for lecacy reasons
deleteObjectsByQuery(className, query, schemaController, validate) {
return this.adaptiveCollection(className)
.then(collection => {
let mongoWhere = transform.transformWhere(
@@ -175,9 +173,6 @@ export class MongoStorageAdapter {
query,
{ validate }
);
if (acl) {
mongoWhere = transform.addWriteACL(mongoWhere, acl);
}
return collection.deleteMany(mongoWhere)
})
.then(({ result }) => {

View File

@@ -916,14 +916,6 @@ function transformNotInQuery(notInQueryObject, className, results) {
}
}
function addWriteACL(mongoWhere, acl) {
return {'$and': [mongoWhere, {"_wperm" : { "$in" : [null, ...acl]}}]};
}
function addReadACL(mongoWhere, acl) {
return {'$and': [mongoWhere, {"_rperm" : { "$in" : [null, "*", ...acl]}}]};
}
var DateCoder = {
JSONToDatabase(json) {
return new Date(json.iso);
@@ -1021,7 +1013,5 @@ module.exports = {
transformDontSelect,
transformInQuery,
transformNotInQuery,
addReadACL,
addWriteACL,
untransformObject
};