From 5c9e93f62a2b1873b314e5bce3275261c7844379 Mon Sep 17 00:00:00 2001 From: Timo Smit Date: Mon, 29 Aug 2016 22:00:11 +0200 Subject: [PATCH] Created foundation for new ACL system --- luascripts/auth/acl.lua | 41 +++++++ luascripts/auth/auth.lua | 127 ++++++++++++++++++++++ luascripts/auth/shrubbot.lua | 114 +++++++++++++++++++ luascripts/commands/admin/balance.lua | 3 +- luascripts/commands/admin/dewarn.lua | 3 +- luascripts/commands/admin/enablevote.lua | 3 +- luascripts/commands/admin/greeting.lua | 3 +- luascripts/commands/admin/help.lua | 5 +- luascripts/commands/admin/incognito.lua | 5 +- luascripts/commands/admin/kickbots.lua | 3 +- luascripts/commands/admin/listaliases.lua | 5 +- luascripts/commands/admin/listlevels.lua | 3 +- luascripts/commands/admin/listmaps.lua | 3 +- luascripts/commands/admin/lock.lua | 3 +- luascripts/commands/admin/needbots.lua | 3 +- luascripts/commands/admin/plock.lua | 5 +- luascripts/commands/admin/punlock.lua | 3 +- luascripts/commands/admin/putbots.lua | 3 +- luascripts/commands/admin/readconfig.lua | 3 +- luascripts/commands/admin/resetsprees.lua | 3 +- luascripts/commands/admin/rules.lua | 3 +- luascripts/commands/admin/setlevel.lua | 3 +- luascripts/commands/admin/showwarns.lua | 3 +- luascripts/commands/admin/sprees.lua | 3 +- luascripts/commands/admin/stats.lua | 3 +- luascripts/commands/admin/unlock.lua | 3 +- luascripts/commands/admin/vmute.lua | 7 +- luascripts/commands/admin/vunmute.lua | 3 +- luascripts/commands/admin/warn.lua | 3 +- luascripts/commands/client/ac.lua | 7 +- luascripts/commands/client/pm.lua | 3 +- luascripts/commands/client/r.lua | 3 +- luascripts/commands/client/wolfadmin.lua | 3 +- luascripts/commands/commands.lua | 11 +- luascripts/game/voting.lua | 3 +- luascripts/players/greetings.lua | 4 +- 36 files changed, 361 insertions(+), 45 deletions(-) create mode 100644 luascripts/auth/acl.lua create mode 100644 luascripts/auth/auth.lua create mode 100644 luascripts/auth/shrubbot.lua diff --git a/luascripts/auth/acl.lua b/luascripts/auth/acl.lua new file mode 100644 index 0000000..abb24f1 --- /dev/null +++ b/luascripts/auth/acl.lua @@ -0,0 +1,41 @@ + +-- WolfAdmin module for Wolfenstein: Enemy Territory servers. +-- Copyright (C) 2015-2016 Timo 'Timothy' Smit + +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- at your option any later version. + +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. + +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . + +local events = require "luascripts.wolfadmin.util.events" +local files = require "luascripts.wolfadmin.util.files" + +local auth = require "luascripts.wolfadmin.auth.auth" + +local acl = {} + +function acl.readpermissions() + -- read level permissions into a cache file (can be loaded at mod start) + -- should probably cache current players' permissions as well, then + -- read in new players' permissions as they join the server +end + +function acl.clearcache() + -- clear cache whenever database is updated, or do this manually +end + +function acl.isallowed(clientId, permission) + -- stub function, reads from cache + + return 1 +end + +return acl diff --git a/luascripts/auth/auth.lua b/luascripts/auth/auth.lua new file mode 100644 index 0000000..66bf7f5 --- /dev/null +++ b/luascripts/auth/auth.lua @@ -0,0 +1,127 @@ + +-- WolfAdmin module for Wolfenstein: Enemy Territory servers. +-- Copyright (C) 2015-2016 Timo 'Timothy' Smit + +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- at your option any later version. + +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. + +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . + +local events = require "luascripts.wolfadmin.util.events" +local files = require "luascripts.wolfadmin.util.files" +local settings = require "luascripts.wolfadmin.util.settings" + +local auth = {} + +local srv + +auth.PERM_ADMINTEST = "admintest" +auth.PERM_HELP = "help" +auth.PERM_TIME = "time" +auth.PERM_GREETING = "greeting" + +auth.PERM_LISTPLAYERS = "listplayers" +auth.PERM_LISTTEAMS = "listteams" +auth.PERM_LISTSPREES = "listsprees" +auth.PERM_LISTRULES = "listrules" +auth.PERM_LISTWARNS = "listwarns" +auth.PERM_LISTBANS = "listbans" +auth.PERM_LISTALIASES = "listaliases" +auth.PERM_LISTLEVELS = "listlevels" +auth.PERM_LISTSTATS = "liststats" +auth.PERM_FINGER = "finger" + +auth.PERM_RESETXP = "resetxp" +auth.PERM_RESETXP_SELF = "resetxp_self" + +auth.PERM_ADMINCHAT = "adminchat" + +auth.PERM_PUT = "put" +auth.PERM_DROPWEAPONS = "dropweapons" +auth.PERM_RENAME = "rename" +auth.PERM_FREEZE = "freeze" +auth.PERM_DISORIENT = "disorient" +auth.PERM_BURN = "burn" +auth.PERM_GIB = "gib" +auth.PERM_THROW = "throw" +auth.PERM_GLOW = "glow" +auth.PERM_PANTS = "pants" +auth.PERM_POP = "pop" + +auth.PERM_WARN = "warn" +auth.PERM_MUTE = "mute" +auth.PERM_VOICEMUTE = "voicemute" +auth.PERM_KICK = "kick" +auth.PERM_BAN = "ban" + +auth.PERM_SPEC999 = "spec999" +auth.PERM_BALANCE = "balance" +auth.PERM_LOCKPLAYER = "lockplayers" +auth.PERM_LOCKTEAM = "lockteam" +auth.PERM_SHUFFLE = "shuffle" +auth.PERM_SWAP = "swap" + +auth.PERM_PAUSE = "pause" +auth.PERM_NEXTMAP = "nextmap" +auth.PERM_RESTART = "restart" + +auth.PERM_BOTADMIN = "botadmin" + +auth.PERM_ENABLEVOTE = "enablevote" +auth.PERM_CANCELVOTE = "cancelvote" +auth.PERM_PASSVOTE = "passvote" + +auth.PERM_NEWS = "news" + +auth.PERM_UPTIME = "uptime" +auth.PERM_SETLEVEL = "setlevel" +auth.PERM_READCONFIG = "readconfig" + +auth.PERM_CHEATS = "cheats" +auth.PERM_DISGUISE = "disguise" -- legacy +auth.PERM_AMMOPACK = "ammopack" -- legacy +auth.PERM_MEDPACK = "medpack" -- legacy +auth.PERM_REVIVE = "revive" -- legacy + +auth.PERM_NOINACTIVITY = "noinactivity" +auth.PERM_NOVOTE = "novote" +auth.PERM_NOCENSOR = "nocensor" +auth.PERM_NOBALANCE = "nobalance" +auth.PERM_NOVOTELIMIT = "novotelimit" +auth.PERM_NOREASON = "noreason" +auth.PERM_PERMA = "perma" + +auth.PERM_TEAMCMDS = "teamcmds" +auth.PERM_SILENTCMDS = "silentcmds" + +auth.PERM_SPY = "spy" +auth.PERM_INCOGNITO = "incognito" +auth.PERM_IMMUNE = "immune" + +-- as this module serves as a wrapper/super class, we load the selected database +-- system in this function. might have to think of a better way to implement +-- this, but it will suffice. +function auth.oninit() + if settings.get("g_standalone") == 1 then + srv = require "luascripts.wolfadmin.auth.acl" + else + srv = require "luascripts.wolfadmin.auth.shrubbot" + end + + if settings.get("g_standalone") == 1 and et.trap_Cvar_Get("g_shrubbot") ~= "" then + outputDebug("Running in standalone mode while g_shrubbot is set", 3) + end + + setmetatable(auth, {__index = srv}) +end +events.handle("onGameInit", auth.oninit) + +return auth diff --git a/luascripts/auth/shrubbot.lua b/luascripts/auth/shrubbot.lua new file mode 100644 index 0000000..a253b93 --- /dev/null +++ b/luascripts/auth/shrubbot.lua @@ -0,0 +1,114 @@ + +-- WolfAdmin module for Wolfenstein: Enemy Territory servers. +-- Copyright (C) 2015-2016 Timo 'Timothy' Smit + +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- at your option any later version. + +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. + +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . + +local events = require "luascripts.wolfadmin.util.events" +local files = require "luascripts.wolfadmin.util.files" + +local auth = require "luascripts.wolfadmin.auth.auth" + +local shrubbot = {} + +local flags = { + [auth.PERM_ADMINTEST] = "a", + [auth.PERM_HELP] = "h", + [auth.PERM_TIME] = "C", + [auth.PERM_GREETING] = "Q", + + [auth.PERM_LISTPLAYERS] = "i", + [auth.PERM_LISTTEAMS] = "l", + [auth.PERM_LISTSPREES] = "I", + [auth.PERM_LISTRULES] = "C", + [auth.PERM_LISTWARNS] = "R", + [auth.PERM_LISTBANS] = "B", + [auth.PERM_LISTALIASES] = "f", + [auth.PERM_LISTLEVELS] = "s", + [auth.PERM_LISTSTATS] = "I", + [auth.PERM_FINGER] = "f", + + [auth.PERM_RESETXP] = "X", + [auth.PERM_RESETXP_SELF] = "M", + + [auth.PERM_ADMINCHAT] = "~", + + [auth.PERM_PUT] = "p", + [auth.PERM_DROPWEAPONS] = "D", + [auth.PERM_RENAME] = "N", + [auth.PERM_FREEZE] = "E", + [auth.PERM_DISORIENT] = "d", + [auth.PERM_BURN] = "U", + [auth.PERM_GIB] = "g", + [auth.PERM_THROW] = "L", + [auth.PERM_GLOW] = "o", + [auth.PERM_PANTS] = "t", + [auth.PERM_POP] = "z", + + [auth.PERM_WARN] = "R", + [auth.PERM_MUTE] = "m", + [auth.PERM_VOICEMUTE] = "m", + [auth.PERM_KICK] = "k", + [auth.PERM_BAN] = "b", + + [auth.PERM_SPEC999] = "P", + [auth.PERM_BALANCE] = "p", + [auth.PERM_LOCKPLAYER] = "L", + [auth.PERM_LOCKTEAM] = "L", + [auth.PERM_SHUFFLE] = "S", + [auth.PERM_SWAP] = "w", + + [auth.PERM_PAUSE] = "Z", + [auth.PERM_NEXTMAP] = "n", + [auth.PERM_RESTART] = "r", + + [auth.PERM_BOTADMIN] = "O", + + [auth.PERM_ENABLEVOTE] = "c", + [auth.PERM_CANCELVOTE] = "c", + [auth.PERM_PASSVOTE] = "V", + + [auth.PERM_NEWS] = "W", + + [auth.PERM_UPTIME] = "u", + [auth.PERM_SETLEVEL] = "s", + [auth.PERM_READCONFIG] = "G", + + [auth.PERM_CHEATS] = "e", + [auth.PERM_DISGUISE] = "T", + [auth.PERM_AMMOPACK] = "J", + [auth.PERM_MEDPACK] = "J", + [auth.PERM_REVIVE] = "v", + + [auth.PERM_NOINACTIVITY] = "0", + [auth.PERM_NOVOTE] = "1", + [auth.PERM_NOCENSOR] = "2", + [auth.PERM_NOBALANCE] = "5", + [auth.PERM_NOVOTELIMIT] = "7", + [auth.PERM_NOREASON] = "6", + [auth.PERM_PERMA] = "8", + + [auth.PERM_TEAMCMDS] = "9", + [auth.PERM_SILENTCMDS] = "3", + + [auth.PERM_SPY] = "4", + [auth.PERM_INCOGNITO] = "@", + [auth.PERM_IMMUNE] = "!", +} + +function shrubbot.isallowed(clientId, permission) + return et.G_shrubbot_permission(clientId, flags[permission]) +end + +return shrubbot diff --git a/luascripts/commands/admin/balance.lua b/luascripts/commands/admin/balance.lua index ccd2b7c..4b7c305 100644 --- a/luascripts/commands/admin/balance.lua +++ b/luascripts/commands/admin/balance.lua @@ -16,6 +16,7 @@ -- along with this program. If not, see . local commands = require "luascripts.wolfadmin.commands.commands" +local auth = require "luascripts.wolfadmin.auth.auth" local balancer = require "luascripts.wolfadmin.admin.balancer" function commandBalance(clientId, cmdArguments) @@ -43,4 +44,4 @@ function commandBalance(clientId, cmdArguments) return true end -commands.addadmin("balance", commandBalance, "p", "either asks the players to even up or evens them by moving or shuffling players", "^2!balance ^9(^hforce^9)") \ No newline at end of file +commands.addadmin("balance", commandBalance, auth.PERM_BALANCE, "either asks the players to even up or evens them by moving or shuffling players", "^2!balance ^9(^hforce^9)") diff --git a/luascripts/commands/admin/dewarn.lua b/luascripts/commands/admin/dewarn.lua index 5a2fb37..031d428 100644 --- a/luascripts/commands/admin/dewarn.lua +++ b/luascripts/commands/admin/dewarn.lua @@ -18,6 +18,7 @@ local db = require "luascripts.wolfadmin.db.db" local settings = require "luascripts.wolfadmin.util.settings" local commands = require "luascripts.wolfadmin.commands.commands" +local auth = require "luascripts.wolfadmin.auth.auth" local warns = require "luascripts.wolfadmin.admin.warns" function commandRemoveWarn(clientId, cmdArguments) @@ -57,4 +58,4 @@ function commandRemoveWarn(clientId, cmdArguments) return true end -commands.addadmin("dewarn", commandRemoveWarn, "R", "remove a warning for a certain player", "^9[^3name|slot#^9] ^9[^3warn#^9]", function() return (settings.get("g_warnHistory") == 0 or not db.isconnected()) end) \ No newline at end of file +commands.addadmin("dewarn", commandRemoveWarn, auth.PERM_WARN, "remove a warning for a certain player", "^9[^3name|slot#^9] ^9[^3warn#^9]", function() return (settings.get("g_warnHistory") == 0 or not db.isconnected()) end) diff --git a/luascripts/commands/admin/enablevote.lua b/luascripts/commands/admin/enablevote.lua index b3ae804..0ddbb87 100644 --- a/luascripts/commands/admin/enablevote.lua +++ b/luascripts/commands/admin/enablevote.lua @@ -16,6 +16,7 @@ -- along with this program. If not, see . local commands = require "luascripts.wolfadmin.commands.commands" +local auth = require "luascripts.wolfadmin.auth.auth" local voting = require "luascripts.wolfadmin.game.voting" function commandEnableVote(clientId, cmdArguments) @@ -25,4 +26,4 @@ function commandEnableVote(clientId, cmdArguments) return true end -commands.addadmin("enablevote", commandEnableVote, "c", "enables next map voting") \ No newline at end of file +commands.addadmin("enablevote", commandEnableVote, auth.PERM_ENABLEVOTE, "enables next map voting") diff --git a/luascripts/commands/admin/greeting.lua b/luascripts/commands/admin/greeting.lua index 8f995b7..6a6d45d 100644 --- a/luascripts/commands/admin/greeting.lua +++ b/luascripts/commands/admin/greeting.lua @@ -16,6 +16,7 @@ -- along with this program. If not, see . local util = require "luascripts.wolfadmin.util.util" +local auth = require "luascripts.wolfadmin.auth.auth" local commands = require "luascripts.wolfadmin.commands.commands" local settings = require "luascripts.wolfadmin.util.settings" local greetings = require "luascripts.wolfadmin.players.greetings" @@ -29,4 +30,4 @@ function commandGreeting(clientId, cmdArguments) et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dgreeting: ^9you do not have a personal greeting.\";") end end -commands.addadmin("greeting", commandGreeting, "Q", "display your personal greeting, if you have one") \ No newline at end of file +commands.addadmin("greeting", commandGreeting, auth.PERM_GREETING, "display your personal greeting, if you have one") diff --git a/luascripts/commands/admin/help.lua b/luascripts/commands/admin/help.lua index 5906ca2..2e8efa7 100644 --- a/luascripts/commands/admin/help.lua +++ b/luascripts/commands/admin/help.lua @@ -16,6 +16,7 @@ -- along with this program. If not, see . local commands = require "luascripts.wolfadmin.commands.commands" +local auth = require "luascripts.wolfadmin.auth.auth" function commandHelp(clientId, cmdArguments) local cmds = commands.getadmin() @@ -24,7 +25,7 @@ function commandHelp(clientId, cmdArguments) local availableCommands = {} for command, data in pairs(cmds) do - if data["function"] and data["flag"] and et.G_shrubbot_permission(clientId, data["flag"]) == 1 and (not data["hidden"] or (type(data["hidden"]) == "function" and not data["hidden"]())) then + if data["function"] and data["flag"] and auth.isallowed(clientId, data["flag"]) == 1 and (not data["hidden"] or (type(data["hidden"]) == "function" and not data["hidden"]())) then table.insert(availableCommands, command) end end @@ -66,4 +67,4 @@ function commandHelp(clientId, cmdArguments) return false end -commands.addadmin("help", commandHelp, "h", "display commands available to you or help on a specific command", "^9(^hcommand^9)", true) \ No newline at end of file +commands.addadmin("help", commandHelp, auth.PERM_HELP, "display commands available to you or help on a specific command", "^9(^hcommand^9)", true) diff --git a/luascripts/commands/admin/incognito.lua b/luascripts/commands/admin/incognito.lua index 8012e25..d74cf22 100644 --- a/luascripts/commands/admin/incognito.lua +++ b/luascripts/commands/admin/incognito.lua @@ -16,6 +16,7 @@ -- along with this program. If not, see . local commands = require "luascripts.wolfadmin.commands.commands" +local auth = require "luascripts.wolfadmin.auth.auth" local stats = require "luascripts.wolfadmin.players.stats" function commandIncognito(clientId, cmdArguments) @@ -37,7 +38,7 @@ function commandIncognito(clientId, cmdArguments) -- et.G_Print(string.format("%s %s %d %s\n", adminName, adminGUID, adminLevel, adminFlags)) if stats.get(clientId, "playerGUID") == adminGUID then - if et.G_shrubbot_permission(clientId, "@") ~= 1 then + if auth.isallowed(clientId, "@") ~= 1 then adminFlags = adminFlags.."+@" et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat "..clientId.." \"^dincognito: ^9you are now playing incognito.\";") @@ -74,4 +75,4 @@ function commandIncognito(clientId, cmdArguments) return true end -commands.addadmin("incognito", commandIncognito, "s", "fakes your level to guest (no aka)") \ No newline at end of file +commands.addadmin("incognito", commandIncognito, auth.PERM_INCOGNITO, "fakes your level to guest (no aka)") diff --git a/luascripts/commands/admin/kickbots.lua b/luascripts/commands/admin/kickbots.lua index 47b2084..fa6ef96 100644 --- a/luascripts/commands/admin/kickbots.lua +++ b/luascripts/commands/admin/kickbots.lua @@ -15,6 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +local auth = require "luascripts.wolfadmin.auth.auth" local commands = require "luascripts.wolfadmin.commands.commands" local bots = require "luascripts.wolfadmin.game.bots" @@ -25,4 +26,4 @@ function commandBotsOff(clientId, cmdArguments) return true end -commands.addadmin("kickbots", commandBotsOff, "O", "kicks all bots from the game") \ No newline at end of file +commands.addadmin("kickbots", commandBotsOff, auth.PERM_BOTADMIN, "kicks all bots from the game") diff --git a/luascripts/commands/admin/listaliases.lua b/luascripts/commands/admin/listaliases.lua index 35bc116..f80d399 100644 --- a/luascripts/commands/admin/listaliases.lua +++ b/luascripts/commands/admin/listaliases.lua @@ -18,6 +18,7 @@ local util = require "luascripts.wolfadmin.util.util" local settings = require "luascripts.wolfadmin.util.settings" local pagination = require "luascripts.wolfadmin.util.pagination" +local auth = require "luascripts.wolfadmin.auth.auth" local db = require "luascripts.wolfadmin.db.db" local commands = require "luascripts.wolfadmin.commands.commands" local stats = require "luascripts.wolfadmin.players.stats" @@ -47,7 +48,7 @@ function commandListAliases(clientId, cmdArguments) return true end - if et.G_shrubbot_permission(cmdClient, "!") == 1 then + if auth.isallowed(cmdClient, "!") == 1 then et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dlistaliases: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is immune to this command.\";") return true @@ -76,4 +77,4 @@ function commandListAliases(clientId, cmdArguments) return true end -commands.addadmin("listaliases", commandListAliases, "f", "display all known aliases for a player", "^9[^3name|slot#^9] ^9(^hoffset^9)", function() return (not db.isconnected()) end) \ No newline at end of file +commands.addadmin("listaliases", commandListAliases, auth.PERM_FINGER, "display all known aliases for a player", "^9[^3name|slot#^9] ^9(^hoffset^9)", function() return (not db.isconnected()) end) diff --git a/luascripts/commands/admin/listlevels.lua b/luascripts/commands/admin/listlevels.lua index 56852c4..9018ce4 100644 --- a/luascripts/commands/admin/listlevels.lua +++ b/luascripts/commands/admin/listlevels.lua @@ -15,6 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +local auth = require "luascripts.wolfadmin.auth.auth" local util = require "luascripts.wolfadmin.util.util" local settings = require "luascripts.wolfadmin.util.settings" local pagination = require "luascripts.wolfadmin.util.pagination" @@ -93,4 +94,4 @@ function commandListLevels(clientId, cmdArguments) return true end -commands.addadmin("listlevels", commandListLevels, "s", "display all levels on the server", (not db.isconnected() and nil or "^9(^3name|slot#^9) ^9(^hoffset^9)")) \ No newline at end of file +commands.addadmin("listlevels", commandListLevels, auth.PERM_LISTLEVELS, "display all levels on the server", (not db.isconnected() and nil or "^9(^3name|slot#^9) ^9(^hoffset^9)")) diff --git a/luascripts/commands/admin/listmaps.lua b/luascripts/commands/admin/listmaps.lua index e352cdc..f3f5a4a 100644 --- a/luascripts/commands/admin/listmaps.lua +++ b/luascripts/commands/admin/listmaps.lua @@ -15,6 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +local auth = require "luascripts.wolfadmin.auth.auth" local util = require "luascripts.wolfadmin.util.util" local commands = require "luascripts.wolfadmin.commands.commands" local game = require "luascripts.wolfadmin.game.game" @@ -35,4 +36,4 @@ function commandListMaps(clientId, cmdArguments) return true end -commands.addadmin("listmaps", commandListMaps, "C", "display the maps in the rotation") \ No newline at end of file +commands.addadmin("listmaps", commandListMaps, auth.PERM_LISTMAPS, "display the maps in the rotation") diff --git a/luascripts/commands/admin/lock.lua b/luascripts/commands/admin/lock.lua index e30c500..06e0c6e 100644 --- a/luascripts/commands/admin/lock.lua +++ b/luascripts/commands/admin/lock.lua @@ -15,6 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +local auth = require "luascripts.wolfadmin.auth.auth" local util = require "luascripts.wolfadmin.util.util" local constants = require "luascripts.wolfadmin.util.constants" local commands = require "luascripts.wolfadmin.commands.commands" @@ -37,4 +38,4 @@ function commandLock(clientId, cmdArguments) return false end -commands.addadmin("lock", commandLock, "K", "lock one or all of the teams from players joining", "^9[^3r|b|s|all#^9]", true) \ No newline at end of file +commands.addadmin("lock", commandLock, auth.PERM_LOCKTEAM, "lock one or all of the teams from players joining", "^9[^3r|b|s|all#^9]", true) diff --git a/luascripts/commands/admin/needbots.lua b/luascripts/commands/admin/needbots.lua index 9f8f077..02c85e2 100644 --- a/luascripts/commands/admin/needbots.lua +++ b/luascripts/commands/admin/needbots.lua @@ -15,6 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +local auth = require "luascripts.wolfadmin.auth.auth" local commands = require "luascripts.wolfadmin.commands.commands" local bots = require "luascripts.wolfadmin.game.bots" @@ -25,4 +26,4 @@ function commandBotsOn(clientId, cmdArguments) return true end -commands.addadmin("needbots", commandBotsOn, "O", "adds bots to the game") \ No newline at end of file +commands.addadmin("needbots", commandBotsOn, auth.PERM_BOTADMIN, "adds bots to the game") diff --git a/luascripts/commands/admin/plock.lua b/luascripts/commands/admin/plock.lua index 3b3dbf8..67674a0 100644 --- a/luascripts/commands/admin/plock.lua +++ b/luascripts/commands/admin/plock.lua @@ -15,6 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +local auth = require "luascripts.wolfadmin.auth.auth" local util = require "luascripts.wolfadmin.util.util" local commands = require "luascripts.wolfadmin.commands.commands" local admin = require "luascripts.wolfadmin.admin.admin" @@ -45,7 +46,7 @@ function commandPlayerLock(clientId, cmdArguments) et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dplock: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is already locked to a team.\";") return true - elseif et.G_shrubbot_permission(cmdClient, "!") == 1 then + elseif auth.isallowed(cmdClient, "!") == 1 then et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dplock: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is immune to this command.\";") return true @@ -61,4 +62,4 @@ function commandPlayerLock(clientId, cmdArguments) return true end -commands.addadmin("plock", commandPlayerLock, "K", "locks a player to a specific team", "^9[^3name|slot#^9]") \ No newline at end of file +commands.addadmin("plock", commandPlayerLock, auth.PERM_LOCKPLAYER, "locks a player to a specific team", "^9[^3name|slot#^9]") diff --git a/luascripts/commands/admin/punlock.lua b/luascripts/commands/admin/punlock.lua index 6f0b393..5c34522 100644 --- a/luascripts/commands/admin/punlock.lua +++ b/luascripts/commands/admin/punlock.lua @@ -15,6 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +local auth = require "luascripts.wolfadmin.auth.auth" local util = require "luascripts.wolfadmin.util.util" local commands = require "luascripts.wolfadmin.commands.commands" local admin = require "luascripts.wolfadmin.admin.admin" @@ -53,4 +54,4 @@ function commandPlayerUnlock(clientId, cmdArguments) return true end -commands.addadmin("punlock", commandPlayerUnlock, "K", "unlocks a player", "^9[^3name|slot#^9]") \ No newline at end of file +commands.addadmin("punlock", commandPlayerUnlock, auth.PERM_LOCKPLAYER, "unlocks a player", "^9[^3name|slot#^9]") diff --git a/luascripts/commands/admin/putbots.lua b/luascripts/commands/admin/putbots.lua index 3732be6..5fd5943 100644 --- a/luascripts/commands/admin/putbots.lua +++ b/luascripts/commands/admin/putbots.lua @@ -15,6 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +local auth = require "luascripts.wolfadmin.auth.auth" local constants = require "luascripts.wolfadmin.util.constants" local util = require "luascripts.wolfadmin.util.util" local balancer = require "luascripts.wolfadmin.admin.balancer" @@ -51,4 +52,4 @@ function commandPutBots(clientId, cmdArguments) return true end -commands.addadmin("putbots", commandPutBots, "p", "puts all bots into a specific team", "^9[r|b|s]") \ No newline at end of file +commands.addadmin("putbots", commandPutBots, auth.PERM_PUT, "puts all bots into a specific team", "^9[r|b|s]") diff --git a/luascripts/commands/admin/readconfig.lua b/luascripts/commands/admin/readconfig.lua index 6baaff0..c84dc8a 100644 --- a/luascripts/commands/admin/readconfig.lua +++ b/luascripts/commands/admin/readconfig.lua @@ -15,6 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +local auth = require "luascripts.wolfadmin.auth.auth" local settings = require "luascripts.wolfadmin.util.settings" local commands = require "luascripts.wolfadmin.commands.commands" local rules = require "luascripts.wolfadmin.admin.rules" @@ -29,4 +30,4 @@ function commandReadconfig(clientId, cmdArguments) return false end -commands.addadmin("readconfig", commandReadconfig, "G", "reloads the shrubbot config file and refreshes user flags", nil, true) \ No newline at end of file +commands.addadmin("readconfig", commandReadconfig, auth.PERM_READCONFIG, "reloads the shrubbot config file and refreshes user flags", nil, true) diff --git a/luascripts/commands/admin/resetsprees.lua b/luascripts/commands/admin/resetsprees.lua index efdeb24..a998065 100644 --- a/luascripts/commands/admin/resetsprees.lua +++ b/luascripts/commands/admin/resetsprees.lua @@ -15,6 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +local auth = require "luascripts.wolfadmin.auth.auth" local db = require "luascripts.wolfadmin.db.db" local commands = require "luascripts.wolfadmin.commands.commands" local game = require "luascripts.wolfadmin.game.game" @@ -39,4 +40,4 @@ function commandResetSprees(clientId, cmdArguments) return true end -commands.addadmin("resetsprees", commandResetSprees, "G", "resets the spree records") \ No newline at end of file +commands.addadmin("resetsprees", commandResetSprees, auth.PERM_READCONFIG, "resets the spree records") diff --git a/luascripts/commands/admin/rules.lua b/luascripts/commands/admin/rules.lua index 47d1ab6..325d9b3 100644 --- a/luascripts/commands/admin/rules.lua +++ b/luascripts/commands/admin/rules.lua @@ -15,6 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +local auth = require "luascripts.wolfadmin.auth.auth" local commands = require "luascripts.wolfadmin.commands.commands" local rules = require "luascripts.wolfadmin.admin.rules" @@ -42,4 +43,4 @@ function commandRules(clientId, cmdArguments) return true end -commands.addadmin("rules", commandRules, "C", "display the rules on the server", "^9(^hrule^9)") \ No newline at end of file +commands.addadmin("rules", commandRules, auth.PERM_LISTRULES, "display the rules on the server", "^9(^hrule^9)") diff --git a/luascripts/commands/admin/setlevel.lua b/luascripts/commands/admin/setlevel.lua index 3ed8eba..0922d1c 100644 --- a/luascripts/commands/admin/setlevel.lua +++ b/luascripts/commands/admin/setlevel.lua @@ -15,6 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +local auth = require "luascripts.wolfadmin.auth.auth" local settings = require "luascripts.wolfadmin.util.settings" local db = require "luascripts.wolfadmin.db.db" local commands = require "luascripts.wolfadmin.commands.commands" @@ -46,4 +47,4 @@ function commandSetLevel(clientId, cmdArguments) return false end -commands.addadmin("setlevel", commandSetLevel, "s", "sets the admin level of a player", "^9[^3name|slot#^9] ^9[^3level^9]", true) \ No newline at end of file +commands.addadmin("setlevel", commandSetLevel, auth.PERM_SETLEVEL, "sets the admin level of a player", "^9[^3name|slot#^9] ^9[^3level^9]", true) diff --git a/luascripts/commands/admin/showwarns.lua b/luascripts/commands/admin/showwarns.lua index 520e0ce..fd30701 100644 --- a/luascripts/commands/admin/showwarns.lua +++ b/luascripts/commands/admin/showwarns.lua @@ -15,6 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +local auth = require "luascripts.wolfadmin.auth.auth" local util = require "luascripts.wolfadmin.util.util" local settings = require "luascripts.wolfadmin.util.settings" local pagination = require "luascripts.wolfadmin.util.pagination" @@ -66,4 +67,4 @@ function commandShowWarns(clientId, cmdArguments) return true end -commands.addadmin("showwarns", commandShowWarns, "R", "display warnings for a specific player", "^9[^3name|slot#^9] ^9(^hoffset^9)", function() return (settings.get("g_warnHistory") == 0 or not db.isconnected()) end) \ No newline at end of file +commands.addadmin("showwarns", commandShowWarns, auth.PERM_LISTWARNS, "display warnings for a specific player", "^9[^3name|slot#^9] ^9(^hoffset^9)", function() return (settings.get("g_warnHistory") == 0 or not db.isconnected()) end) diff --git a/luascripts/commands/admin/sprees.lua b/luascripts/commands/admin/sprees.lua index 1784496..3bdfd3b 100644 --- a/luascripts/commands/admin/sprees.lua +++ b/luascripts/commands/admin/sprees.lua @@ -15,6 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +local auth = require "luascripts.wolfadmin.auth.auth" local commands = require "luascripts.wolfadmin.commands.commands" local db = require "luascripts.wolfadmin.db.db" local sprees = require "luascripts.wolfadmin.game.sprees" @@ -44,4 +45,4 @@ function commandShowSprees(clientId, cmdArguments) return true end -commands.addadmin("sprees", commandShowSprees, "I", "display the current spree records") \ No newline at end of file +commands.addadmin("sprees", commandShowSprees, auth.PERM_LISTSPREES, "display the current spree records") diff --git a/luascripts/commands/admin/stats.lua b/luascripts/commands/admin/stats.lua index 9b0b457..5f426b0 100644 --- a/luascripts/commands/admin/stats.lua +++ b/luascripts/commands/admin/stats.lua @@ -15,6 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +local auth = require "luascripts.wolfadmin.auth.auth" local util = require "luascripts.wolfadmin.util.util" local commands = require "luascripts.wolfadmin.commands.commands" @@ -94,4 +95,4 @@ function commandShowStats(clientId, cmdArguments) return true end -commands.addadmin("stats", commandShowStats, "I", "display the statistics for a specific player", "^9[^3name|slot#^9]") \ No newline at end of file +commands.addadmin("stats", commandShowStats, auth.PERM_LISTSTATS, "display the statistics for a specific player", "^9[^3name|slot#^9]") diff --git a/luascripts/commands/admin/unlock.lua b/luascripts/commands/admin/unlock.lua index 7a93a3b..244a2c7 100644 --- a/luascripts/commands/admin/unlock.lua +++ b/luascripts/commands/admin/unlock.lua @@ -15,6 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +local auth = require "luascripts.wolfadmin.auth.auth" local util = require "luascripts.wolfadmin.util.util" local constants = require "luascripts.wolfadmin.util.constants" local commands = require "luascripts.wolfadmin.commands.commands" @@ -37,4 +38,4 @@ function commandUnlock(clientId, cmdArguments) return false end -commands.addadmin("unlock", commandUnlock, "K", "unlock one or all locked teams", "^9[^3r|b|s|all#^9]", true) \ No newline at end of file +commands.addadmin("unlock", commandUnlock, auth.PERM_LOCKTEAM, "unlock one or all locked teams", "^9[^3r|b|s|all#^9]", true) diff --git a/luascripts/commands/admin/vmute.lua b/luascripts/commands/admin/vmute.lua index dd5f8ba..d170d2e 100644 --- a/luascripts/commands/admin/vmute.lua +++ b/luascripts/commands/admin/vmute.lua @@ -15,6 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +local auth = require "luascripts.wolfadmin.auth.auth" local util = require "luascripts.wolfadmin.util.util" local commands = require "luascripts.wolfadmin.commands.commands" local admin = require "luascripts.wolfadmin.admin.admin" @@ -49,7 +50,7 @@ function commandVoiceMute(clientId, cmdArguments) vmuteTime = util.getTimeFromString(cmdArguments[2]) elseif cmdArguments[2] then vmuteReason = table.concat(cmdArguments, " ", 2) - elseif et.G_shrubbot_permission(clientId, "8") ~= 1 then + elseif auth.isallowed(clientId, "8") ~= 1 then et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dvmute usage: "..commands.getadmin("vmute")["syntax"].."\";") return true @@ -59,7 +60,7 @@ function commandVoiceMute(clientId, cmdArguments) et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dvmute: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is already muted.\";") return true - elseif et.G_shrubbot_permission(cmdClient, "!") == 1 then + elseif auth.isallowed(cmdClient, "!") == 1 then et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dvmute: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is immune to this command.\";") return true @@ -75,4 +76,4 @@ function commandVoiceMute(clientId, cmdArguments) return true end -commands.addadmin("vmute", commandVoiceMute, "m", "voicemutes a player", "^9[^3name|slot#^9]") \ No newline at end of file +commands.addadmin("vmute", commandVoiceMute, auth.PERM_VOICEMUTE, "voicemutes a player", "^9[^3name|slot#^9]") diff --git a/luascripts/commands/admin/vunmute.lua b/luascripts/commands/admin/vunmute.lua index 5877309..4f83d95 100644 --- a/luascripts/commands/admin/vunmute.lua +++ b/luascripts/commands/admin/vunmute.lua @@ -15,6 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +local auth = require "luascripts.wolfadmin.auth.auth" local commands = require "luascripts.wolfadmin.commands.commands" local admin = require "luascripts.wolfadmin.admin.admin" @@ -51,4 +52,4 @@ function commandVoiceUnmute(clientId, cmdArguments) return true end -commands.addadmin("vunmute", commandVoiceUnmute, "m", "unvoicemutes a player", "^9[^3name|slot#^9]") \ No newline at end of file +commands.addadmin("vunmute", commandVoiceUnmute, auth.PERM_VOICEMUTE, "unvoicemutes a player", "^9[^3name|slot#^9]") diff --git a/luascripts/commands/admin/warn.lua b/luascripts/commands/admin/warn.lua index 1b2d158..798dcba 100644 --- a/luascripts/commands/admin/warn.lua +++ b/luascripts/commands/admin/warn.lua @@ -15,6 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +local auth = require "luascripts.wolfadmin.auth.auth" local settings = require "luascripts.wolfadmin.util.settings" local db = require "luascripts.wolfadmin.db.db" local commands = require "luascripts.wolfadmin.commands.commands" @@ -41,4 +42,4 @@ function commandAddWarn(clientId, cmdArguments) return false end -commands.addadmin("warn", commandAddWarn, "R", "warns a player by displaying the reason", "^9[^3name|slot#^9] ^9[^3reason^9]", true) \ No newline at end of file +commands.addadmin("warn", commandAddWarn, auth.PERM_WARN, "warns a player by displaying the reason", "^9[^3name|slot#^9] ^9[^3reason^9]", true) diff --git a/luascripts/commands/client/ac.lua b/luascripts/commands/client/ac.lua index 87ae5f5..15b1fed 100644 --- a/luascripts/commands/client/ac.lua +++ b/luascripts/commands/client/ac.lua @@ -15,6 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +local auth = require "luascripts.wolfadmin.auth.auth" local commands = require "luascripts.wolfadmin.commands.commands" function commandAdminChat(clientId, cmdArguments) @@ -29,7 +30,7 @@ function commandAdminChat(clientId, cmdArguments) end for playerId = 0, et.trap_Cvar_Get("sv_maxclients") - 1 do - if wolfa_isPlayer(playerId) and et.G_shrubbot_permission(playerId, "~") == 1 then + if wolfa_isPlayer(playerId) and auth.isallowed(playerId, "~") == 1 then table.insert(recipients, playerId) end end @@ -45,5 +46,5 @@ function commandAdminChat(clientId, cmdArguments) return true end -commands.addclient("adminchat", commandAdminChat, "~", "[^2message^7]", true) -commands.addclient("ac", commandAdminChat, "~", "[^2message^7]", true) \ No newline at end of file +commands.addclient("adminchat", commandAdminChat, auth.PERM_ADMINCHAT, "[^2message^7]", true) +commands.addclient("ac", commandAdminChat, auth.PERM_ADMINCHAT, "[^2message^7]", true) diff --git a/luascripts/commands/client/pm.lua b/luascripts/commands/client/pm.lua index bdc7571..d6ab4ee 100644 --- a/luascripts/commands/client/pm.lua +++ b/luascripts/commands/client/pm.lua @@ -15,6 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +local auth = require "luascripts.wolfadmin.auth.auth" local commands = require "luascripts.wolfadmin.commands.commands" local stats = require "luascripts.wolfadmin.players.stats" @@ -36,4 +37,4 @@ function commandPersonalMessage(clientId, cmdArguments) end end commands.addclient("pm", commandPersonalMessage, "", "", true) -commands.addclient("m", commandPersonalMessage, "", "", true) \ No newline at end of file +commands.addclient("m", commandPersonalMessage, "", "", true) diff --git a/luascripts/commands/client/r.lua b/luascripts/commands/client/r.lua index 366230d..3c48383 100644 --- a/luascripts/commands/client/r.lua +++ b/luascripts/commands/client/r.lua @@ -15,6 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +local auth = require "luascripts.wolfadmin.auth.auth" local commands = require "luascripts.wolfadmin.commands.commands" local stats = require "luascripts.wolfadmin.players.stats" @@ -52,4 +53,4 @@ function commandR(clientId, cmdArguments) return true end -commands.addclient("r", commandR, "", "[^2message^7]", true) \ No newline at end of file +commands.addclient("r", commandR, "", "[^2message^7]", true) diff --git a/luascripts/commands/client/wolfadmin.lua b/luascripts/commands/client/wolfadmin.lua index 4c35801..161c1ea 100644 --- a/luascripts/commands/client/wolfadmin.lua +++ b/luascripts/commands/client/wolfadmin.lua @@ -15,6 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +local auth = require "luascripts.wolfadmin.auth.auth" local commands = require "luascripts.wolfadmin.commands.commands" function commandWolfAdmin(clientId, cmdArguments) @@ -27,4 +28,4 @@ function commandWolfAdmin(clientId, cmdArguments) return true end -commands.addclient("wolfadmin", commandWolfAdmin, "", "") \ No newline at end of file +commands.addclient("wolfadmin", commandWolfAdmin, "", "") diff --git a/luascripts/commands/commands.lua b/luascripts/commands/commands.lua index 17a596a..5d5dc80 100644 --- a/luascripts/commands/commands.lua +++ b/luascripts/commands/commands.lua @@ -21,6 +21,7 @@ local util = require "luascripts.wolfadmin.util.util" local events = require "luascripts.wolfadmin.util.events" local files = require "luascripts.wolfadmin.util.files" local admin = require "luascripts.wolfadmin.admin.admin" +local auth = require "luascripts.wolfadmin.auth.auth" local stats = require "luascripts.wolfadmin.players.stats" local commands = {} @@ -194,7 +195,7 @@ function commands.onclientcommand(clientId, cmdText) -- mod-specific or custom commands loading if clientcmds[wolfCmd] and clientcmds[wolfCmd]["function"] and clientcmds[wolfCmd]["flag"] then - if clientcmds[wolfCmd]["flag"] == "" or et.G_shrubbot_permission(clientId, clientcmds[wolfCmd]["flag"]) == 1 then + if clientcmds[wolfCmd]["flag"] == "" or auth.isallowed(clientId, clientcmds[wolfCmd]["flag"]) == 1 then for i = 1, et.trap_Argc() - 1 do cmdArguments[i] = et.trap_Argv(i) end @@ -272,7 +273,7 @@ function commands.onclientcommand(clientId, cmdText) clientCmd = string.lower(clientCmd) if clientcmds[clientCmd] and clientcmds[clientCmd]["function"] and clientcmds[clientCmd]["chat"] then - if clientcmds[clientCmd]["flag"] == "" or et.G_shrubbot_permission(clientId, clientcmds[clientCmd]["flag"]) == 1 then + if clientcmds[clientCmd]["flag"] == "" or auth.isallowed(clientId, clientcmds[clientCmd]["flag"]) == 1 then return clientcmds[clientCmd]["function"](clientId, cmdArguments) and 1 or 0 end end @@ -311,8 +312,8 @@ function commands.onclientcommand(clientId, cmdText) shrubCmd = string.lower(shrubCmd) if admincmds[shrubCmd] and admincmds[shrubCmd]["function"] and admincmds[shrubCmd]["flag"] then - if wolfCmd == "say" or (((wolfCmd == "say_team" and et.gentity_get(cmdClient, "sess.sessionTeam") ~= et.TEAM_SPECTATORS) or wolfCmd == "say_buddy") and et.G_shrubbot_permission(clientId, "9") == 1) or (wolfCmd == "!"..shrubCmd and et.G_shrubbot_permission(clientId, "3") == 1) then - if admincmds[shrubCmd]["flag"] ~= "" and et.G_shrubbot_permission(clientId, admincmds[shrubCmd]["flag"]) == 1 then + if wolfCmd == "say" or (((wolfCmd == "say_team" and et.gentity_get(cmdClient, "sess.sessionTeam") ~= et.TEAM_SPECTATORS) or wolfCmd == "say_buddy") and auth.isallowed(clientId, auth.PERM_TEAMCMDS) == 1) or (wolfCmd == "!"..shrubCmd and auth.isallowed(clientId, auth.PERM_SILENTCMDS) == 1) then + if admincmds[shrubCmd]["flag"] ~= "" and auth.isallowed(clientId, admincmds[shrubCmd]["flag"]) == 1 then local isFinished = admincmds[shrubCmd]["function"](clientId, cmdArguments) if not admincmds[shrubCmd]["hidden"] then @@ -333,4 +334,4 @@ function commands.onclientcommand(clientId, cmdText) end events.handle("onClientCommand", commands.onclientcommand) -return commands \ No newline at end of file +return commands diff --git a/luascripts/game/voting.lua b/luascripts/game/voting.lua index 6d22782..f05a15e 100644 --- a/luascripts/game/voting.lua +++ b/luascripts/game/voting.lua @@ -15,6 +15,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +local auth = require "luascripts.wolfadmin.auth.auth" local constants = require "luascripts.wolfadmin.util.constants" local util = require "luascripts.wolfadmin.util.util" local events = require "luascripts.wolfadmin.util.events" @@ -88,7 +89,7 @@ events.handle("onGameStateChange", voting.ongamestatechange) function voting.oncallvote(clientId, type, args) if et.gentity_get(clientId, "sess.sessionTeam") == constants.TEAM_SPECTATORS or args[1] == "?" then return 0 - elseif voting.isrestricted(type) and et.G_shrubbot_permission(clientId, "%") ~= 1 then + elseif voting.isrestricted(type) and auth.isallowed(clientId, PERM_NOVOTELIMIT) ~= 1 then et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"callvote: you are not allowed to call this type of vote.\";") et.trap_SendServerCommand(clientId, "cp \"You are not allowed to call this type of vote.") diff --git a/luascripts/players/greetings.lua b/luascripts/players/greetings.lua index 6ae270d..5dc12b0 100644 --- a/luascripts/players/greetings.lua +++ b/luascripts/players/greetings.lua @@ -15,6 +15,8 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +local auth = require "luascripts.wolfadmin.auth.auth" + local constants = require "luascripts.wolfadmin.util.constants" local util = require "luascripts.wolfadmin.util.util" local events = require "luascripts.wolfadmin.util.events" @@ -31,7 +33,7 @@ local levelGreetings = {} function greetings.get(clientId) local lvl = et.G_shrubbot_level(clientId) - if et.G_shrubbot_permission(clientId, "@") ~= 1 then + if auth.isallowed(clientId, auth.PERM_INCOGNITO) ~= 1 then if userGreetings[stats.get(clientId, "playerGUID")] ~= nil then return userGreetings[stats.get(clientId, "playerGUID")] elseif levelGreetings[lvl] ~= nil then