Skip to content

Commit

Permalink
Implement separate server bans
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimach committed Feb 28, 2023
1 parent 4817a4b commit c77a3c9
Show file tree
Hide file tree
Showing 3 changed files with 185 additions and 28 deletions.
12 changes: 7 additions & 5 deletions SQL/tgstation_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -70,27 +70,29 @@ DROP TABLE IF EXISTS `ban`;
CREATE TABLE `ban` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`bantime` DATETIME NOT NULL,
`server_ip` INT(10) UNSIGNED NOT NULL,
`server_port` SMALLINT(5) UNSIGNED NOT NULL,
`server_ip` VARCHAR(32) NOT NULL,
`server_port` VARCHAR(32) NOT NULL,
`round_id` INT(11) UNSIGNED NULL,
`role` VARCHAR(32) NULL DEFAULT NULL,
`expiration_time` DATETIME NULL DEFAULT NULL,
`applies_to_admins` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
`reason` VARCHAR(2048) NOT NULL,
`ckey` VARCHAR(32) NULL DEFAULT NULL,
`ip` INT(10) UNSIGNED NULL DEFAULT NULL,
`ip` VARCHAR(32) NULL DEFAULT NULL,
`computerid` VARCHAR(32) NULL DEFAULT NULL,
`a_ckey` VARCHAR(32) NOT NULL,
`a_ip` INT(10) UNSIGNED NOT NULL,
`a_ip` VARCHAR(32) NOT NULL,
`a_computerid` VARCHAR(32) NOT NULL,
`who` VARCHAR(2048) NOT NULL,
`adminwho` VARCHAR(2048) NOT NULL,
`edits` TEXT NULL DEFAULT NULL,
`unbanned_datetime` DATETIME NULL DEFAULT NULL,
`unbanned_ckey` VARCHAR(32) NULL DEFAULT NULL,
`unbanned_ip` INT(10) UNSIGNED NULL DEFAULT NULL,
`unbanned_ip` VARCHAR(32) NULL DEFAULT NULL,
`unbanned_computerid` VARCHAR(32) NULL DEFAULT NULL,
`unbanned_round_id` INT(11) UNSIGNED NULL DEFAULT NULL,
`server` VARCHAR(32) NOT NULL,
`is_global` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `idx_ban_isbanned` (`ckey`,`role`,`unbanned_datetime`,`expiration_time`),
KEY `idx_ban_isbanned_details` (`ckey`,`ip`,`computerid`,`role`,`unbanned_datetime`,`expiration_time`),
Expand Down
20 changes: 20 additions & 0 deletions code/controllers/configuration/entries/dbconfig.dm
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,23 @@
/datum/config_entry/number/max_concurrent_queries
default = 25
min_val = 1

/datum/config_entry/string/bans_server_name
default = "tg"
protection = CONFIG_ENTRY_LOCKED | CONFIG_ENTRY_HIDDEN

/datum/config_entry/str_list/apply_bans_from
default = list("tg")
protection = CONFIG_ENTRY_LOCKED | CONFIG_ENTRY_HIDDEN

/datum/config_entry/str_list/read_bans_from
default = list("tg")
protection = CONFIG_ENTRY_LOCKED | CONFIG_ENTRY_HIDDEN

/datum/config_entry/str_list/modify_bans_from
default = list("tg")
protection = CONFIG_ENTRY_LOCKED | CONFIG_ENTRY_HIDDEN

/datum/config_entry/flag/apply_global_bans
default = TRUE
protection = CONFIG_ENTRY_LOCKED | CONFIG_ENTRY_HIDDEN
Loading

0 comments on commit c77a3c9

Please sign in to comment.