Skip to content

Commit

Permalink
Fix on_(grant|revoke) not being run by mods
Browse files Browse the repository at this point in the history
  • Loading branch information
appgurueu authored and sfan5 committed Dec 21, 2023
1 parent 7e143cb commit d58cc7f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions builtin/game/auth.lua
Expand Up @@ -87,19 +87,20 @@ core.builtin_auth_handler = {
core.settings:get("default_password")))
end

local prev_privs = auth_entry.privileges
auth_entry.privileges = privileges

core_auth.save(auth_entry)

-- Run grant callbacks
for priv, _ in pairs(privileges) do
if not auth_entry.privileges[priv] then
if not prev_privs[priv] then
core.run_priv_callbacks(name, priv, nil, "grant")
end
end

-- Run revoke callbacks
for priv, _ in pairs(auth_entry.privileges) do
for priv, _ in pairs(prev_privs) do
if not privileges[priv] then
core.run_priv_callbacks(name, priv, nil, "revoke")
end
Expand Down

0 comments on commit d58cc7f

Please sign in to comment.