Add AdminRanks prefix to logs related to adminranks

Add debug logs to API to figure out API issue with "missing" parameter
This commit is contained in:
Werner
2020-08-10 15:00:40 +02:00
parent a8bfac34ef
commit d2c886cb33
2 changed files with 23 additions and 18 deletions

View File

@@ -22,31 +22,31 @@ var/list/forum_groupids_to_ranks = list()
. |= R_ADMIN . |= R_ADMIN
if ("r_ban") if ("r_ban")
. |= R_BAN . |= R_BAN
if ("r_fun") if ("r_fun")
. |= R_FUN . |= R_FUN
if ("r_server") if ("r_server")
. |= R_SERVER . |= R_SERVER
if ("r_debug") if ("r_debug")
. |= R_DEBUG . |= R_DEBUG
if ("r_permissions","r_rights") if ("r_permissions","r_rights")
. |= R_PERMISSIONS . |= R_PERMISSIONS
if ("r_possess") if ("r_possess")
. |= R_POSSESS . |= R_POSSESS
if ("r_stealth") if ("r_stealth")
. |= R_STEALTH . |= R_STEALTH
if ("r_rejuv","r_rejuvinate") if ("r_rejuv","r_rejuvinate")
. |= R_REJUVINATE . |= R_REJUVINATE
if ("r_varedit") if ("r_varedit")
. |= R_VAREDIT . |= R_VAREDIT
if ("r_sound","r_sounds") if ("r_sound","r_sounds")
. |= R_SOUNDS . |= R_SOUNDS
if ("r_spawn","r_create") if ("r_spawn","r_create")
. |= R_SPAWN . |= R_SPAWN
if ("r_moderator") if ("r_moderator")
. |= R_MOD . |= R_MOD
if ("r_developer") if ("r_developer")
. |= R_DEV . |= R_DEV
if ("r_cciaa") if ("r_cciaa")
. |= R_CCIAA . |= R_CCIAA
if ("r_everything","r_host","r_all") if ("r_everything","r_host","r_all")
. |= (R_BUILDMODE | R_ADMIN | R_BAN | R_FUN | R_SERVER | R_DEBUG | R_PERMISSIONS | R_POSSESS | R_STEALTH | R_REJUVINATE | R_VAREDIT | R_SOUNDS | R_SPAWN | R_MOD | R_CCIAA | R_DEV) . |= (R_BUILDMODE | R_ADMIN | R_BAN | R_FUN | R_SERVER | R_DEBUG | R_PERMISSIONS | R_POSSESS | R_STEALTH | R_REJUVINATE | R_VAREDIT | R_SOUNDS | R_SPAWN | R_MOD | R_CCIAA | R_DEV)
@@ -107,13 +107,15 @@ var/list/forum_groupids_to_ranks = list()
//find the client for a ckey if they are connected and associate them with the new admin datum //find the client for a ckey if they are connected and associate them with the new admin datum
D.associate(directory[ckey]) D.associate(directory[ckey])
log_debug("AdminRanks: Upaded Admins from Legacy System")
else else
//The current admin system uses SQL //The current admin system uses SQL
establish_db_connection(dbcon) establish_db_connection(dbcon)
if(!dbcon.IsConnected()) if(!dbcon.IsConnected())
error("Failed to connect to database in load_admins(). Reverting to legacy system.") error("AdminRanks: Failed to connect to database in load_admins(). Reverting to legacy system.")
log_misc("Failed to connect to database in load_admins(). Reverting to legacy system.") log_misc("AdminRanks: Failed to connect to database in load_admins(). Reverting to legacy system.")
config.admin_legacy_system = 1 config.admin_legacy_system = 1
load_admins() load_admins()
return return
@@ -126,14 +128,14 @@ var/list/forum_groupids_to_ranks = list()
var/rights = query.item[3] var/rights = query.item[3]
if(istext(rights)) if(istext(rights))
rights = text2num(rights) rights = text2num(rights)
var/datum/admins/D = new /datum/admins(rank, rights, ckey) var/datum/admins/D = new /datum/admins(rank, rights, ckey)
//find the client for a ckey if they are connected and associate them with the new admin datum //find the client for a ckey if they are connected and associate them with the new admin datum
D.associate(directory[ckey]) D.associate(directory[ckey])
if(!admin_datums) if(!admin_datums)
error("The database query in load_admins() resulted in no admins being added to the list. Reverting to legacy system.") error("AdminRanks: The database query in load_admins() resulted in no admins being added to the list. Reverting to legacy system.")
log_misc("The database query in load_admins() resulted in no admins being added to the list. Reverting to legacy system.") log_misc("AdminRanks: The database query in load_admins() resulted in no admins being added to the list. Reverting to legacy system.")
config.admin_legacy_system = 1 config.admin_legacy_system = 1
load_admins() load_admins()
return return
@@ -165,7 +167,7 @@ var/list/forum_groupids_to_ranks = list()
set background = TRUE set background = TRUE
if (!establish_db_connection(dbcon)) if (!establish_db_connection(dbcon))
log_and_message_admins("Failed to connect to database in update_admins_from_api(). Carrying on with old staff lists.") log_and_message_admins("AdminRanks: Failed to connect to database in update_admins_from_api(). Carrying on with old staff lists.")
return FALSE return FALSE
var/list/admins_to_push = list() var/list/admins_to_push = list()
@@ -183,7 +185,7 @@ var/list/forum_groupids_to_ranks = list()
if (resp.errored) if (resp.errored)
crash_with("Role request errored for id [rank.group_id] with: [resp.error]") crash_with("Role request errored for id [rank.group_id] with: [resp.error]")
log_and_message_admins("Loading admins from forumuser API FAILED. Please alert web-service maintainers immediately!") log_and_message_admins("AdminRanks: Loading admins from forumuser API FAILED. Please alert web-service maintainers immediately!")
return FALSE return FALSE
for (var/datum/forum_user/user in resp.body) for (var/datum/forum_user/user in resp.body)
@@ -201,6 +203,8 @@ var/list/forum_groupids_to_ranks = list()
if (reload_once_done) if (reload_once_done)
load_admins() load_admins()
log_debug("AdminRanks: Updated Admins from ForumUserAPI")
return TRUE return TRUE
/proc/insert_user_to_admins_table(datum/forum_user/user) /proc/insert_user_to_admins_table(datum/forum_user/user)

View File

@@ -42,6 +42,7 @@
missing_params += param["name"] missing_params += param["name"]
if(errorcount) if(errorcount)
log_debug("API: Request aborted. Required parameters missing") log_debug("API: Request aborted. Required parameters missing")
log_debug("API: Received the following params: [json_encode(queryparams)]")
statuscode = 400 statuscode = 400
response = "Required params missing" response = "Required params missing"
data = missing_params data = missing_params