Fix/issue pointer permissions (#4141)
* Makes sure we don't override roles * Reduces the query size whith pointer permissions - Does not return as $and if not needed - Returns just the query with the additional constraint * Do not use $in if include is just of length 1
This commit is contained in:
@@ -635,7 +635,13 @@ function includePath(config, auth, response, path, restOptions = {}) {
|
||||
}
|
||||
|
||||
const queryPromises = Object.keys(pointersHash).map((className) => {
|
||||
const where = {'objectId': {'$in': Array.from(pointersHash[className])}};
|
||||
const objectIds = Array.from(pointersHash[className]);
|
||||
let where;
|
||||
if (objectIds.length === 1) {
|
||||
where = {'objectId': objectIds[0]};
|
||||
} else {
|
||||
where = {'objectId': {'$in': objectIds}};
|
||||
}
|
||||
var query = new RestQuery(config, auth, className, where, includeRestOptions);
|
||||
return query.execute({op: 'get'}).then((results) => {
|
||||
results.className = className;
|
||||
|
||||
Reference in New Issue
Block a user