Commit graph

1886 commits

Author SHA1 Message Date
stevenh
41dbd31aac Converted all files to LF line endings 2012-02-21 15:56:34 +00:00
stevenh
3890a82b0e Fixed missing SaveManager.cs from project file fixes #401 2012-02-21 14:38:36 +00:00
stevenh
988bc4198b Server either console can now kick and ban players regardless of the players immune permissions which fixes #391
Refactored Utils ForceKick to call Kick so we have one core method with all the logic in
Added missing params to docs for Kick and Ban
2012-02-21 01:07:41 +00:00
stevenh
aeab6d9e45 Fix for getting Mythical prefix by name fixes #374
Also optimised processing so it only does one pass instead of two as well as minimising string manipulation functions
2012-02-21 00:19:50 +00:00
stevenh
d34199b17d Refactored server stop and world save operations fixing race conditions so as to ensure operations always happen in a predicable order. This fixes output not appearing in the console / log for example. This adds TShock.Utils.StopServer method used by IGA, rcon and the RestAPI.
Fixed console title set not working

Optimised command line parsing

Made Utils a singleton to enforce the fact that only one copy should ever exist

Added name to /v2/user/read output as users can be found by id
2012-02-20 22:31:16 +00:00
stevenh
84789ff4d5 Fixed GetUser not locating users by ID and hence GetUserById not working either, fixes #395 2012-02-20 21:44:25 +00:00
stevenh
a3e838c1ce Updated HttpServer to latest head + a fix for Connection: TE which was causing all RestAPI calls from TE supporting clients to fail 2012-02-20 11:10:48 +00:00
stevenh
4c09e7b66f Potential fix for #390 fixing the return of group.Permissions listing permissions as negated permissions
Added TotalPermissions method to get the combined total permissions as used for HasPermissions
Added totalpermissions to output of /v2/group/read output in RestAPI
2012-02-20 10:58:46 +00:00
stevenh
1bc785f398 Fixes #392 making user group changes take effect on active players instantly 2012-02-20 10:56:06 +00:00
k0rd
48c59a8914 Merge pull request #389 from k0rd/general-devel
support changing group and deleting usernames containing a DOT character

add gems and demonite to /genore command
2012-02-17 00:06:28 -08:00
k0rd
bc2fdf3eab add gems and demonite to genore 2012-02-17 03:12:10 -05:00
k0rd
a79b346d3c support group modification and deleting usernames containing a DOT (.) 2012-02-16 23:00:22 -05:00
Lucas Nicodemus
c93ecc6db4 Merge pull request #388 from stevenh/general-devel
RestAPI bug fix, new endpoints, cleanup & test suite
2012-02-16 05:54:01 -08:00
stevenh
a1d3132138 Added full test suite for RestAPI 2012-02-16 12:33:10 +00:00
stevenh
dee2c1a9f4 Refactored output processing to always return RestObject's
Refactored method names to be consistent with function e.g. Off -> ServerOff

Added new endpoints:-
/v2/server/status - Status query including player and rules matching common query tool requirements such as qstat. The json returned uses native types e.g. int's where possible
/v2/groups/list - Lists groups
/v2/groups/read - Query group detail
/v2/groups/destroy - Remove a group
/v2/groups/create - Create a group
/v2/players/list - Lists players including basic details
/v2/users/create - Create a user
/v2/users/list - Lists users basic user details applying a filter if specified.

Refactored missing parameter and error handling to use common utility methods RestError, RestMissingParam which ensures consistency across all functions and protects against null object references

Removed maxplayers from /status to ensure 100% compatibility, this and more details can be found in the new end point /v2/server/status

Protected against null names in user/activelist

Refactored variable checks to use string.IsNullOrWhiteSpace where applicable to capture errors early in the RestAPI

Added the ability to location users by "id" matching the underlying API.

Refactored locating players, bans & users to utility methods to ensure consitency across the api and eliminate duplicate code making for easier maintainence

NOTE: Duplicate and invalid DB entries currently can still be made if the DB format hasn't been updated to with missing unique and not null constaints

Removed { RequiresToken = true } from RestCommand constructors as this is the default anyway.

Optimised function calls so that tests are processed sequentially avoiding unnessasary operations in failure cases

Cleaned up formatting ensuring consistent line endings, indentation and single line if layout

Fixed ServerCommand duplicate key issue for multi line returns, now uses a single "response" string with embeded newlines

Fixed PlayerKill output using verb instead of parameters for "from" option
2012-02-16 12:03:08 +00:00
stevenh
c258406bcb Added parameterless constructor for RestObject required for JavaScriptSerializer.Deserialize 2012-02-16 12:01:02 +00:00
stevenh
5d4e210a26 Removed EnableBanOnUsernames code from FindBanTest as its no longer applicable 2012-02-16 11:51:10 +00:00
Steven Hartland
14436eb22a Merge pull request #387 from stevenh/d862d7922e9e0f70d912519d05e42c2b0c3dfc93
Groups, Permissions, Ban logic fixes
2012-02-16 03:50:22 -08:00
stevenh
d862d7922e Added better support for detection of duplicate users
Corrected and enhanced exception message for GetUser
2012-02-16 11:30:44 +00:00
stevenh
098363a9cc Fixed internal object and DB inconsitencies for modified default groups
Fixed console errors for failed parent dependencies of default groups that already exist caused by fb11729547 consistency fixes

Made GroupManager.groups readonly to discourage overwriting it. Could still do with better encapsulation to prevent consistency problems if modified externally.

Added UpdateGroup method to GroupManager

Refactored Group handling of permissions and chatcolor to prevent inconsistent data
Notably:-
* AddPermission now does the right thing when passed the string "!permission"
* Converted ChatColor from method to getter / setter

Added RemovePermission to Group

Refactored GroupManager Permissions handling to ensure consistent data between DB and internal objects

Removed redundent AddGroup method in preference to a default value on the main method

Correct some tabs vs spaces

Added ParentName helper to Group

Fixed inverted parameters to error "Invalid parent {0} for group {1}"
2012-02-16 11:23:39 +00:00
stevenh
0108795f27 Fixed broken Content-Type header, was adding to text/html instead of replacing it
Added Server header to RestAPI responses
2012-02-16 11:14:52 +00:00
stevenh
2f7cb9f44e Added exception handling option to AddBan & Remove Ban
Fixed formatting of EnsureExists(table) block
2012-02-16 11:11:30 +00:00
stevenh
2f3bfca082 Fixed how ban logic works so it matches the description of the variables EnableBanOnUsernames & EnableIPBans
Now it doesn't prevent bans being created or found but it only actions kicks on join based on the relavent config options.

Changed /unban <player> to only work on names and /unbanip <ip> to only work on ip's to avoid user confusion

Changed error message returned when no bans are found when actioning /unban <player> & /unbanip <ip> to be more appropriate

Fixed formatting of -maxplayers / -players block
2012-02-16 11:08:53 +00:00
Lucas Nicodemus
2c8c5dc7b9 Update TShockAPI/TShock.cs 2012-02-15 16:06:39 -07:00
Lucas Nicodemus
9680beccd2 Merge pull request #386 from k0rd/general-devel
Noclip detection exemptions for liquids
2012-02-15 06:56:11 -08:00
Steven Hartland
ab543de5ac Merge pull request #382 from stevenh/75f3fe454827b2905d91ac8b41e49ba03f0bc96e
Disabled EnableBanOnUsernames test on Bans
2012-02-15 03:35:33 -08:00
k0rd
fa0e02eb09 fix for noclip detection sometimes being activated by liquids 2012-02-14 18:39:43 -05:00
stevenh
75f3fe4548 Disabled EnableBanOnUsernames test on Bans as this is currently expected behavour 2012-02-14 11:08:29 +00:00
Lucas Nicodemus
d3c1224ee7 Merge pull request #377 from stevenh/upstream
A number of small commits required for RestAPI fixes / enhancments
2012-02-13 16:54:29 -08:00
stevenh
6d08fef275 Fixed missing UNIQUE constraints when using SQLite
Fixed missing NOT NULL constaints when using MySQL
2012-02-13 23:44:58 +00:00
stevenh
78cc7a6f75 Added the ability to delete a ban by name in the same way as a user 2012-02-13 22:38:04 +00:00
stevenh
ce5c659e89 Moved RestApi initialisation to main Initialise method so its available early. This helps tools detect a server during its timeconsuming startup. Additional threading may be required to ensure timely responses during high load periods 2012-02-13 22:23:01 +00:00
stevenh
e5a078957f Added default for status = 200 on RestObject constructor 2012-02-13 22:23:01 +00:00
stevenh
c7a9ee32cd Added ChatColor helper to Group useful for output methods 2012-02-13 22:23:01 +00:00
stevenh
c5497acae7 Check for null in FindPlayer to avoid errors on null object 2012-02-13 22:23:01 +00:00
stevenh
fb11729547 Added IEnumerable support to GroupManager to facilitate RestAPI listing groups
Added optional exceptions parameter to AddGroup and DeleteGroup to faciliate RestAPI group manipulation. This changes the behaviour of these methods to throw an exception on error instead of returning an error string.
Corrected internal lists from being updated in failed DB updates in DeleteGroup and AddGroup
Added doc for chatcolor on AddGroup
2012-02-13 22:23:01 +00:00
stevenh
4daa9add13 Added GetUsers method mirroring GetBans to enable RestAPI to provide a full users list as well as an active one 2012-02-13 22:23:01 +00:00
stevenh
46f5f872ae Moved local exceptions outside of try block in AddUser so the calling code gets the original exception and not a generic one
Also added details of the SQL exception message into the message of the UserManagerException so its easier to determine the actual error when the exception message is returned / printed out
2012-02-13 22:23:01 +00:00
stevenh
0c13716b84 Removed TShock.Config.EnableBanOnUsernames check from GetBanByName so that it can be used internally for queries 2012-02-13 22:20:44 +00:00
Will
862a06e820 Merge pull request #376 from k0rd/bugfix-devel
-maxplayers and -players override ; added hallowed vines and plants to /removespecial
2012-02-13 10:44:10 -08:00
k0rd
3641c3ca87 Consider command line parameters when /reload command is issued 2012-02-12 23:56:49 -05:00
k0rd
d478810336 -maxplayers or -players cl argument should override config
additions to /removespecial
2012-02-12 15:27:23 -05:00
Lucas Nicodemus
3bbfa1b434 Merge pull request #366 from k0rd/general-devel
replace pearlsand/ebonsand with sand, not a tile type that doesn't exist
2012-02-09 22:33:33 -08:00
k0rd
b84e27436c fixes crash on saving world with /removespecial 2012-02-10 01:40:05 -05:00
Lucas Nicodemus
6cb6e19f23 REST endpoint /lists/bans is now /v2/lists/bans
Added REST endpoint /v2/lists/players - JSON list of players
Deprecated REST endpoint /lists/players
2012-02-09 22:43:54 -07:00
Lucas Nicodemus
454403d495 Added /lists/bans REST endpoint - Returns a JSON list of bans 2012-02-09 22:20:36 -07:00
Lucas Nicodemus
5cdd537ebd /v2/players/kick no longer 500s if a player name isn't specified.
Fixes #361
2012-02-09 21:48:37 -07:00
Lucas Nicodemus
ee20946cdd REST endpoint /v2/users/activelist now null checks and works with 0 players.
Fixes #362
2012-02-09 21:43:35 -07:00
Lucas Nicodemus
d72dc36580 Merge pull request #360 from k0rd/general-devel
(REST) add max slots to /status
2012-02-07 21:51:52 -08:00
k0rd
16b3e51b4b (REST) add max slots to /status 2012-02-08 00:56:45 -05:00