Misc auth improvements (refs #69, #75)

* renamed methods to camelCase
* renamed methods to be more precise
* auth.isPlayerAllowed now returns boolean values
This commit is contained in:
Timo Smit 2017-01-21 12:16:26 +01:00
parent 004ebea736
commit 9012d54da4
22 changed files with 46 additions and 50 deletions

View File

@ -48,14 +48,10 @@ function acl.clearCache()
data = {} data = {}
end end
function acl.isallowed(clientId, permission) function acl.isPlayerAllowed(clientId, permission)
local level = acl.getlevel(clientId) local level = acl.getlevel(clientId)
if data[level] ~= nil and tables.contains(data[level], permission) then return data[level] ~= nil and tables.contains(data[level], permission)
return 1
end
return 0
end end
function acl.getLevels() function acl.getLevels()
@ -118,13 +114,13 @@ function acl.removeLevelRoles(levelId)
data[levelId] = {} data[levelId] = {}
end end
function acl.getlevel(clientId) function acl.getPlayerLevel(clientId)
local player = db.getplayer(players.getGUID(clientId)) local player = db.getplayer(players.getGUID(clientId))
return player["level_id"] return player["level_id"]
end end
function acl.getlevelname(levelId) function acl.getLevelName(levelId)
local level = db.getLevel(levelId) local level = db.getLevel(levelId)
return level["name"] return level["name"]

View File

@ -112,7 +112,7 @@ auth.PERM_IMMUNE = "immune"
-- as this module serves as a wrapper/super class, we load the selected database -- 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 -- system in this function. might have to think of a better way to implement
-- this, but it will suffice. -- this, but it will suffice.
function auth.oninit() function auth.onGameInit()
if settings.get("g_standalone") == 1 then if settings.get("g_standalone") == 1 then
srv = require (wolfa_getLuaPath()..".auth.acl") srv = require (wolfa_getLuaPath()..".auth.acl")
else else
@ -125,6 +125,6 @@ function auth.oninit()
setmetatable(auth, {__index = srv}) setmetatable(auth, {__index = srv})
end end
events.handle("onGameInit", auth.oninit) events.handle("onGameInit", auth.onGameInit)
return auth return auth

View File

@ -111,11 +111,11 @@ local flags = {
[auth.PERM_IMMUNE] = "!", [auth.PERM_IMMUNE] = "!",
} }
function shrubbot.isallowed(clientId, permission) function shrubbot.isPlayerAllowed(clientId, permission)
return et.G_shrubbot_permission(clientId, flags[permission]) return et.G_shrubbot_permission(clientId, flags[permission]) == 1
end end
function shrubbot.getlevel(clientId) function shrubbot.getPlayerLevel(clientId)
return et.G_shrubbot_level(clientId) return et.G_shrubbot_level(clientId)
end end

View File

@ -24,8 +24,8 @@ local players = require (wolfa_getLuaPath()..".players.players")
local settings = require (wolfa_getLuaPath()..".util.settings") local settings = require (wolfa_getLuaPath()..".util.settings")
function commandAdminTest(clientId, cmdArguments) function commandAdminTest(clientId, cmdArguments)
local level = auth.getlevel(clientId) local level = auth.getPlayerLevel(clientId)
local levelName = auth.getlevelname(level) local levelName = auth.getLevelName(level)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dadmintest: ^7"..players.getName(clientId).." ^9is a level "..level.." user (^7"..levelName.."^9).\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dadmintest: ^7"..players.getName(clientId).." ^9is a level "..level.." user (^7"..levelName.."^9).\";")

View File

@ -55,17 +55,17 @@ function commandBan(clientId, cmdArguments)
duration = util.getTimeFromString(cmdArguments[2]) duration = util.getTimeFromString(cmdArguments[2])
elseif cmdArguments[2] then elseif cmdArguments[2] then
reason = table.concat(cmdArguments, " ", 2) reason = table.concat(cmdArguments, " ", 2)
elseif auth.isallowed(clientId, "8") ~= 1 then elseif not auth.isPlayerAllowed(clientId, "8") then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dban usage: "..commands.getadmin("ban")["syntax"].."\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dban usage: "..commands.getadmin("ban")["syntax"].."\";")
return true return true
end end
if auth.isallowed(cmdClient, "!") == 1 then if auth.isPlayerAllowed(cmdClient, "!") then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dban: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is immune to this command.\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dban: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is immune to this command.\";")
return true return true
elseif auth.getlevel(cmdClient) > auth.getlevel(clientId) then elseif auth.getPlayerLevel(cmdClient) > auth.getPlayerLevel(clientId) then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dban: ^9sorry, but your intended victim has a higher admin level than you do.\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dban: ^9sorry, but your intended victim has a higher admin level than you do.\";")
return true return true

View File

@ -44,11 +44,11 @@ function commandGib(clientId, cmdArguments)
return true return true
end end
if auth.isallowed(cmdClient, "!") == 1 then if auth.isPlayerAllowed(cmdClient, "!") then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dgib: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is immune to this command.\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dgib: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is immune to this command.\";")
return true return true
elseif auth.getlevel(cmdClient) > auth.getlevel(clientId) then elseif auth.getPlayerLevel(cmdClient) > auth.getPlayerLevel(clientId) then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dgib: ^9sorry, but your intended victim has a higher admin level than you do.\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dgib: ^9sorry, but your intended victim has a higher admin level than you do.\";")
return true return true

View File

@ -26,7 +26,7 @@ function commandHelp(clientId, cmdArguments)
local availableCommands = {} local availableCommands = {}
for command, data in pairs(cmds) do for command, data in pairs(cmds) do
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 if data["function"] and data["flag"] and auth.isPlayerAllowed(clientId, data["flag"]) and (not data["hidden"] or (type(data["hidden"]) == "function" and not data["hidden"]())) then
table.insert(availableCommands, command) table.insert(availableCommands, command)
end end
end end

View File

@ -40,7 +40,7 @@ function commandIncognito(clientId, cmdArguments)
-- et.G_Print(string.format("%s %s %d %s\n", adminName, adminGUID, adminLevel, adminFlags)) -- et.G_Print(string.format("%s %s %d %s\n", adminName, adminGUID, adminLevel, adminFlags))
if players.getGUID(clientId) == adminGUID then if players.getGUID(clientId) == adminGUID then
if auth.isallowed(clientId, "@") ~= 1 then if not auth.isPlayerAllowed(clientId, "@") then
adminFlags = adminFlags.."+@" adminFlags = adminFlags.."+@"
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat "..clientId.." \"^dincognito: ^9you are now playing incognito.\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat "..clientId.." \"^dincognito: ^9you are now playing incognito.\";")

View File

@ -45,11 +45,11 @@ function commandKick(clientId, cmdArguments)
return true return true
end end
if auth.isallowed(cmdClient, "!") == 1 then if auth.isPlayerAllowed(cmdClient, "!") then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dkick: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is immune to this command.\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dkick: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is immune to this command.\";")
return true return true
elseif auth.getlevel(cmdClient) > auth.getlevel(clientId) then elseif auth.getPlayerLevel(cmdClient) > auth.getPlayerLevel(clientId) then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dkick: ^9sorry, but your intended victim has a higher admin level than you do.\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dkick: ^9sorry, but your intended victim has a higher admin level than you do.\";")
return true return true

View File

@ -52,11 +52,11 @@ function commandListAliases(clientId, cmdArguments)
return true return true
end end
if auth.isallowed(cmdClient, "!") == 1 then if auth.isPlayerAllowed(cmdClient, "!") then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dlistaliases: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is immune to this command.\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dlistaliases: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is immune to this command.\";")
return true return true
elseif auth.getlevel(cmdClient) > auth.getlevel(clientId) then elseif auth.getPlayerLevel(cmdClient) > auth.getPlayerLevel(clientId) then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dlistaliases: ^9sorry, but your intended victim has a higher admin level than you do.\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dlistaliases: ^9sorry, but your intended victim has a higher admin level than you do.\";")
return true return true

View File

@ -47,8 +47,8 @@ function commandListPlayers(clientId, cmdArguments)
guidStub = players.getGUID(player):sub(-8) guidStub = players.getGUID(player):sub(-8)
end end
local level = auth.getlevel(player) local level = auth.getPlayerLevel(player)
local levelName = auth.getlevelname(level) local levelName = auth.getLevelName(level)
local teamColor, teamCode local teamColor, teamCode

View File

@ -58,7 +58,7 @@ function commandMute(clientId, cmdArguments)
duration = util.getTimeFromString(cmdArguments[2]) duration = util.getTimeFromString(cmdArguments[2])
elseif cmdArguments[2] then elseif cmdArguments[2] then
reason = table.concat(cmdArguments, " ", 2) reason = table.concat(cmdArguments, " ", 2)
elseif auth.isallowed(clientId, "8") ~= 1 then elseif not auth.isPlayerAllowed(clientId, "8") then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dmute usage: "..commands.getadmin("mute")["syntax"].."\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dmute usage: "..commands.getadmin("mute")["syntax"].."\";")
return true return true
@ -68,11 +68,11 @@ function commandMute(clientId, cmdArguments)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dmute: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is already muted.\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dmute: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is already muted.\";")
return true return true
elseif auth.isallowed(cmdClient, "!") == 1 then elseif auth.isPlayerAllowed(cmdClient, "!") then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dmute: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is immune to this command.\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dmute: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is immune to this command.\";")
return true return true
elseif auth.getlevel(cmdClient) > auth.getlevel(clientId) then elseif auth.getPlayerLevel(cmdClient) > auth.getPlayerLevel(clientId) then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dmute: ^9sorry, but your intended victim has a higher admin level than you do.\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dmute: ^9sorry, but your intended victim has a higher admin level than you do.\";")
return true return true

View File

@ -48,11 +48,11 @@ 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.\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dplock: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is already locked to a team.\";")
return true return true
elseif auth.isallowed(cmdClient, "!") == 1 then elseif auth.isPlayerAllowed(cmdClient, "!") then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dplock: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is immune to this command.\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dplock: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is immune to this command.\";")
return true return true
elseif auth.getlevel(cmdClient) > auth.getlevel(clientId) then elseif auth.getPlayerLevel(cmdClient) > auth.getPlayerLevel(clientId) then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dplock: ^9sorry, but your intended victim has a higher admin level than you do.\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dplock: ^9sorry, but your intended victim has a higher admin level than you do.\";")
return true return true

View File

@ -42,11 +42,11 @@ function commandPlayerLock(clientId, cmdArguments)
return true return true
end end
if auth.isallowed(cmdClient, "!") == 1 then if auth.isPlayerAllowed(cmdClient, "!") then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dput: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is immune to this command.\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dput: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is immune to this command.\";")
return true return true
elseif auth.getlevel(cmdClient) > auth.getlevel(cmdClient) then elseif auth.getPlayerLevel(cmdClient) > auth.getPlayerLevel(cmdClient) then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dput: ^9sorry, but your intended victim has a higher admin level than you do.\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dput: ^9sorry, but your intended victim has a higher admin level than you do.\";")
return true return true

View File

@ -65,7 +65,7 @@ function commandSetLevel(clientId, cmdArguments)
return true return true
end end
if auth.getlevel(cmdClient) > auth.getlevel(clientId) then if auth.getPlayerLevel(cmdClient) > auth.getPlayerLevel(clientId) then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dsetlevel: ^9sorry, but your intended victim has a higher admin level than you do.\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dsetlevel: ^9sorry, but your intended victim has a higher admin level than you do.\";")
return true return true

View File

@ -44,11 +44,11 @@ function commandSlap(clientId, cmdArguments)
return true return true
end end
if auth.isallowed(cmdClient, "!") == 1 then if auth.isPlayerAllowed(cmdClient, "!") then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dslap: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is immune to this command.\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dslap: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is immune to this command.\";")
return true return true
elseif auth.getlevel(cmdClient) > auth.getlevel(clientId) then elseif auth.getPlayerLevel(cmdClient) > auth.getPlayerLevel(clientId) then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dslap: ^9sorry, but your intended victim has a higher admin level than you do.\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dslap: ^9sorry, but your intended victim has a higher admin level than you do.\";")
return true return true

View File

@ -56,7 +56,7 @@ function commandVoiceMute(clientId, cmdArguments)
duration = util.getTimeFromString(cmdArguments[2]) duration = util.getTimeFromString(cmdArguments[2])
elseif cmdArguments[2] then elseif cmdArguments[2] then
reason = table.concat(cmdArguments, " ", 2) reason = table.concat(cmdArguments, " ", 2)
elseif auth.isallowed(clientId, "8") ~= 1 then elseif not auth.isPlayerAllowed(clientId, "8") then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dvmute usage: "..commands.getadmin("vmute")["syntax"].."\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dvmute usage: "..commands.getadmin("vmute")["syntax"].."\";")
return true return true
@ -66,11 +66,11 @@ function commandVoiceMute(clientId, cmdArguments)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dvmute: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is already muted.\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dvmute: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is already muted.\";")
return true return true
elseif auth.isallowed(cmdClient, "!") == 1 then elseif auth.isPlayerAllowed(cmdClient, "!") then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dvmute: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is immune to this command.\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dvmute: ^7"..et.gentity_get(cmdClient, "pers.netname").." ^9is immune to this command.\";")
return true return true
elseif auth.getlevel(cmdClient) > auth.getlevel(clientId) then elseif auth.getPlayerLevel(cmdClient) > auth.getPlayerLevel(clientId) then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dvmute: ^9sorry, but your intended victim has a higher admin level than you do.\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dvmute: ^9sorry, but your intended victim has a higher admin level than you do.\";")
return true return true

View File

@ -72,7 +72,7 @@ function commandWarn(clientId, cmdArguments)
return true return true
end end
if auth.getlevel(cmdClient) > auth.getlevel(clientId) then if auth.getPlayerLevel(cmdClient) > auth.getPlayerLevel(clientId) then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dwarn: ^9sorry, but your intended victim has a higher admin level than you do.\";") et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dwarn: ^9sorry, but your intended victim has a higher admin level than you do.\";")
return true return true

View File

@ -33,7 +33,7 @@ function commandAdminChat(clientId, cmdArguments)
end end
for playerId = 0, et.trap_Cvar_Get("sv_maxclients") - 1 do for playerId = 0, et.trap_Cvar_Get("sv_maxclients") - 1 do
if players.isConnected(playerId) and auth.isallowed(playerId, "~") == 1 then if players.isConnected(playerId) and auth.isPlayerAllowed(playerId, "~") then
table.insert(recipients, playerId) table.insert(recipients, playerId)
end end
end end

View File

@ -207,7 +207,7 @@ function commands.onClientCommand(clientId, cmdText)
-- mod-specific or custom commands loading -- mod-specific or custom commands loading
-- syntax: command arg1 arg2 ... argN -- syntax: command arg1 arg2 ... argN
if clientcmds[wolfCmd] and clientcmds[wolfCmd]["function"] and clientcmds[wolfCmd]["flag"] then if clientcmds[wolfCmd] and clientcmds[wolfCmd]["function"] and clientcmds[wolfCmd]["flag"] then
if clientcmds[wolfCmd]["flag"] == "" or auth.isallowed(clientId, clientcmds[wolfCmd]["flag"]) == 1 then if clientcmds[wolfCmd]["flag"] == "" or auth.isPlayerAllowed(clientId, clientcmds[wolfCmd]["flag"]) then
for i = 1, et.trap_Argc() - 1 do for i = 1, et.trap_Argc() - 1 do
cmdArguments[i] = et.trap_Argv(i) cmdArguments[i] = et.trap_Argv(i)
end end
@ -247,7 +247,7 @@ function commands.onClientCommand(clientId, cmdText)
clientCmd = string.lower(clientCmd) clientCmd = string.lower(clientCmd)
if clientcmds[clientCmd] and clientcmds[clientCmd]["function"] and clientcmds[clientCmd]["chat"] then if clientcmds[clientCmd] and clientcmds[clientCmd]["function"] and clientcmds[clientCmd]["chat"] then
if clientcmds[clientCmd]["flag"] == "" or auth.isallowed(clientId, clientcmds[clientCmd]["flag"]) == 1 then if clientcmds[clientCmd]["flag"] == "" or auth.isPlayerAllowed(clientId, clientcmds[clientCmd]["flag"]) then
return clientcmds[clientCmd]["function"](clientId, cmdArguments) and 1 or 0 return clientcmds[clientCmd]["function"](clientId, cmdArguments) and 1 or 0
end end
end end
@ -288,8 +288,8 @@ function commands.onClientCommand(clientId, cmdText)
shrubCmd = string.lower(shrubCmd) shrubCmd = string.lower(shrubCmd)
if admincmds[shrubCmd] and admincmds[shrubCmd]["function"] and admincmds[shrubCmd]["flag"] then 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 auth.isallowed(clientId, auth.PERM_TEAMCMDS) == 1) or (wolfCmd == "!"..shrubCmd and auth.isallowed(clientId, auth.PERM_SILENTCMDS) == 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.isPlayerAllowed(clientId, auth.PERM_TEAMCMDS)) or (wolfCmd == "!"..shrubCmd and auth.isPlayerAllowed(clientId, auth.PERM_SILENTCMDS)) then
if admincmds[shrubCmd]["flag"] ~= "" and auth.isallowed(clientId, admincmds[shrubCmd]["flag"]) == 1 then if admincmds[shrubCmd]["flag"] ~= "" and auth.isPlayerAllowed(clientId, admincmds[shrubCmd]["flag"]) then
local isFinished = admincmds[shrubCmd]["function"](clientId, cmdArguments) local isFinished = admincmds[shrubCmd]["function"](clientId, cmdArguments)
if not admincmds[shrubCmd]["hidden"] then if not admincmds[shrubCmd]["hidden"] then

View File

@ -89,7 +89,7 @@ events.handle("onGameStateChange", voting.ongamestatechange)
function voting.oncallvote(clientId, type, args) function voting.oncallvote(clientId, type, args)
if et.gentity_get(clientId, "sess.sessionTeam") == constants.TEAM_SPECTATORS or args[1] == "?" then if et.gentity_get(clientId, "sess.sessionTeam") == constants.TEAM_SPECTATORS or args[1] == "?" then
return 0 return 0
elseif voting.isrestricted(type) and auth.isallowed(clientId, PERM_NOVOTELIMIT) ~= 1 then elseif voting.isrestricted(type) and not auth.isPlayerAllowed(clientId, PERM_NOVOTELIMIT) then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"callvote: you are not allowed to call this type of vote.\";") 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.") et.trap_SendServerCommand(clientId, "cp \"You are not allowed to call this type of vote.")

View File

@ -31,9 +31,9 @@ local userGreetings = {}
local levelGreetings = {} local levelGreetings = {}
function greetings.get(clientId) function greetings.get(clientId)
local lvl = auth.getlevel(clientId) local lvl = auth.getPlayerLevel(clientId)
if auth.isallowed(clientId, auth.PERM_INCOGNITO) ~= 1 then if not auth.isPlayerAllowed(clientId, auth.PERM_INCOGNITO) then
if userGreetings[players.getGUID(clientId)] ~= nil then if userGreetings[players.getGUID(clientId)] ~= nil then
return userGreetings[players.getGUID(clientId)] return userGreetings[players.getGUID(clientId)]
elseif levelGreetings[lvl] ~= nil then elseif levelGreetings[lvl] ~= nil then