Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix on_(grant|revoke) not being run by mods #14137

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions builtin/game/auth.lua
Original file line number Diff line number Diff line change
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