Commit Graph

81 Commits

Author SHA1 Message Date
MrStonedOne
2e757683ab Database backed stickybans
Supports disabling stickybans for a round, exempting a key from matching a stickyban, and it now also detects rogue stickybans before anybody currently connected even gets disconnected. (new matches trigger a 5 second sleep and abort enforcement if enough other new matches happen in that timeframe)
2019-03-16 00:23:37 -07:00
Jordie
8a66665e95 Ban system and interface update (#41176)
Spiritual successor and extension to #17798, an almost entire rebuild of the SQL ban system backend and interface.
Bantypes are removed per #8584 and #6174. All bans are now 'role bans', server bans are when a ban's role is server. Admin bans are a column, meaning it's possible to ban admins from jobs.
Bans now have only an expiry datetime, duration is calculated from this when queried.
unbanned column is removed as it's superfluous, checking unban status is now done through checking unban_datetime. unban_round_id column added. Each ip and computerid columns rearranged so ip is always first, like in other tables. Bans now permit a null ckey, ip and computerid.

Ban checking is split into two procs now is_banned_from() does a check if a ckey is banned from one or more roles and returns true or false. This effectively replaces jobban_isbanned() used in simple if() statements. If connected a client's ban cache is checked rather than querying the DB. This makes it possible for a client connected to two or more servers to ignore any bans made on one server until their ban cache is rebuilt on the others. Could be avoided with cross-server calls to update ban caches or just the removal of the ban cache but as is I've done neither since I think it's enough of an edge case to not be worth it.
The second proc is is_banned_from_with_details(), this queries the DB for a role ban on a player's ckey, ip or CID and returns the details. This replaces direct queries in IsBanned.dm and the preferences menu.

The legacy ban system is removed.

The interfaces for banning, unbanning and editing bans have been remade to require less clicking and easier simultaneous operations. The banning and jobban panel are combined. They also store player connection details when opened so a client disconnecting no longer stops a ban being placed.

New banning panel:
Key, IP and CID can all be toggled to allow excluding them from a ban.
Checking Use IP and CID from last connection lets you enter only a ckey and have the DB fill these fields in for you, if possible.
Temporary bans have a drop-menu which lets you select between seconds, minutes, hours, days, weeks, months and years so you don't need to calculate how many minutes a long ban would be. The ban is still converted into minutes on the DB however.
Checking any of the head roles will check both of the boxes for you.
The red role box indicates there is already a ban on that role for this ckey. You can apply additional role bans to stack them.

New unbanning panel:
Unbanning panel is now separate from the banning panel but otherwise functionally the same.

Ban editing panel:
Actually just a modified banning panel, all the features from it work the same here.
You can now edit almost all parameters of a ban instead of just the reason.
You can't edit severity as it's not really part of the ban.
The panels have been tested but I've not been able to get my local server to be accessible so ban functionality isn't properly confirmed. Plenty of testing will be required as I'd rather not break bans.



cl
admin: Ban interface rework. The banning and unbanning panels have received a new design which is easier to use and allows multiple role bans to be made at once.
prefix: Ban search and unbanning moved to unbanning panel, which is now a separate panel to the old banning panel.
/cl
2018-12-05 08:48:37 +13:00
CitrusGender
bb2c82375e Add Note severity and changes UI of administrative notes (#39808)
* Adds note_severity and updates dbconfig. New SQL stuff too.

* whoops please don't hack into my database >:^(

* UI change, changed how it's stored in the DB, removed some queries when it returns, changed stuff to key.

* Update sql_message_system.dm

* this was not defined

* random indent

* wait how did this get here

* okay enough web edits I promise

* just kidding I got u

* Update common.css

* Added buttons, changed UI again, standardized the inputs, added severity for appearance bans, fed the dog

* forgot about the banning panel

* added an asset cache

* corrects asset datum var name
2018-08-26 20:23:29 +10:00
Jordie
f8f1b6ca03 Some injection fixes (#39642)
Fixes a breaking error and possible injection exploit in
populate_key_2018-07-09.py caused by a key existing from when byond allowed now
blocked characters like ' in usernames e.g.
http://www.byond.com/members/immortaljrosh?format=text

Additionally fixes some unsanitized values in other queries.
2018-08-12 14:09:45 -07:00
Jordie
31f020f3cc Add expiration time for admin messages (#39502)
* add expiration time for messages

* typo

* fix

* src to usr

* allows removing expiry from existing messages

* cancel button
2018-08-12 06:31:14 +10:00
Jordie
0d7ef3ed65 Key instead of ckey for user facing logs and ui (#39009)
* converts to using key instead of ckey for user facing logs and ui

* more key_name for airlock wires

* futureproofing check for if key changes

* --onlyckeymatch script argument and fail/success counter

* fix
2018-08-11 02:15:50 +10:00
Jordan Brown
a38ef372a1 Adds SQL to travis. Other travis optimizations (#38325)
* Adds SQL to travis

* See if we can get this working

* :dab:

* Try dis

* wew

* Try this?

* Should do it

* DL the biatch

* oof

* bruh

* json in 10.2

* Fix schemas

* Actually separate tools and byond builds

* Dedent the ting

* Needs more include

* Fix script logic

* Caching and fixups

* Jesus neer

* Fix this

* And this

* Fix things

* Oh that's why she did it here

* Fuck a duck

* yadayadayada

* Cache cargo in the right build

* Idiot.commit

* *sighs*

* Tools build doesn't need BYOND cache

* Create a database with the prefixed schema as well

* Fix prefixed trigger names
2018-06-11 20:08:55 +03:00
Jordie
37854a5489 Splits up round table initialize, start, end and shutdown (#37665)
For planned change to how TGS initializes server instances ahead of time so rounds aren't tracked as being far longer than they really would be. Similarly end time split for a more accurate round duration.
2018-05-15 19:11:39 +12:00
Jordie
69cdd4f269 Adds role time log table and triggers (#37763)
* adds role time log table and triggers

* typo

* whoops also typo here
2018-05-09 17:54:39 +10:00
Jordie
e44298a36c some dbadmin fixes (#37623) 2018-05-04 12:14:35 +02:00
Jordie0608
b304c760ae adds log and management tabs to permissions panel 2018-04-17 21:26:24 +10:00
Jordie
23a45889ed Modernizes SQL admin loading (#35264)
* updates sqladmins with excluded flags and tempminning

* rank, editing and permission protections; json backup

* fixes

* reverted the wrong file

* fix slidecolor cascading and disabled switches not being sent in form

* removes debug uncommenting

* whoops this too

* commas fix + versions for changelog entry headers since 3.0

* actually account for can_edit_flags and use of @ with - or *

* fixes and rearrangement of admin > localhost > autoadmin precedence

* in case you want to not have autologin autoadmins
2018-03-02 13:38:26 +13:00
Jordie0608
b6124b77b6 adds note to exception regarding round id 2017-11-24 01:07:21 +11:00
Jordie0608
c6b45dcbd9 adds note and warning prompt about mariadb 2017-11-24 00:00:31 +11:00
Jordie
8b19b490d1 JSON feedback (#32188)
* wip

* wip2

* makes code actually compile on 511 + fixes

* versioning

* s

* adds python conversion script, schema change and removes 'force ' from item_used_for_combat

* fix to compile

* forgot to actually commit this
2017-11-17 02:43:12 -05:00
MrStonedOne
ca33ca2e05 Note fading and persistent messages
Player Notes can now fade out over time so admins don't accidentally ban players for 4 year old notes
Deleted messages now remain in the database and are instead just hidden from view.

Two things relating to messages I've been meaning to do for ever.
2017-08-30 22:10:56 -07:00
Jordie0608
b7341a93ae adds more round id tracking 2017-08-25 22:05:32 +10:00
Jordan Brown
08a1c4bb5c Add logging of deathgasp last words and suicide stats to the death table (#29953)
* Add logging of deathgasp last words

* Column size -> 255

* comment

* Adds suicide tracking to stats death table

* Commas

* Merge the changes
2017-08-21 12:41:34 +12:00
Jordie
f2e5ccee3b moves playtime tracking change entry below header 2017-08-20 21:06:30 +10:00
Shadowlight213
e458845453 Adds tracking amount of time spent playing departments 2: The fall of the Assistants. (#29105)
* Ports Paradise Job exp system

* changed to use json_decode and json_encode as recommended by oranges

* updates changelog

* Reee cyberboss

* Changes to use a seperate table

* Updates database changelog
Changes to use mediumint

* Back to wip we go.
Changes sql stuff to how mso suggested
Attempts the changes requested in the other pr.

* work on stuff.

* work on stuff.

* Renamed proc for time remaining.
Fixed updating time amounts.
Added delay to fix firing at roundstart

* exp is now stored in a global list, and only updated to the db at round end.

* some stuff

* Added button to toggle exempt status on a player.
Still need to make it update the db

* REEE Jordie.
Undoes delaying exp updating to round end.
Adds the updating filtering to the update_exp_client proc which is used again

* Lowers a bunch of the times needed.

* Makes tracking per job instead of per department.
Department time is now calculated from job time.

* Whoops forgot to update master first. Lemme save this

Reverb should play cheeki breeki to people

* I think I did this right.
Too tired to test atm.
Busy rewatching twintails ni narimasu

* Removes var from proc arguments
Fixes database stuff

* Does some requested changes.
Makes special_role be tracked instead of bundled under special.

* Done, but need to refactor how it handles ghost roles.

* Less false data wew

* Changes

* Updates db version
More changes

* More changes

* More changes

* revision fix

* OOPS

* fix schemas

* Makes SQL error logging handled by Execute
Gang role tracking now strips out the gang name and is generic.
2017-08-20 23:01:08 +12:00
Jordie0608
7e6ed58148 change versioning check to use insert 2017-07-25 17:56:48 +10:00
Jordie
b188a18482 limit 1 to stop unsafe update error 2017-07-25 15:26:29 +10:00
Jordie
342852553e Merge branch 'master' into thecurrentdatabasechangelogfileversionisv1.32 2017-07-24 10:43:57 +10:00
Jordie
92110245fa adds info for schema versioning to head of file 2017-07-24 10:34:19 +10:00
oranges
0dfa3d8aa2 Adds a database versioning schema table (#28897)
* Adds a database versioning schema table

All it does right now is warn admins when the version in the db gets behind
the defined version in the compile options file

This also moves the db connection warning messages to the
CheckSchemaVersion proc in world, out of the roundid proc
as it's the first db proc called in a world round

* Update database_changelog.txt

* Update tgstation_schema.sql

* Update tgstation_schema_prefixed.sql
2017-06-29 16:47:17 +10:00
Jordie
27276ca3bb Readds percentagecalc as default_display_in_results (#28840)
* readds percentagecalc as default_display_in_results with a prompt explaining what it actually does

* default 1

* tabsplz

* Update database_changelog.txt

* Update tgstation_schema.sql

* Update database_changelog.txt

* Update tgstation_schema_prefixed.sql

* Update create_poll.dm
2017-06-27 21:43:49 -04:00
Kyle Spier-Swenson
94673e4aa6 Removes database specifiers from sql queries. (#28839)
* Remove database specifiers from sql changelog entries.

Seriously, these default to the active database, and its not at all likely somebody will use the default name. /tg/ sure has hell doesn't.

* Remove database specifier from the schema

* Remove database specifiers from sql optimisations file

* Remove database specifier from the prefixed schema

* Add notes to CONTRIBUTING.md relating to schema changes
2017-06-26 16:05:55 +10:00
Jordie
e4fc888559 Merge branch 'master' into whyarethepolltypesdefinesthatseemskindasilly 2017-06-22 12:36:33 +10:00
Jordie
d7bb5c626c conflict fix 2017-06-22 12:21:19 +10:00
Jordie
a69bb7f645 query for removing percentagecalc 2017-06-22 12:19:07 +10:00
Jordie
478ca26d54 removes percentagecalc column 2017-06-22 12:15:16 +10:00
Jordie
90ad0905d2 removes percentagecalc column 2017-06-22 12:14:42 +10:00
MattDuskson
a855c4bf26 Update tgstation_schema_prefixed.sql 2017-06-19 12:55:58 +02:00
MattDuskson
ae93aaecc3 Fixed missing comma. 2017-06-19 03:37:13 +02:00
Jordie0608
689dc51296 removes gender, adds round_id and splits up coord columns 2017-06-08 17:01:37 +10:00
Jordie
b8950b2fa0 adds temp index to query for converting to rounds 2017-06-05 16:19:24 +10:00
Kyle Spier-Swenson
60bd733103 kor is a butt (#27883) 2017-05-30 17:53:02 -06:00
Leo
5f68f9183c Merge branch 'master' into hellotheremergeconflictsyouseemfamiliarhavewemetbefore 2017-05-27 22:26:15 -03:00
Jordie
f042d97448 Adds round table to replace tacking some data in feedback table (#27454)
* adds round table to replace tacking some data in feedback table

* removes obsolete code for acolytes_survived

* uses a better query

* corrects var name

* uses actual sql queries

* adds commit column and connected checks before queries
2017-05-26 22:17:44 +02:00
Jordie0608
7f09db7672 adds round id to ban table 2017-05-26 20:12:32 +10:00
Jordie
a823a1b698 Player byond account age stored in db (#26425)
set_client_age_from_db() and sync_client_with_db() have been merged. 
New clients are now added to the user table in a separate query than the one used to update their details upon connection; their player and account age is then calculated with DATEDIFF.
The code and regex used in findJoinDate() was changed a bit.
2017-05-04 20:13:35 -03:00
Jordie
cdce692c32 Update database_changelog.txt 2017-03-16 23:09:38 +11:00
Jordie
127d1f6daf Combines legacy_population and sanitizes death queries (#24914)
* combines admin and player pop count and sanitizes death queries

* renames proc

* removes proc call to sql_poll_admins

* add tox- clone- and staminaloss to death table

* adds ip and port to legacy_population

* null ip and cid handling for bans

* sans colons
2017-03-16 13:01:52 +01:00
Jordie
601d0f4a68 Rework of queries to address mysql bug (#24704)
* rework of queries to address mysql bug

* minor change
2017-03-07 10:52:43 +01:00
Jordie
fe42f623dc more query fixes 2017-03-03 17:21:19 +11:00
Jordie0608
97733d8dcf fixes poll_question 2017-02-27 23:58:18 +11:00
Jordie
72a93bae7d Continues to add default sql indexes and table optimisations (#24456)
* adds default sql indexes and table optimisations

* fixes warnings

* edits to text and better update queries

* wrong table

* superior copypaste skills

* who has

* names

* that long

* add inet

* fix for badmins giving 2 billion brainloss

* fixes rank name and adds sanitizing
2017-02-27 22:44:26 +11:00
oranges
17a7c01e36 Revert "Adds default sql indexes and table optimisations" 2017-02-21 17:53:41 +13:00
Jordie
62da82fcd9 Adds default sql indexes and table optimisations (#24277)
* adds default sql indexes and table optimisations

* fixes warnings
2017-02-21 09:49:48 +13:00
Jordie
4a1adbad5f Unifed SQL message system (#23327)
* unifed sql message system to supersede notes, watchlist and memos and adds messages

* a neserseree change
2017-02-03 00:02:24 -06:00