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

This commit is contained in:
Lars Mueller 2023-12-20 21:14:24 +01:00 committed by sfan5
parent 7e143cb33d
commit d58cc7fb7a

@ -87,19 +87,20 @@ core.builtin_auth_handler = {
core.settings:get("default_password"))) core.settings:get("default_password")))
end end
local prev_privs = auth_entry.privileges
auth_entry.privileges = privileges auth_entry.privileges = privileges
core_auth.save(auth_entry) core_auth.save(auth_entry)
-- Run grant callbacks -- Run grant callbacks
for priv, _ in pairs(privileges) do 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") core.run_priv_callbacks(name, priv, nil, "grant")
end end
end end
-- Run revoke callbacks -- Run revoke callbacks
for priv, _ in pairs(auth_entry.privileges) do for priv, _ in pairs(prev_privs) do
if not privileges[priv] then if not privileges[priv] then
core.run_priv_callbacks(name, priv, nil, "revoke") core.run_priv_callbacks(name, priv, nil, "revoke")
end end