mirror of
https://github.com/moparisthebest/minetest
synced 2024-11-16 06:15:06 -05:00
Don't grant priveleges to non-existent players.
When accidentally misspelling a name, privileges are sometimes granted to non-existent players, leaving them with the extra privileges, but without the default privileges, if they ever join the server. This corrects that by disallowing /grant from working with invalid players. For completeness, it does the same for /revoke.
This commit is contained in:
parent
923a97b108
commit
23590a8383
@ -116,6 +116,9 @@ minetest.register_chatcommand("grant", {
|
|||||||
if not grantname or not grantprivstr then
|
if not grantname or not grantprivstr then
|
||||||
minetest.chat_send_player(name, "Invalid parameters (see /help grant)")
|
minetest.chat_send_player(name, "Invalid parameters (see /help grant)")
|
||||||
return
|
return
|
||||||
|
elseif not minetest.auth_table[grantname] then
|
||||||
|
minetest.chat_send_player(name, "Player "..grantname.." does not exist.")
|
||||||
|
return
|
||||||
end
|
end
|
||||||
local grantprivs = minetest.string_to_privs(grantprivstr)
|
local grantprivs = minetest.string_to_privs(grantprivstr)
|
||||||
if grantprivstr == "all" then
|
if grantprivstr == "all" then
|
||||||
@ -159,6 +162,9 @@ minetest.register_chatcommand("revoke", {
|
|||||||
if not revokename or not revokeprivstr then
|
if not revokename or not revokeprivstr then
|
||||||
minetest.chat_send_player(name, "Invalid parameters (see /help revoke)")
|
minetest.chat_send_player(name, "Invalid parameters (see /help revoke)")
|
||||||
return
|
return
|
||||||
|
elseif not minetest.auth_table[revokename] then
|
||||||
|
minetest.chat_send_player(name, "Player "..revokename.." does not exist.")
|
||||||
|
return
|
||||||
end
|
end
|
||||||
local revokeprivs = minetest.string_to_privs(revokeprivstr)
|
local revokeprivs = minetest.string_to_privs(revokeprivstr)
|
||||||
local privs = minetest.get_player_privs(revokename)
|
local privs = minetest.get_player_privs(revokename)
|
||||||
|
Loading…
Reference in New Issue
Block a user