From d58cc7fb7a2c63ad41d9896d94cec7560a2a0487 Mon Sep 17 00:00:00 2001 From: Lars Mueller Date: Wed, 20 Dec 2023 21:14:24 +0100 Subject: [PATCH] Fix on_(grant|revoke) not being run by mods --- builtin/game/auth.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/builtin/game/auth.lua b/builtin/game/auth.lua index e7d502bb3..fa1860d5d 100644 --- a/builtin/game/auth.lua +++ b/builtin/game/auth.lua @@ -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