summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2017-12-06 17:32:49 +0100
committerSmallJoker <SmallJoker@users.noreply.github.com>2017-12-06 17:32:49 +0100
commit4edf08709010f721b099dfae3cab011acbdfb3ff (patch)
tree530b903ee81b672fe5a4dd9cfa7a00059b5c541a /builtin
parent2b5341c51864660bb1a434a520f7cca9ce3619e6 (diff)
downloadminetest-4edf08709010f721b099dfae3cab011acbdfb3ff.tar.gz
minetest-4edf08709010f721b099dfae3cab011acbdfb3ff.tar.bz2
minetest-4edf08709010f721b099dfae3cab011acbdfb3ff.zip
Auth handler: Player deletion & Iterator (#6741)
* Add player deletion method to auth handler (fixes #6653) * Support iterating over the auth database There was no way to do this previously and a recent commit broke doing this the "hacky" way by accessing `core.auth_table`.
Diffstat (limited to 'builtin')
-rw-r--r--builtin/game/auth.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/builtin/game/auth.lua b/builtin/game/auth.lua
index 80b15e818..3d4d6b199 100644
--- a/builtin/game/auth.lua
+++ b/builtin/game/auth.lua
@@ -106,6 +106,16 @@ core.builtin_auth_handler = {
}
save_auth_file()
end,
+ delete_auth = function(name)
+ assert(type(name) == "string")
+ if not auth_table[name] then
+ return false
+ end
+ core.log('info', "Built-in authentication handler deleting player '"..name.."'")
+ auth_table[name] = nil
+ save_auth_file()
+ return true
+ end,
set_password = function(name, password)
assert(type(name) == "string")
assert(type(password) == "string")
@@ -154,6 +164,13 @@ core.builtin_auth_handler = {
assert(auth_table[name]).last_login = os.time()
save_auth_file()
end,
+ iterate = function()
+ local names = {}
+ for k in pairs(auth_table) do
+ names[k] = true
+ end
+ return pairs(names)
+ end,
}
core.register_on_prejoinplayer(function(name, ip)
@@ -204,6 +221,7 @@ end
core.set_player_password = auth_pass("set_password")
core.set_player_privs = auth_pass("set_privileges")
+core.remove_player_auth = auth_pass("delete_auth")
core.auth_reload = auth_pass("reload")
local record_login = auth_pass("record_login")