Skip to content

Commit f6c9c0a

Browse files
committed
fix 2
1 parent 39ee87b commit f6c9c0a

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/Controllers/DatabaseController.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -130,19 +130,8 @@ const filterSensitiveData = (
130130
schema: SchemaController.SchemaController | any,
131131
className: string,
132132
protectedFields: null | Array<any>,
133-
object: any,
134-
query: any = {}
133+
object: any
135134
) => {
136-
if (!isMaster && !Array.isArray(protectedFields)) {
137-
protectedFields = new DatabaseController().addProtectedFields(
138-
schema,
139-
className,
140-
query,
141-
aclGroup,
142-
auth
143-
);
144-
}
145-
146135
let userId = null;
147136
if (auth && auth.user) userId = auth.user.id;
148137

@@ -1821,6 +1810,7 @@ class DatabaseController {
18211810
}
18221811

18231812
static _validateQuery: any => void;
1813+
static filterSensitiveData: (boolean, any[], any, any, any, string, any[], any) => void;
18241814
}
18251815

18261816
module.exports = DatabaseController;

src/LiveQuery/ParseLiveQueryServer.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
toJSONwithObjects,
1919
} from '../triggers';
2020
import { getAuthForSessionToken, Auth } from '../Auth';
21-
import { getCacheController } from '../Controllers';
21+
import { getCacheController, getDatabaseController } from '../Controllers';
2222
import LRU from 'lru-cache';
2323
import UserRouter from '../Routers/UsersRouter';
2424
import DatabaseController from '../Controllers/DatabaseController';
@@ -567,14 +567,24 @@ class ParseLiveQueryServer {
567567
if (!obj) {
568568
return;
569569
}
570+
let protectedFields = classLevelPermissions?.protectedFields || [];
571+
if (!client.hasMasterKey && !Array.isArray(protectedFields)) {
572+
protectedFields = getDatabaseController(this.config).addProtectedFields(
573+
classLevelPermissions,
574+
res.object.className,
575+
query,
576+
aclGroup,
577+
clientAuth
578+
);
579+
}
570580
return DatabaseController.filterSensitiveData(
571581
client.hasMasterKey,
572582
aclGroup,
573583
clientAuth,
574584
op,
575585
classLevelPermissions,
576586
res.object.className,
577-
classLevelPermissions?.protectedFields,
587+
protectedFields,
578588
obj,
579589
query
580590
);

0 commit comments

Comments
 (0)