Skip to content

Commit bd1cd5b

Browse files
committed
nits
1 parent 08bba4f commit bd1cd5b

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

src/Controllers/DatabaseController.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,10 +1007,10 @@ class DatabaseController {
10071007
})
10081008
}
10091009

1010-
addPointerPermissions(schema: any, className: string, operation: string, query: any, aclGroup: any[] = []) {
1010+
addPointerPermissions(schema: SchemaController.SchemaController, className: string, operation: string, query: any, aclGroup: any[] = []) {
10111011
// Check if class has public permission for operation
10121012
// If the BaseCLP pass, let go through
1013-
if (schema.testBaseCLP(className, aclGroup, operation)) {
1013+
if (schema.testPermissionsForClassName(className, aclGroup, operation)) {
10141014
return query;
10151015
}
10161016
const perms = schema.perms[className];

src/Controllers/SchemaController.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -859,12 +859,12 @@ export default class SchemaController {
859859
return Promise.resolve(this);
860860
}
861861

862-
// Validates the base CLP for an operation
863-
testBaseCLP(className: string, aclGroup: string[], operation: string) {
864-
return SchemaController.testBaseCLP(this.perms[className], aclGroup, operation);
862+
testPermissionsForClassName(className: string, aclGroup: string[], operation: string) {
863+
return SchemaController.testPermissions(this.perms[className], aclGroup, operation);
865864
}
866865

867-
static testBaseCLP(classPermissions: ?any, aclGroup: string[], operation: string) {
866+
// Tests that the class level permission let pass the operation for a given aclGroup
867+
static testPermissions(classPermissions: ?any, aclGroup: string[], operation: string): boolean {
868868
if (!classPermissions || !classPermissions[operation]) {
869869
return true;
870870
}
@@ -881,7 +881,7 @@ export default class SchemaController {
881881

882882
// Validates an operation passes class-level-permissions set in the schema
883883
static validatePermission(classPermissions: ?any, className: string, aclGroup: string[], operation: string) {
884-
if (SchemaController.testBaseCLP(classPermissions, aclGroup, operation)) {
884+
if (SchemaController.testPermissions(classPermissions, aclGroup, operation)) {
885885
return Promise.resolve();
886886
}
887887

src/LiveQuery/ParseLiveQueryServer.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,11 @@ class ParseLiveQueryServer {
4747
Parse.initialize(config.appId, Parse.javaScriptKey, config.masterKey);
4848

4949
// The cache controller is a proper cache controller
50-
// With access to User and Roles
50+
// with access to User and Roles
5151
this.cacheController = getCacheController(config)
5252

53-
// This auth cache stores the promises for each auth resolution
54-
// The main benefit is to be able to reuse the same user / session token resolution
55-
// And to chain
53+
// This auth cache stores the promises for each auth resolution.
54+
// The main benefit is to be able to reuse the same user / session token resolution.
5655
this.authCache = new LRU({
5756
max: 500, // 500 concurrent
5857
maxAge: 60 * 60 * 1000 // 1h
@@ -354,7 +353,7 @@ class ParseLiveQueryServer {
354353
const authPromise = getAuthForSessionToken({ cacheController: this.cacheController, sessionToken: sessionToken })
355354
.then((auth) => {
356355
return { auth, userId: auth && auth.user && auth.user.id };
357-
}, () => {
356+
}).catch(() => {
358357
// If you can't continue, let's just wrap it up and delete it.
359358
// Next time, one will try again
360359
this.authCache.del(sessionToken);

0 commit comments

Comments
 (0)