Granular admin perms (#66368) (#13305)

* Granular admin perms

* Implement temporary user specific permissions menu

* Restore config

* Fix TESTING

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
This commit is contained in:
SkyratBot
2022-05-04 10:29:55 +01:00
committed by GitHub
co-authored by Mothblocks
parent 75348cbd2a
commit 58b8cfa3cc
14 changed files with 239 additions and 199 deletions
+7 -14
View File
@@ -237,20 +237,16 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
// SKYRAT EDIT END
if(CONFIG_GET(flag/autoadmin))
if(!GLOB.admin_datums[ckey])
var/datum/admin_rank/autorank
for(var/datum/admin_rank/R in GLOB.admin_ranks)
if(R.name == CONFIG_GET(string/autoadmin_rank))
autorank = R
break
if(!autorank)
var/list/autoadmin_ranks = ranks_from_rank_name(CONFIG_GET(string/autoadmin_rank))
if (autoadmin_ranks.len == 0)
to_chat(world, "Autoadmin rank not found")
else
new /datum/admins(autorank, ckey)
new /datum/admins(autoadmin_ranks, ckey)
if(CONFIG_GET(flag/enable_localhost_rank) && !connecting_admin)
var/localhost_addresses = list("127.0.0.1", "::1")
if(isnull(address) || (address in localhost_addresses))
var/datum/admin_rank/localhost_rank = new("!localhost!", R_EVERYTHING, R_DBRANKS, R_EVERYTHING) //+EVERYTHING -DBRANKS *EVERYTHING
new /datum/admins(localhost_rank, ckey, 1, 1)
new /datum/admins(list(localhost_rank), ckey, 1, 1)
//preferences datum - also holds some persistent data for the client (because we may as well keep these datums to a minimum)
prefs = GLOB.preferences_datums[ckey]
if(prefs)
@@ -591,12 +587,9 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
while (query_get_related_cid.NextRow())
related_accounts_cid += "[query_get_related_cid.item[1]], "
qdel(query_get_related_cid)
var/admin_rank = "Player"
if (src.holder && src.holder.rank)
admin_rank = src.holder.rank.name
else
if (!GLOB.deadmins[ckey] && check_randomizer(connectiontopic))
return
var/admin_rank = holder?.rank_names() || "Player"
if (!holder && !GLOB.deadmins[ckey] && check_randomizer(connectiontopic))
return
var/new_player
var/datum/db_query/query_client_in_db = SSdbcore.NewQuery(
"SELECT 1 FROM [format_table_name("player")] WHERE ckey = :ckey",
+2 -2
View File
@@ -75,7 +75,7 @@
var/msg = "<b>Current Admins:</b>\n"
if(holder)
for(var/client/C in GLOB.admins)
msg += "\t[C] is a [C.holder.rank]"
msg += "\t[C] is a [C.holder.rank_names()]"
if(C.holder.fakekey)
msg += " <i>(as [C.holder.fakekey])</i>"
@@ -102,7 +102,7 @@
if(C.is_afk())
continue //Don't show afk admins to adminwho
if(!C.holder.fakekey)
msg += "\t[C] is a [C.holder.rank]\n"
msg += "\t[C] is a [C.holder.rank_names()]\n"
msg += span_info("Adminhelps are also sent through TGS to services like IRC and Discord. If no admins are available in game, sending an adminhelp might still be noticed and responded to.")
to_chat(src, msg)