diff --git a/code/__DEFINES/admin.dm b/code/__DEFINES/admin.dm index ceb30e7591f..fbc223f62a5 100644 --- a/code/__DEFINES/admin.dm +++ b/code/__DEFINES/admin.dm @@ -174,3 +174,4 @@ GLOBAL_VAR_INIT(ghost_role_flags, ALL) /// Used in logging uses of admin verbs (and sometimes some non-admin or debug verbs) to the blackbox /// Only pass it a string key, the verb being used. #define BLACKBOX_LOG_ADMIN_VERB(the_verb) SSblackbox.record_feedback("tally", "admin_verb", 1, the_verb) + diff --git a/code/__HELPERS/admin.dm b/code/__HELPERS/admin.dm index 94f61ef0152..8564937f9c6 100644 --- a/code/__HELPERS/admin.dm +++ b/code/__HELPERS/admin.dm @@ -1,3 +1,10 @@ /// Returns if the given client is an admin, REGARDLESS of if they're deadminned or not. /proc/is_admin(client/client) return !isnull(GLOB.admin_datums[client.ckey]) || !isnull(GLOB.deadmins[client.ckey]) + +/// Sends a message in the event that someone attempts to elevate their permissions through invoking a certain proc. +/proc/alert_to_permissions_elevation_attempt(mob/user) + var/message = " has tried to elevate permissions!" + message_admins(key_name_admin(user) + message) + log_admin(key_name(user) + message) + diff --git a/code/modules/admin/admin_ranks.dm b/code/modules/admin/admin_ranks.dm index baa8a291974..c39464e3ef0 100644 --- a/code/modules/admin/admin_ranks.dm +++ b/code/modules/admin/admin_ranks.dm @@ -13,9 +13,7 @@ GLOBAL_PROTECT(protected_ranks) /datum/admin_rank/New(init_name, init_rights, init_exclude_rights, init_edit_rights) if(IsAdminAdvancedProcCall()) - var/msg = " has tried to elevate permissions!" - message_admins("[key_name_admin(usr)][msg]") - log_admin("[key_name(usr)][msg]") + alert_to_permissions_elevation_attempt(usr) if (name == "NoRank") //only del if this is a true creation (and not just a New() proc call), other wise trialmins/coders could abuse this to deadmin other admins QDEL_IN(src, 0) CRASH("Admin proc call creation of admin datum") @@ -35,9 +33,7 @@ GLOBAL_PROTECT(protected_ranks) /datum/admin_rank/Destroy() if(IsAdminAdvancedProcCall()) - var/msg = " has tried to elevate permissions!" - message_admins("[key_name_admin(usr)][msg]") - log_admin("[key_name(usr)][msg]") + alert_to_permissions_elevation_attempt(usr) return QDEL_HINT_LETMELIVE . = ..() @@ -47,9 +43,7 @@ GLOBAL_PROTECT(protected_ranks) // Adds/removes rights to this admin_rank /datum/admin_rank/proc/process_keyword(group, group_count, datum/admin_rank/previous_rank) if(IsAdminAdvancedProcCall()) - var/msg = " has tried to elevate permissions!" - message_admins("[key_name_admin(usr)][msg]") - log_admin("[key_name(usr)][msg]") + alert_to_permissions_elevation_attempt(usr) return var/list/keywords = splittext(group, " ") var/flag = 0 diff --git a/code/modules/admin/holder2.dm b/code/modules/admin/holder2.dm index 8cb57ff8f83..4df4e19b709 100644 --- a/code/modules/admin/holder2.dm +++ b/code/modules/admin/holder2.dm @@ -50,9 +50,7 @@ GLOBAL_PROTECT(href_token) /datum/admins/New(list/datum/admin_rank/ranks, ckey, force_active = FALSE, protected) if(IsAdminAdvancedProcCall()) - var/msg = " has tried to elevate permissions!" - message_admins("[key_name_admin(usr)][msg]") - log_admin("[key_name(usr)][msg]") + alert_to_permissions_elevation_attempt(usr) if (!target) //only del if this is a true creation (and not just a New() proc call), other wise trialmins/coders could abuse this to deadmin other admins QDEL_IN(src, 0) CRASH("Admin proc call creation of admin datum") @@ -79,17 +77,13 @@ GLOBAL_PROTECT(href_token) /datum/admins/Destroy() if(IsAdminAdvancedProcCall()) - var/msg = " has tried to elevate permissions!" - message_admins("[key_name_admin(usr)][msg]") - log_admin("[key_name(usr)][msg]") + alert_to_permissions_elevation_attempt(usr) return QDEL_HINT_LETMELIVE . = ..() /datum/admins/proc/activate() if(IsAdminAdvancedProcCall()) - var/msg = " has tried to elevate permissions!" - message_admins("[key_name_admin(usr)][msg]") - log_admin("[key_name(usr)][msg]") + alert_to_permissions_elevation_attempt(usr) return GLOB.deadmins -= target GLOB.admin_datums[target] = src @@ -101,9 +95,7 @@ GLOBAL_PROTECT(href_token) /datum/admins/proc/deactivate() if(IsAdminAdvancedProcCall()) - var/msg = " has tried to elevate permissions!" - message_admins("[key_name_admin(usr)][msg]") - log_admin("[key_name(usr)][msg]") + alert_to_permissions_elevation_attempt(usr) return GLOB.deadmins[target] = src GLOB.admin_datums -= target @@ -119,9 +111,7 @@ GLOBAL_PROTECT(href_token) /datum/admins/proc/associate(client/client) if(IsAdminAdvancedProcCall()) - var/msg = " has tried to elevate permissions!" - message_admins("[key_name_admin(usr)][msg]") - log_admin("[key_name(usr)][msg]") + alert_to_permissions_elevation_attempt(usr) return if(!istype(client)) @@ -163,9 +153,7 @@ GLOBAL_PROTECT(href_token) /datum/admins/proc/disassociate() if(IsAdminAdvancedProcCall()) - var/msg = " has tried to elevate permissions!" - message_admins("[key_name_admin(usr)][msg]") - log_admin("[key_name(usr)][msg]") + alert_to_permissions_elevation_attempt(usr) return if(owner) GLOB.admins -= owner