From 50737bc0d9c1ae806610e76be013eeddca1bf102 Mon Sep 17 00:00:00 2001 From: MinusGix Date: Thu, 5 Mar 2020 10:49:25 -0600 Subject: Move most uses of uType filtering to use UAC levels --- server/src/commands/mod/ban.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'server/src/commands/mod/ban.js') diff --git a/server/src/commands/mod/ban.js b/server/src/commands/mod/ban.js index dd5f01e..982c380 100644 --- a/server/src/commands/mod/ban.js +++ b/server/src/commands/mod/ban.js @@ -2,10 +2,12 @@ Description: Adds the target socket's ip to the ratelimiter */ +import * as UAC from "../utility/UAC/info"; + // module main export async function run(core, server, socket, data) { // increase rate limit chance and ignore if not admin or mod - if (socket.uType === 'user') { + if (!UAC.isModerator(socket.level)) { return server.police.frisk(socket.address, 10); } @@ -28,7 +30,7 @@ export async function run(core, server, socket, data) { [badClient] = badClient; // i guess banning mods or admins isn't the best idea? - if (badClient.uType !== 'user') { + if (badClient.level >= socket.level) { return server.reply({ cmd: 'warn', text: 'Cannot ban other mods, how rude', @@ -44,13 +46,13 @@ export async function run(core, server, socket, data) { server.broadcast({ cmd: 'info', text: `Banned ${targetNick}`, - }, { channel: socket.channel, uType: 'user' }); + }, { channel: socket.channel, level: (level) => level < UAC.levels.moderator }); // notify mods server.broadcast({ cmd: 'info', text: `${socket.nick} banned ${targetNick} in ${socket.channel}, userhash: ${badClient.hash}`, - }, { uType: 'mod' }); + }, { level: UAC.isModerator }); // force connection closed badClient.terminate(); -- cgit v1.2.1