Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ID Modification Log to the Access Report Print #6124

Merged
merged 3 commits into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions code/__HELPERS/logging.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
44 changes: 20 additions & 24 deletions code/modules/cm_marines/marines_consoles.dm
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {"<center><h4>Access Report</h4></center>
<u>Prepared By:</u> [user_id_card?.registered_name ? user_id_card.registered_name : "Unknown"]<br>
<u>For:</u> [target_id_card.registered_name ? target_id_card.registered_name : "Unregistered"]<br>
<hr>
<u>Faction:</u> [faction]<br>
<u>Faction:</u> [target_id_card.faction ? target_id_card.faction : "N/A"]<br>
Drulikar marked this conversation as resolved.
Show resolved Hide resolved
<u>Assignment:</u> [target_id_card.assignment]<br>
<u>Account Number:</u> #[target_id_card.associated_account_number]<br>
<u>Blood Type:</u> [target_id_card.blood_type]<br><br>
Expand All @@ -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)]<br>"
contents += "<br><u>Modification Log:</u><br>"
for(var/change in target_id_card.modification_log)
contents += " [change]<br>"

var/obj/item/paper/P = new /obj/item/paper(src.loc)
P.name = "Access Report"
Expand All @@ -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, "<font color='orange'> [key_name_admin(usr)] changed the registered name of the ID to '[target_id_card.registered_name]'. </font>")
log_idmod(target_id_card, "<font color='orange'> [user.real_name] changed the registered name of the ID to '[target_id_card.registered_name]'. </font>", key_name_admin(user))
if(target_id_card.assignment != origin_assignment)
log_idmod(target_id_card, "<font color='orange'> [key_name_admin(usr)] changed the assignment of the ID to the custom position '[target_id_card.assignment]'. </font>")
log_idmod(target_id_card, "<font color='orange'> [user.real_name] changed the assignment of the ID to the custom position '[target_id_card.assignment]'. </font>", key_name_admin(user))
if(ishuman(user))
target_id_card.forceMove(user.loc)
if(!user.get_active_hand())
Expand Down Expand Up @@ -170,8 +166,8 @@

target_id_card.assignment = "Terminated"
target_id_card.access = list()
log_idmod(target_id_card, "<font color='red'> [key_name_admin(usr)] terminated the ID. </font>")
message_admins("[key_name_admin(usr)] terminated the ID of [target_id_card.registered_name].")
log_idmod(target_id_card, "<font color='red'> [user.real_name] terminated the ID. </font>", 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)
Expand Down Expand Up @@ -221,27 +217,27 @@
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, "<font color='red'> [key_name_admin(usr)] revoked [access_type] IFF. </font>")
log_idmod(target_id_card, "<font color='red'> [user.real_name] revoked [access_type] IFF. </font>", key_name_admin(user))
else
target_id_card.faction_group |= params["access_target"]
log_idmod(target_id_card, "<font color='green'> [key_name_admin(usr)] granted [access_type] IFF. </font>")
log_idmod(target_id_card, "<font color='green'> [user.real_name] granted [access_type] IFF. </font>", 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, "<font color='red'> [key_name_admin(usr)] revoked access '[access_type]'. </font>")
log_idmod(target_id_card, "<font color='red'> [user.real_name] revoked access '[get_access_desc(access_type)]'. </font>", key_name_admin(user))
else
target_id_card.access |= access_type
log_idmod(target_id_card, "<font color='green'> [key_name_admin(usr)] granted access '[access_type]'. </font>")
log_idmod(target_id_card, "<font color='green'> [user.real_name] granted access '[get_access_desc(access_type)]'. </font>", key_name_admin(user))
return TRUE
if("PRG_grantall")
if(!authenticated || !target_id_card)
return

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, "<font color='green'> [key_name_admin(usr)] granted the ID all access and USCM IFF. </font>")
log_idmod(target_id_card, "<font color='green'> [user.real_name] granted the ID all access and USCM IFF. </font>", key_name_admin(user))
return TRUE
if("PRG_denyall")
if(!authenticated || !target_id_card)
Expand All @@ -250,45 +246,45 @@
var/list/access = target_id_card.access
access.Cut()
target_id_card.faction_group -= factions
log_idmod(target_id_card, "<font color='red'> [key_name_admin(usr)] removed all accesses and USCM IFF. </font>")
log_idmod(target_id_card, "<font color='red'> [user.real_name] removed all accesses and USCM IFF. </font>", key_name_admin(user))
return TRUE
if("PRG_grantregion")
if(!authenticated || !target_id_card)
return

if(params["region"] == "Faction (IFF system)")
target_id_card.faction_group |= factions
log_idmod(target_id_card, "<font color='green'> [key_name_admin(usr)] granted USCM IFF. </font>")
log_idmod(target_id_card, "<font color='green'> [user.real_name] granted USCM IFF. </font>", 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, "<font color='green'> [key_name_admin(usr)] granted all [additions] accesses. </font>")
log_idmod(target_id_card, "<font color='green'> [user.real_name] granted all [additions] accesses. </font>", key_name_admin(user))
return TRUE
if("PRG_denyregion")
if(!authenticated || !target_id_card)
return

if(params["region"] == "Faction (IFF system)")
target_id_card.faction_group -= factions
log_idmod(target_id_card, "<font color='red'> [key_name_admin(usr)] revoked USCM IFF. </font>")
log_idmod(target_id_card, "<font color='red'> [user.real_name] revoked USCM IFF. </font>", 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, "<font color='red'> [key_name_admin(usr)] revoked all [additions] accesses. </font>")
log_idmod(target_id_card, "<font color='red'> [user.real_name] revoked all [additions] accesses. </font>", key_name_admin(user))
return TRUE
if("PRG_account")
if(!authenticated || !target_id_card)
return

var/account = text2num(params["account"])
target_id_card.associated_account_number = account
log_idmod(target_id_card, "<font color='orange'> [key_name_admin(usr)] changed the account number to '[account]'. </font>")
log_idmod(target_id_card, "<font color='orange'> [user.real_name] changed the account number to '[account]'. </font>", key_name_admin(user))
return TRUE

/obj/structure/machinery/computer/card/ui_static_data(mob/user)
Expand Down
Loading