From e987e2f0c4b5f990699e81b0b61d6c5df470df7f Mon Sep 17 00:00:00 2001 From: NullSnapshot Date: Tue, 26 Jul 2016 14:39:04 -0700 Subject: [PATCH] allows check_rights to accept either mobs or clients. --- code/modules/admin/holder2.dm | 26 +++++++++++++++----------- code/modules/paperwork/adminpaper.dm | 4 ++-- code/modules/paperwork/faxmachine.dm | 2 +- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/code/modules/admin/holder2.dm b/code/modules/admin/holder2.dm index 9c73dd9e86..6fe8f0c6f0 100644 --- a/code/modules/admin/holder2.dm +++ b/code/modules/admin/holder2.dm @@ -13,6 +13,7 @@ var/list/admin_datums = list() var/datum/feed_channel/admincaster_feed_channel = new /datum/feed_channel var/admincaster_signature //What you'll sign the newsfeeds as + /datum/admins/New(initial_rank = "Temporary Admin", initial_rights = 0, ckey) if(!ckey) error("Admin datum created without a ckey argument. Datum has been deleted") @@ -57,21 +58,24 @@ proc/admin_proc() NOTE: It checks usr by default. Supply the "user" argument if you wish to check for a specific mob. */ -/proc/check_rights(rights_required, show_msg=1, var/mob/user = usr) - if(user && user.client) +/proc/check_rights(rights_required, show_msg=1, var/client/C = usr) + if(ismob(C)) + var/mob/M = C + C = M.client + + if(C) if(rights_required) - if(user.client.holder) - if(rights_required & user.client.holder.rights) - return 1 - else - if(show_msg) - user << "Error: You do not have sufficient rights to do that. You require one of the following flags:[rights2text(rights_required," ")]." - else - if(user.client.holder) + if(rights_required & C.holder.rights) return 1 else if(show_msg) - user << "Error: You are not an admin." + C << "Error: You do not have sufficient rights to do that. You require one of the following flags:[rights2text(rights_required," ")]." + else + if(C.holder) + return 1 + else + if(show_msg) + C << "Error: You are not an admin." return 0 //probably a bit iffy - will hopefully figure out a better solution diff --git a/code/modules/paperwork/adminpaper.dm b/code/modules/paperwork/adminpaper.dm index 13bd884a14..0a8f7db619 100644 --- a/code/modules/paperwork/adminpaper.dm +++ b/code/modules/paperwork/adminpaper.dm @@ -38,13 +38,13 @@ /obj/item/weapon/paper/admin/proc/generateHeader() var/originhash = md5("[origin]") - var/challengehash = copytext(md5("[game_id]"),1,10) // changed to a hash of the game ID so it's more consistant but changes every round. + var/timehash = copytext(md5("[world.time]"),1,10) var/text = null //TODO change logo based on who you're contacting. text = "

" text += "[origin] Quantum Uplink Signed Message
" text += "Encryption key: [originhash]
" - text += "Challenge: [challengehash]

" + text += "Challenge: [timehash]

" header = text diff --git a/code/modules/paperwork/faxmachine.dm b/code/modules/paperwork/faxmachine.dm index d1bc5b93be..cf1da677f0 100644 --- a/code/modules/paperwork/faxmachine.dm +++ b/code/modules/paperwork/faxmachine.dm @@ -201,6 +201,6 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins msg += "Receiving '[sent.name]' via secure connection ... view message" for(var/client/C in admins) - if((R_ADMIN | R_MOD) & C.holder.rights) + if(check_rights((R_ADMIN|R_MOD),0,C)) C << msg C << 'sound/effects/printer.ogg'