Merge pull request #1963 from Citadel-Station-13/upstream-merge-29143

[MIRROR] Fixes race condition with admin proc calls and load admins
This commit is contained in:
LetterJay
2017-07-09 23:06:47 -05:00
committed by GitHub

View File

@@ -97,6 +97,7 @@ GLOBAL_PROTECT(admin_ranks)
if(!adds.Remove(path))
subs += path //-
// Checks for (keyword-formatted) rights on this admin
/datum/admins/proc/check_keyword(word)
var/flag = admin_keyword_to_flag(word)
@@ -111,6 +112,9 @@ GLOBAL_PROTECT(admin_ranks)
//load our rank - > rights associations
/proc/load_admin_ranks()
if(IsAdminAdvancedProcCall())
to_chat(usr, "<span class='admin prefix'>Admin Reload blocked: Advanced ProcCall detected.</span>")
return
GLOB.admin_ranks.Cut()
if(config.admin_legacy_system)
@@ -168,6 +172,9 @@ GLOBAL_PROTECT(admin_ranks)
/proc/load_admins(target = null)
if(IsAdminAdvancedProcCall())
to_chat(usr, "<span class='admin prefix'>Admin Reload blocked: Advanced ProcCall detected.</span>")
return
//clear the datums references
if(!target)
GLOB.admin_datums.Cut()
@@ -270,6 +277,9 @@ GLOBAL_PROTECT(admin_ranks)
message_admins("[key_name_admin(usr)] attempted to edit the admin permissions without sufficient rights.")
log_admin("[key_name(usr)] attempted to edit the admin permissions without sufficient rights.")
return
if(IsAdminAdvancedProcCall())
to_chat(usr, "<span class='admin prefix'>Admin Edit blocked: Advanced ProcCall detected.</span>")
return
var/adm_ckey
var/task = href_list["editrights"]
@@ -371,7 +381,6 @@ GLOBAL_PROTECT(admin_ranks)
if(!findtext(D.rank.name, "([adm_ckey])")) //not a modified subrank, need to duplicate the admin_rank datum to prevent modifying others too
D.rank = new("[D.rank.name]([adm_ckey])", D.rank.rights, D.rank.adds, D.rank.subs) //duplicate our previous admin_rank but with a new name
//we don't add this clone to the admin_ranks list, as it is unique to that ckey
D.rank.process_keyword(keyword)
var/client/C = GLOB.directory[adm_ckey] //find the client with the specified ckey (if they are logged in)