Skip to content

Commit

Permalink
fix 2
Browse files Browse the repository at this point in the history
  • Loading branch information
mtrezza committed Jun 30, 2022
1 parent 49a4afc commit 19e4da9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
14 changes: 2 additions & 12 deletions src/Controllers/DatabaseController.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,8 @@ const filterSensitiveData = (
schema: SchemaController.SchemaController | any,
className: string,
protectedFields: null | Array<any>,
object: any,
query: any = {}
object: any
) => {
if (!isMaster && !Array.isArray(protectedFields)) {
protectedFields = new DatabaseController().addProtectedFields(
schema,
className,
query,
aclGroup,
auth
);
}

let userId = null;
if (auth && auth.user) userId = auth.user.id;

Expand Down Expand Up @@ -1821,6 +1810,7 @@ class DatabaseController {
}

static _validateQuery: any => void;
static filterSensitiveData: (boolean, any[], any, any, any, string, any[], any) => void;
}

module.exports = DatabaseController;
Expand Down
14 changes: 12 additions & 2 deletions src/LiveQuery/ParseLiveQueryServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
toJSONwithObjects,
} from '../triggers';
import { getAuthForSessionToken, Auth } from '../Auth';
import { getCacheController } from '../Controllers';
import { getCacheController, getDatabaseController } from '../Controllers';
import LRU from 'lru-cache';
import UserRouter from '../Routers/UsersRouter';
import DatabaseController from '../Controllers/DatabaseController';
Expand Down Expand Up @@ -598,14 +598,24 @@ class ParseLiveQueryServer {
if (!obj) {
return;
}
let protectedFields = classLevelPermissions?.protectedFields || [];
if (!client.hasMasterKey && !Array.isArray(protectedFields)) {
protectedFields = getDatabaseController(this.config).addProtectedFields(
classLevelPermissions,
res.object.className,
query,
aclGroup,
clientAuth
);
}
return DatabaseController.filterSensitiveData(
client.hasMasterKey,
aclGroup,
clientAuth,
op,
classLevelPermissions,
res.object.className,
classLevelPermissions?.protectedFields,
protectedFields,
obj,
query
);
Expand Down

0 comments on commit 19e4da9

Please sign in to comment.