mirror of
https://github.com/matrix-org/mjolnir.git
synced 2024-10-01 01:36:06 -04:00
createServerAcl -> compileServerAcl
This commit is contained in:
parent
54ef50515d
commit
fc7ddae580
@ -300,7 +300,7 @@ export class ProtectedRooms {
|
|||||||
const serverName: string = new UserID(await this.client.getUserId()).domain;
|
const serverName: string = new UserID(await this.client.getUserId()).domain;
|
||||||
|
|
||||||
// Construct a server ACL first
|
// Construct a server ACL first
|
||||||
const acl = this.accessControlUnit.createServerAcl(serverName);
|
const acl = this.accessControlUnit.compileServerAcl(serverName);
|
||||||
const finalAcl = acl.safeAclContent();
|
const finalAcl = acl.safeAclContent();
|
||||||
|
|
||||||
if (this.config.verboseLogging) {
|
if (this.config.verboseLogging) {
|
||||||
|
@ -284,7 +284,7 @@ export default class AccessControlUnit {
|
|||||||
* @param serverName The name of the server that you are operating from, used to ensure you cannot brick yourself.
|
* @param serverName The name of the server that you are operating from, used to ensure you cannot brick yourself.
|
||||||
* @returns A new `ServerAcl` instance with deny and allow entries created from the rules in this unit.
|
* @returns A new `ServerAcl` instance with deny and allow entries created from the rules in this unit.
|
||||||
*/
|
*/
|
||||||
public createServerAcl(serverName: string) {
|
public compileServerAcl(serverName: string): ServerAcl {
|
||||||
const acl = new ServerAcl(serverName).denyIpAddresses();
|
const acl = new ServerAcl(serverName).denyIpAddresses();
|
||||||
const allowedServers = this.serverAllows.allRules;
|
const allowedServers = this.serverAllows.allRules;
|
||||||
// Allowed servers (allow).
|
// Allowed servers (allow).
|
||||||
|
@ -224,7 +224,7 @@ describe('Test: We will not be able to ban ourselves via ACL.', function() {
|
|||||||
assert.equal(acl.safeAclContent().deny.length, 1);
|
assert.equal(acl.safeAclContent().deny.length, 1);
|
||||||
assert.equal(acl.literalAclContent().deny.length, 3);
|
assert.equal(acl.literalAclContent().deny.length, 3);
|
||||||
|
|
||||||
const aclUnitAcl = aclUnit.createServerAcl(serverName);
|
const aclUnitAcl = aclUnit.compileServerAcl(serverName);
|
||||||
assert.equal(aclUnitAcl.literalAclContent().deny.length, 1);
|
assert.equal(aclUnitAcl.literalAclContent().deny.length, 1);
|
||||||
|
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user