From 45489e639eb93df0e01460a31656f2999b6f3ed6 Mon Sep 17 00:00:00 2001
From: forest2001 <41653574+realforest2001@users.noreply.github.com>
Date: Sun, 21 Apr 2024 08:29:06 +0100
Subject: [PATCH] Added ID Modification Log to the Access Report Print (#6124)
# About the pull request
Allows MPs (or others) to read who made what changes to an ID card by
plugging the card into an ID Computer and hitting the print button.
This button previously printed a list of all the accesses on the ID
Card, and will still do this at the same time.
# Explain why it's good for the game
It can be incredibly frustrating to figure out how someone can suddenly
open a door without permission and is essentially untraceable at the
moment without admin help.
# Testing Photographs and Procedure
![image](https://github.com/cmss13-devs/cmss13/assets/41653574/96cff422-197e-4016-94be-087e802cd676)
# Changelog
:cl:
add: Added ID Modification Log to the Access Report printout from an ID
Console.
/:cl:
---
code/__HELPERS/logging.dm | 6 +--
code/modules/cm_marines/marines_consoles.dm | 48 ++++++++++-----------
2 files changed, 25 insertions(+), 29 deletions(-)
diff --git a/code/__HELPERS/logging.dm b/code/__HELPERS/logging.dm
index 59e4c7710992..1e72f51a8d60 100644
--- a/code/__HELPERS/logging.dm
+++ b/code/__HELPERS/logging.dm
@@ -125,11 +125,11 @@ GLOBAL_VAR_INIT(log_end, world.system_type == UNIX ? ascii2text(13) : "")
GLOB.STUI.admin.Add("\[[time]]OVERWATCH: [text]")
GLOB.STUI.processing |= STUI_LOG_ADMIN
-/proc/log_idmod(obj/item/card/id/target_id, msg)
+/proc/log_idmod(obj/item/card/id/target_id, msg, changer)
var/time = time_stamp()
if (CONFIG_GET(flag/log_idmod))
- WRITE_LOG(GLOB.world_game_log, "ID MOD: [msg]")
- LOG_REDIS("idmod", "\[[time]\] [msg]")
+ WRITE_LOG(GLOB.world_game_log, "ID MOD: ([changer]) [msg]")
+ LOG_REDIS("idmod", "\[[time]\] ([changer]) [msg]")
target_id.modification_log += "\[[time]]: [msg]"
/proc/log_vote(text)
diff --git a/code/modules/cm_marines/marines_consoles.dm b/code/modules/cm_marines/marines_consoles.dm
index 13f5e2d0df6d..e02bb930d416 100644
--- a/code/modules/cm_marines/marines_consoles.dm
+++ b/code/modules/cm_marines/marines_consoles.dm
@@ -43,12 +43,12 @@
ui = new(user, src, "CardMod", name)
ui.open()
-/obj/structure/machinery/computer/card/ui_act(action, params)
+/obj/structure/machinery/computer/card/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
if(.)
return
- var/mob/user = usr
+ var/mob/user = ui.user
playsound(src, pick('sound/machines/computer_typing4.ogg', 'sound/machines/computer_typing5.ogg', 'sound/machines/computer_typing6.ogg'), 5, 1)
switch(action)
@@ -91,18 +91,11 @@
printing = TRUE
playsound(src.loc, 'sound/machines/fax.ogg', 15, 1)
sleep(40)
- var/faction = "N/A"
- if(target_id_card.faction_group && islist(target_id_card.faction_group))
- faction = jointext(target_id_card.faction_group, ", ")
- if(isnull(target_id_card.faction_group))
- target_id_card.faction_group = list()
- else
- faction = target_id_card.faction_group
var/contents = {"
Access Report
Prepared By: [user_id_card?.registered_name ? user_id_card.registered_name : "Unknown"]
For: [target_id_card.registered_name ? target_id_card.registered_name : "Unregistered"]
- Faction: [faction]
+ Faction: [target_id_card.faction ? target_id_card.faction : "N/A"]
Assignment: [target_id_card.assignment]
Account Number: #[target_id_card.associated_account_number]
Blood Type: [target_id_card.blood_type]
@@ -112,7 +105,10 @@
var/known_access_rights = get_access(ACCESS_LIST_MARINE_ALL)
for(var/A in target_id_card.access)
if(A in known_access_rights)
- contents += " [get_access_desc(A)]"
+ contents += " [get_access_desc(A)]
"
+ contents += "
Modification Log:
"
+ for(var/change in target_id_card.modification_log)
+ contents += " [change]
"
var/obj/item/paper/P = new /obj/item/paper(src.loc)
P.name = "Access Report"
@@ -139,9 +135,9 @@
GLOB.data_core.manifest_modify(target_id_card.registered_name, target_id_card.registered_ref, target_id_card.assignment, target_id_card.rank)
target_id_card.name = text("[target_id_card.registered_name]'s ID Card ([target_id_card.assignment])")
if(target_id_card.registered_name != origin_name)
- log_idmod(target_id_card, " [key_name_admin(usr)] changed the registered name of the ID to '[target_id_card.registered_name]'. ")
+ log_idmod(target_id_card, " [user.real_name] changed the registered name of the ID to '[target_id_card.registered_name]'. ", key_name_admin(user))
if(target_id_card.assignment != origin_assignment)
- log_idmod(target_id_card, " [key_name_admin(usr)] changed the assignment of the ID to the custom position '[target_id_card.assignment]'. ")
+ log_idmod(target_id_card, " [user.real_name] changed the assignment of the ID to the custom position '[target_id_card.assignment]'. ", key_name_admin(user))
if(ishuman(user))
target_id_card.forceMove(user.loc)
if(!user.get_active_hand())
@@ -170,8 +166,8 @@
target_id_card.assignment = "Terminated"
target_id_card.access = list()
- log_idmod(target_id_card, " [key_name_admin(usr)] terminated the ID. ")
- message_admins("[key_name_admin(usr)] terminated the ID of [target_id_card.registered_name].")
+ log_idmod(target_id_card, " [user.real_name] terminated the ID. ", key_name_admin(user))
+ message_admins("[user.real_name] terminated the ID of [target_id_card.registered_name].", key_name_admin(user))
return TRUE
if("PRG_edit")
if(!authenticated || !target_id_card)
@@ -221,19 +217,19 @@
target_id_card.faction_group = list()
if(params["access_target"] in target_id_card.faction_group)
target_id_card.faction_group -= params["access_target"]
- log_idmod(target_id_card, " [key_name_admin(usr)] revoked [access_type] IFF. ")
+ log_idmod(target_id_card, " [user.real_name] revoked [access_type] IFF. ", key_name_admin(user))
else
target_id_card.faction_group |= params["access_target"]
- log_idmod(target_id_card, " [key_name_admin(usr)] granted [access_type] IFF. ")
+ log_idmod(target_id_card, " [user.real_name] granted [access_type] IFF. ", key_name_admin(user))
return TRUE
access_type = text2num(params["access_target"])
if(access_type in (is_centcom ? get_access(ACCESS_LIST_WY_ALL) : get_access(ACCESS_LIST_MARINE_MAIN)))
if(access_type in target_id_card.access)
target_id_card.access -= access_type
- log_idmod(target_id_card, " [key_name_admin(usr)] revoked access '[access_type]'. ")
+ log_idmod(target_id_card, " [user.real_name] revoked access '[get_access_desc(access_type)]'. ", key_name_admin(user))
else
target_id_card.access |= access_type
- log_idmod(target_id_card, " [key_name_admin(usr)] granted access '[access_type]'. ")
+ log_idmod(target_id_card, " [user.real_name] granted access '[get_access_desc(access_type)]'. ", key_name_admin(user))
return TRUE
if("PRG_grantall")
if(!authenticated || !target_id_card)
@@ -241,7 +237,7 @@
target_id_card.access |= (is_centcom ? get_access(ACCESS_LIST_WY_ALL) : get_access(ACCESS_LIST_MARINE_MAIN))
target_id_card.faction_group |= factions
- log_idmod(target_id_card, " [key_name_admin(usr)] granted the ID all access and USCM IFF. ")
+ log_idmod(target_id_card, " [user.real_name] granted the ID all access and USCM IFF. ", key_name_admin(user))
return TRUE
if("PRG_denyall")
if(!authenticated || !target_id_card)
@@ -250,7 +246,7 @@
var/list/access = target_id_card.access
access.Cut()
target_id_card.faction_group -= factions
- log_idmod(target_id_card, " [key_name_admin(usr)] removed all accesses and USCM IFF. ")
+ log_idmod(target_id_card, " [user.real_name] removed all accesses and USCM IFF. ", key_name_admin(user))
return TRUE
if("PRG_grantregion")
if(!authenticated || !target_id_card)
@@ -258,14 +254,14 @@
if(params["region"] == "Faction (IFF system)")
target_id_card.faction_group |= factions
- log_idmod(target_id_card, " [key_name_admin(usr)] granted USCM IFF. ")
+ log_idmod(target_id_card, " [user.real_name] granted USCM IFF. ", key_name_admin(user))
return TRUE
var/region = text2num(params["region"])
if(isnull(region))
return
target_id_card.access |= get_region_accesses(region)
var/additions = get_region_accesses_name(region)
- log_idmod(target_id_card, " [key_name_admin(usr)] granted all [additions] accesses. ")
+ log_idmod(target_id_card, " [user.real_name] granted all [additions] accesses. ", key_name_admin(user))
return TRUE
if("PRG_denyregion")
if(!authenticated || !target_id_card)
@@ -273,14 +269,14 @@
if(params["region"] == "Faction (IFF system)")
target_id_card.faction_group -= factions
- log_idmod(target_id_card, " [key_name_admin(usr)] revoked USCM IFF. ")
+ log_idmod(target_id_card, " [user.real_name] revoked USCM IFF. ", key_name_admin(user))
return TRUE
var/region = text2num(params["region"])
if(isnull(region))
return
target_id_card.access -= get_region_accesses(region)
var/additions = get_region_accesses_name(region)
- log_idmod(target_id_card, " [key_name_admin(usr)] revoked all [additions] accesses. ")
+ log_idmod(target_id_card, " [user.real_name] revoked all [additions] accesses. ", key_name_admin(user))
return TRUE
if("PRG_account")
if(!authenticated || !target_id_card)
@@ -288,7 +284,7 @@
var/account = text2num(params["account"])
target_id_card.associated_account_number = account
- log_idmod(target_id_card, " [key_name_admin(usr)] changed the account number to '[account]'. ")
+ log_idmod(target_id_card, " [user.real_name] changed the account number to '[account]'. ", key_name_admin(user))
return TRUE
/obj/structure/machinery/computer/card/ui_static_data(mob/user)