Do not grant all privs to the admin - changes game behavior (#6460)

* Do not grant all privs to admins.

* Default give_to_admin to give_to_singleplayer
This commit is contained in:
lhofhansl 2017-10-07 06:12:09 -07:00 committed by Loïc Blot
parent 3c93a56e16
commit d386586201
2 changed files with 11 additions and 1 deletions

@ -83,7 +83,9 @@ core.builtin_auth_handler = {
-- For the admin, give everything -- For the admin, give everything
elseif name == core.settings:get("name") then elseif name == core.settings:get("name") then
for priv, def in pairs(core.registered_privileges) do for priv, def in pairs(core.registered_privileges) do
privileges[priv] = true if def.give_to_admin then
privileges[priv] = true
end
end end
end end
-- All done -- All done

@ -11,6 +11,9 @@ function core.register_privilege(name, param)
if def.give_to_singleplayer == nil then if def.give_to_singleplayer == nil then
def.give_to_singleplayer = true def.give_to_singleplayer = true
end end
if def.give_to_admin == nil then
def.give_to_admin = def.give_to_singleplayer
end
if def.description == nil then if def.description == nil then
def.description = "(no description)" def.description = "(no description)"
end end
@ -45,6 +48,7 @@ core.register_privilege("settime", {
core.register_privilege("server", { core.register_privilege("server", {
description = "Can do server maintenance stuff", description = "Can do server maintenance stuff",
give_to_singleplayer = false, give_to_singleplayer = false,
give_to_admin = true,
}) })
core.register_privilege("protection_bypass", { core.register_privilege("protection_bypass", {
description = "Can bypass node protection in the world", description = "Can bypass node protection in the world",
@ -53,10 +57,12 @@ core.register_privilege("protection_bypass", {
core.register_privilege("ban", { core.register_privilege("ban", {
description = "Can ban and unban players", description = "Can ban and unban players",
give_to_singleplayer = false, give_to_singleplayer = false,
give_to_admin = true,
}) })
core.register_privilege("kick", { core.register_privilege("kick", {
description = "Can kick players", description = "Can kick players",
give_to_singleplayer = false, give_to_singleplayer = false,
give_to_admin = true,
}) })
core.register_privilege("give", { core.register_privilege("give", {
description = "Can use /give and /giveme", description = "Can use /give and /giveme",
@ -65,6 +71,7 @@ core.register_privilege("give", {
core.register_privilege("password", { core.register_privilege("password", {
description = "Can use /setpassword and /clearpassword", description = "Can use /setpassword and /clearpassword",
give_to_singleplayer = false, give_to_singleplayer = false,
give_to_admin = true,
}) })
core.register_privilege("fly", { core.register_privilege("fly", {
description = "Can fly using the free_move mode", description = "Can fly using the free_move mode",
@ -85,6 +92,7 @@ core.register_privilege("rollback", {
core.register_privilege("debug", { core.register_privilege("debug", {
description = "Allows enabling various debug options that may affect gameplay", description = "Allows enabling various debug options that may affect gameplay",
give_to_singleplayer = false, give_to_singleplayer = false,
give_to_admin = true,
}) })
core.register_can_bypass_userlimit(function(name, ip) core.register_can_bypass_userlimit(function(name, ip)