From e1954661a6abb24b1e6f28e1f01bf4a3a63c05a5 Mon Sep 17 00:00:00 2001 From: Erki Date: Mon, 7 Sep 2020 11:28:13 +0300 Subject: [PATCH] Fix bugs from admin rank updates (#9888) --- code/modules/admin/admin_ranks.dm | 12 +++++++----- code/modules/admin/verbs/diagnostics.dm | 5 ++++- html/changelogs/skull132_admin-fixes.yml | 6 ++++++ 3 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 html/changelogs/skull132_admin-fixes.yml diff --git a/code/modules/admin/admin_ranks.dm b/code/modules/admin/admin_ranks.dm index e452eda4daa..993a706a40a 100644 --- a/code/modules/admin/admin_ranks.dm +++ b/code/modules/admin/admin_ranks.dm @@ -85,7 +85,7 @@ var/list/forum_groupids_to_ranks = list() //Split the line at every "-" var/list/List = text2list(line, "-") - if(!List.len) + if(List.len != 2) continue //ckey is before the first "-" @@ -94,20 +94,22 @@ var/list/forum_groupids_to_ranks = list() continue //rank follows the first "-" - var/rank = "" - if(List.len >= 2) - rank = ckeyEx(List[2]) + var/rank = trim(List[2]) //load permissions associated with this rank var/datum/admin_rank/rank_object = admin_ranks[rank] + if (!rank_object) + error("Unrecognized rank in admins.txt: \"[rank]\"") + continue + //create the admin datum and store it for later use var/datum/admins/D = new /datum/admins(rank, rank_object?.rights || 0, ckey) //find the client for a ckey if they are connected and associate them with the new admin datum D.associate(directory[ckey]) - log_debug("AdminRanks: Upaded Admins from Legacy System") + log_debug("AdminRanks: Updated Admins from Legacy System") else //The current admin system uses SQL diff --git a/code/modules/admin/verbs/diagnostics.dm b/code/modules/admin/verbs/diagnostics.dm index a3a3db82816..57440b449dc 100644 --- a/code/modules/admin/verbs/diagnostics.dm +++ b/code/modules/admin/verbs/diagnostics.dm @@ -105,7 +105,10 @@ if(!check_rights(R_SERVER|R_DEV)) return - message_admins("[usr] manually reloaded admins") + if (config.use_forumuser_api) + update_admins_from_api(FALSE) + + log_and_message_admins("manually reloaded admins.") load_admins() feedback_add_details("admin_verb","RLDA") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! diff --git a/html/changelogs/skull132_admin-fixes.yml b/html/changelogs/skull132_admin-fixes.yml new file mode 100644 index 00000000000..e9207b02350 --- /dev/null +++ b/html/changelogs/skull132_admin-fixes.yml @@ -0,0 +1,6 @@ +author: Skull132 +delete-after: True + +changes: + - bugfix: "Reload Admins will now update the admins from the forumsuser API when enabled." + - bugfix: "admins.txt will now accommodate more complex rank names, specifically ones with spaces and other special characters." \ No newline at end of file