mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-31 03:52:31 +00:00
- Adds two new types of bans: admin tempbans and admin permabans. These ban types are in reaction to the rising number of banworthy admin issues. The original intent was to make admins unbannable ingame, so players could not spoof admin computer ids to get admins banned, with the assumption that admin issues will be rare and a big deal when they happen. They have however started becoming ever more common, so some tools are required to allow for admin self-policing. - Each admin can have a maximum of one active admin ban (temporary or permanent) logged to their name. This is to prevent rogue admins from just banning everyone who could ban them. These bans are also not intended to be 'permanent-permanent'. They are intended to serve as a temporary fix, to get rid of rogue admins until the server host or another admin with rdp access (or +PERMISSIONS if you use DB_Admin) can deal with the rogue admin's removal. Once that is done, a normal permaban or tempban can be applied, and the admin permaban/tempban removed, restoring the banning admin's 1 allowed admin ban. - Admin bans are considered a big deal, so they also send a message to irc, when they are applied. - NOTE: Admin bans only check the connecting person's ckey. The risk of computer id spoofing still exists, so it's better not to have them check ips and computer ids. The admin abilities are given based on ckey anyway, so a ckey ban should be enough in most cases. Other changes to bans - Added a few variables to the funciton that adds a ban: maxadminbanchec (which is for admin bans and checks how many bans the admin can still apply); announceinirc and blockselfban (which prevents admins from applying the ban type on themselves. Currently applied for permaban, tempban, admin permaban, admin tempban) - Changed the appearance ban database constant from APPEARANCE_BAN to APPEARANCE_PERMABAN, to make it more compatible with the ban log at http://www.ss13.eu/tgdb/banoverview.php - Added a missing sanity check to topic.dm for appearance bans - Renamed appearance bans to identity bans in admin panels (as per Pete's request)
109 lines
3.0 KiB
Plaintext
109 lines
3.0 KiB
Plaintext
//ban people from using custom names and appearances. that'll show 'em.
|
|
|
|
var/appearanceban_runonce //Updates legacy bans with new info
|
|
var/appearance_keylist[0] //to store the keys
|
|
|
|
/proc/appearance_fullban(mob/M, reason)
|
|
if (!M || !M.key) return
|
|
appearance_keylist.Add(text("[M.ckey] ## [reason]"))
|
|
appearance_savebanfile()
|
|
|
|
/proc/appearance_client_fullban(ckey)
|
|
if (!ckey) return
|
|
appearance_keylist.Add(text("[ckey]"))
|
|
appearance_savebanfile()
|
|
|
|
//returns a reason if M is banned, returns 0 otherwise
|
|
/proc/appearance_isbanned(mob/M)
|
|
if(M)
|
|
for(var/s in appearance_keylist)
|
|
if(findtext(s, "[M.ckey]") == 1)
|
|
var/startpos = findtext(s, "## ") + 3
|
|
if(startpos && startpos < length(s))
|
|
var/text = copytext(s, startpos, 0)
|
|
if(text)
|
|
return text
|
|
return "Reason Unspecified"
|
|
return 0
|
|
|
|
/*
|
|
DEBUG
|
|
/mob/verb/list_all_appearances()
|
|
set name = "list all appearances"
|
|
|
|
for(var/s in appearance_keylist)
|
|
world << s
|
|
|
|
/mob/verb/reload_appearances()
|
|
set name = "reload appearances"
|
|
|
|
appearance_loadbanfile()
|
|
*/
|
|
|
|
/proc/appearance_loadbanfile()
|
|
if(config.ban_legacy_system)
|
|
var/savefile/S=new("data/appearance_full.ban")
|
|
S["keys[0]"] >> appearance_keylist
|
|
log_admin("Loading appearance_rank")
|
|
S["runonce"] >> appearanceban_runonce
|
|
|
|
if (!length(appearance_keylist))
|
|
appearance_keylist=list()
|
|
log_admin("appearance_keylist was empty")
|
|
else
|
|
if(!establish_db_connection())
|
|
world.log << "Database connection failed. Reverting to the legacy ban system."
|
|
diary << "Database connection failed. Reverting to the legacy ban system."
|
|
config.ban_legacy_system = 1
|
|
appearance_loadbanfile()
|
|
return
|
|
|
|
//appearance bans
|
|
var/DBQuery/query = dbcon.NewQuery("SELECT ckey FROM erro_ban WHERE bantype = 'APPEARANCE_PERMABAN' AND NOT unbanned = 1")
|
|
query.Execute()
|
|
|
|
while(query.NextRow())
|
|
var/ckey = query.item[1]
|
|
|
|
appearance_keylist.Add("[ckey]")
|
|
|
|
/proc/appearance_savebanfile()
|
|
var/savefile/S=new("data/appearance_full.ban")
|
|
S["keys[0]"] << appearance_keylist
|
|
|
|
/proc/appearance_unban(mob/M)
|
|
appearance_remove("[M.ckey]")
|
|
appearance_savebanfile()
|
|
|
|
|
|
/proc/appearance_updatelegacybans()
|
|
if(!appearanceban_runonce)
|
|
log_admin("Updating appearancefile!")
|
|
// Updates bans.. Or fixes them. Either way.
|
|
for(var/T in appearance_keylist)
|
|
if(!T) continue
|
|
appearanceban_runonce++ //don't run this update again
|
|
|
|
|
|
/proc/appearance_remove(X)
|
|
for (var/i = 1; i <= length(appearance_keylist); i++)
|
|
if( findtext(appearance_keylist[i], "[X]") )
|
|
appearance_keylist.Remove(appearance_keylist[i])
|
|
appearance_savebanfile()
|
|
return 1
|
|
return 0
|
|
|
|
/*
|
|
proc/DB_ban_isappearancebanned(var/playerckey)
|
|
establish_db_connection()
|
|
if(!dbcon.IsConnected())
|
|
return
|
|
|
|
var/sqlplayerckey = sql_sanitize_text(ckey(playerckey))
|
|
|
|
var/DBQuery/query = dbcon.NewQuery("SELECT id FROM erro_ban WHERE CKEY = '[sqlplayerckey]' AND ((bantype = 'APPEARANCE_PERMABAN') OR (bantype = 'APPEARANCE_TEMPBAN' AND expiration_time > Now())) AND unbanned != 1")
|
|
query.Execute()
|
|
while(query.NextRow())
|
|
return 1
|
|
return 0
|
|
*/ |