The Science Hub app for research is now available for science employees in addition to heads of staff. (#65035)

This commit is contained in:
zxaber
2022-03-05 17:41:22 -08:00
committed by GitHub
parent 1ee18f6502
commit e55d72680b
15 changed files with 39 additions and 41 deletions
@@ -3,10 +3,10 @@
filetype = "PRG"
/// File name. FILE NAME MUST BE UNIQUE IF YOU WANT THE PROGRAM TO BE DOWNLOADABLE FROM NTNET!
filename = "UnknownProgram"
/// List of required accesses to *run* the program.
var/required_access = null
/// List of required access to download or file host the program
var/transfer_access = null
/// List of required accesses to *run* the program. Any match will do.
var/list/required_access = list()
/// List of required access to download or file host the program. Any match will do.
var/list/transfer_access = list()
/// PROGRAM_STATE_KILLED or PROGRAM_STATE_BACKGROUND or PROGRAM_STATE_ACTIVE - specifies whether this program is running.
var/program_state = PROGRAM_STATE_KILLED
/// Device that runs this program.
@@ -106,7 +106,7 @@
return TRUE
/**
*Check if the user can run program. Only humans can operate computer. Automatically called in run_program()
*Check if the user can run program. Only humans and silicons can operate computer. Automatically called in run_program()
*ID must be inserted into a card slot to be read. If the program is not currently installed (as is the case when
*NT Software Hub is checking available software), a list can be given to be used instead.
*Arguments:
@@ -117,39 +117,41 @@
*access can contain a list of access numbers to check against. If access is not empty, it will be used istead of checking any inserted ID.
*/
/datum/computer_file/program/proc/can_run(mob/user, loud = FALSE, access_to_check, transfer = FALSE, list/access)
// Defaults to required_access
if(!access_to_check)
if(transfer && transfer_access)
access_to_check = transfer_access
else
access_to_check = required_access
if(!access_to_check) // No required_access, allow it.
return TRUE
if(!transfer && computer && (computer.obj_flags & EMAGGED)) //emags can bypass the execution locks but not the download ones.
if(issilicon(user))
return TRUE
if(isAdminGhostAI(user))
return TRUE
if(issilicon(user))
if(!transfer && computer && (computer.obj_flags & EMAGGED)) //emags can bypass the execution locks but not the download ones.
return TRUE
// Defaults to required_access
if(!access_to_check)
if(transfer && length(transfer_access))
access_to_check = transfer_access
else
access_to_check = required_access
if(!length(access_to_check)) // No required_access, allow it.
return TRUE
if(!length(access))
var/obj/item/card/id/D
var/obj/item/card/id/accesscard
var/obj/item/computer_hardware/card_slot/card_slot
if(computer)
card_slot = computer.all_components[MC_CARD]
D = card_slot?.GetID()
accesscard = card_slot?.GetID()
if(!D)
if(!accesscard)
if(loud)
to_chat(user, span_danger("\The [computer] flashes an \"RFID Error - Unable to scan ID\" warning."))
return FALSE
access = D.GetAccess()
access = accesscard.GetAccess()
for(var/singular_access in access_to_check)
if(singular_access in access) //For loop checks every individual access entry in the access list. If the user's ID has access to any entry, then we're good.
return TRUE
if(access_to_check in access)
return TRUE
if(loud)
to_chat(user, span_danger("\The [computer] flashes an \"Access Denied\" warning."))
return FALSE