mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-11 10:11:09 +00:00
[MIRROR] Fix inability to demote certain subordinates with the ID card app. (#3818)
* Fix inability to demote certain subordinates with the ID card app. (#57317) The trim system handles the interaction between heads and their air quotes "subordinates" differently. Instead of checking for head_subordinates - Which is a compiled list for who is and isn't a subordinate of who based on job datums - We instead check for the ability to apply a trim's access template to a card. This means that if you're able to assign a trim's access as a template, you're able to demote that trim too. This fixes some edge cases like being unable to demote Security Officer (Department) cards because technically Security Officer (Engineering) and Security Officer (Science) aren't real jobs (insert joke here) - They lack job datums and never get assigned as the HoS's subordinates. This is a much more modular and intuitive way of handling demotions. * Fix inability to demote certain subordinates with the ID card app. Co-authored-by: Timberpoes <silent_insomnia_pp@hotmail.co.uk>
This commit is contained in:
@@ -18,8 +18,6 @@
|
|||||||
var/authenticated_user
|
var/authenticated_user
|
||||||
/// The regions this program has access to based on the authenticated ID.
|
/// The regions this program has access to based on the authenticated ID.
|
||||||
var/list/region_access = list()
|
var/list/region_access = list()
|
||||||
/// List of subordinate jobs for head roles on the authenticated ID.
|
|
||||||
var/list/head_subordinates = list()
|
|
||||||
/// List of job templates that can be applied to ID cards from this program.
|
/// List of job templates that can be applied to ID cards from this program.
|
||||||
var/list/job_templates = list()
|
var/list/job_templates = list()
|
||||||
/// Which departments this program has access to. See region defines.
|
/// Which departments this program has access to. See region defines.
|
||||||
@@ -60,14 +58,6 @@
|
|||||||
head_types |= info["head"]
|
head_types |= info["head"]
|
||||||
job_templates |= info["templates"]
|
job_templates |= info["templates"]
|
||||||
|
|
||||||
head_subordinates.Cut()
|
|
||||||
if(length(head_types))
|
|
||||||
for(var/occupation in SSjob.occupations)
|
|
||||||
var/datum/job/job = occupation
|
|
||||||
for(var/head in head_types)
|
|
||||||
if(head in job.department_head)
|
|
||||||
head_subordinates += job.title
|
|
||||||
|
|
||||||
if(length(region_access))
|
if(length(region_access))
|
||||||
minor = TRUE
|
minor = TRUE
|
||||||
authenticated_user = "[id_card.name] \[LIMITED ACCESS\]"
|
authenticated_user = "[id_card.name] \[LIMITED ACCESS\]"
|
||||||
@@ -162,7 +152,7 @@
|
|||||||
if(!computer || !authenticated_user)
|
if(!computer || !authenticated_user)
|
||||||
return TRUE
|
return TRUE
|
||||||
if(minor)
|
if(minor)
|
||||||
if(!(target_id_card.trim?.assignment in head_subordinates) && target_id_card.trim?.assignment != "Assistant")
|
if(!(target_id_card.trim?.type in job_templates))
|
||||||
to_chat(usr, "<span class='notice'>Software error: You do not have the necessary permissions to demote this card.</span>")
|
to_chat(usr, "<span class='notice'>Software error: You do not have the necessary permissions to demote this card.</span>")
|
||||||
return TRUE
|
return TRUE
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user