From f570aa64106dd75cab3221a062e3bf0b9eecfd06 Mon Sep 17 00:00:00 2001 From: oranges Date: Tue, 20 Oct 2015 14:20:59 +1300 Subject: [PATCH] Move autoadmin to a protected config datum This prevents any admin with permission to debug controller being able to edit this setting --- code/_globalvars/configuration.dm | 1 + code/controllers/configuration.dm | 12 ++++++++---- code/modules/client/client procs.dm | 4 ++-- code/world.dm | 1 + 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/code/_globalvars/configuration.dm b/code/_globalvars/configuration.dm index 2a4cfb7fb1b..af013fa2aa6 100644 --- a/code/_globalvars/configuration.dm +++ b/code/_globalvars/configuration.dm @@ -1,4 +1,5 @@ var/datum/configuration/config = null +var/datum/protected_configuration/protected_config = null var/host = null var/join_motd = null diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index fd83ab43f5d..10d8560ea1f 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -5,6 +5,11 @@ #define SECURITY_HAS_MAINT_ACCESS 2 #define EVERYONE_HAS_MAINT_ACCESS 4 +//Not accessible from usual debug controller verb +/datum/protected_configuration + var/autoadmin = 0 + var/autoadmin_rank = "Game Admin" + /datum/configuration var/server_name = null // server name (the name of the game window) var/station_name = null // station name (the name of the station in-game) @@ -176,8 +181,7 @@ var/maprotation = 1 var/maprotatechancedelta = 0.75 - var/autoadmin = 0 - var/autoadmin_rank = "Game Admin" + /datum/configuration/New() var/list/L = typesof(/datum/game_mode) - /datum/game_mode @@ -374,9 +378,9 @@ if("maprotationchancedelta") config.maprotatechancedelta = text2num(value) if("autoadmin") - config.autoadmin = 1 + protected_config.autoadmin = 1 if(value) - config.autoadmin_rank = ckeyEx(value) + protected_config.autoadmin_rank = ckeyEx(value) else diary << "Unknown setting in configuration: '[name]'" diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index 61f1c05baa8..eaa3fb99501 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -107,11 +107,11 @@ var/next_external_rsc = 0 directory[ckey] = src //Admin Authorisation - if(config.autoadmin) + if(protected_config.autoadmin) if(!admin_datums[ckey]) var/datum/admin_rank/autorank for(var/datum/admin_rank/R in admin_ranks) - if(R.name == config.autoadmin_rank) + if(R.name == protected_config.autoadmin_rank) autorank = R break if(!autorank) diff --git a/code/world.dm b/code/world.dm index 690dafaee93..62242e11c86 100644 --- a/code/world.dm +++ b/code/world.dm @@ -190,6 +190,7 @@ var/global/list/map_transition_config = MAP_TRANSITION_CONFIG join_motd = file2text("config/motd.txt") /world/proc/load_configuration() + protected_config = new /datum/protected_configuration() config = new /datum/configuration() config.load("config/config.txt") config.load("config/game_options.txt","game_options")