Fix /grant & /revoke not working with custom auth handler (#4974)

core.auth_table is not supposed to be accessed directly.
This commit is contained in:
Dorian Wouters 2016-12-31 18:12:26 +01:00 committed by est31
parent dd3cda6bed
commit a1346c916e

@ -162,7 +162,7 @@ local function handle_grant_command(caller, grantname, grantprivstr)
return false, "Your privileges are insufficient." return false, "Your privileges are insufficient."
end end
if not core.auth_table[grantname] then if not core.get_auth_handler().get_auth(grantname) then
return false, "Player " .. grantname .. " does not exist." return false, "Player " .. grantname .. " does not exist."
end end
local grantprivs = core.string_to_privs(grantprivstr) local grantprivs = core.string_to_privs(grantprivstr)
@ -232,7 +232,7 @@ core.register_chatcommand("revoke", {
local revoke_name, revoke_priv_str = string.match(param, "([^ ]+) (.+)") local revoke_name, revoke_priv_str = string.match(param, "([^ ]+) (.+)")
if not revoke_name or not revoke_priv_str then if not revoke_name or not revoke_priv_str then
return false, "Invalid parameters (see /help revoke)" return false, "Invalid parameters (see /help revoke)"
elseif not core.auth_table[revoke_name] then elseif not core.get_auth_handler().get_auth(revoke_name) then
return false, "Player " .. revoke_name .. " does not exist." return false, "Player " .. revoke_name .. " does not exist."
end end
local revoke_privs = core.string_to_privs(revoke_priv_str) local revoke_privs = core.string_to_privs(revoke_priv_str)