From d500e73ffa3739f97394415ff19ba1be2aae2023 Mon Sep 17 00:00:00 2001 From: gnuxie Date: Mon, 17 Oct 2022 13:39:17 +0100 Subject: [PATCH] rename test->getAnyRuleForEntity --- src/models/AccessControlUnit.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/models/AccessControlUnit.ts b/src/models/AccessControlUnit.ts index f5a3c0d..074d7a8 100644 --- a/src/models/AccessControlUnit.ts +++ b/src/models/AccessControlUnit.ts @@ -59,7 +59,7 @@ class ListRuleCache { * @param entity e.g. an mxid for a user, the server name for a server. * @returns A single `ListRule` matching the entity. */ - public test(entity: string): ListRule|null { + public getAnyRuleForEntity(entity: string): ListRule|null { const literalRule = this.literalRules.get(entity); if (literalRule !== undefined) { return literalRule[0]; @@ -266,12 +266,12 @@ export default class AccessControlUnit { private getAccessForEntity(entity: string, allowCache: ListRuleCache, bannedCache: ListRuleCache): EntityAccess { // Check if the entity is explicitly allowed. // We have to infer that a rule exists for '*' if the allowCache is empty, otherwise you brick the ACL. - const allowRule = allowCache.test(entity); + const allowRule = allowCache.getAnyRuleForEntity(entity); if (allowRule === null && !allowCache.isEmpty()) { return { outcome: Access.NotAllowed } } // Now check if the entity is banned. - const banRule = bannedCache.test(entity); + const banRule = bannedCache.getAnyRuleForEntity(entity); if (banRule !== null) { return { outcome: Access.Banned, rule: banRule }; }