Overhauled permissions to use permission nodes, and separated some
permissions into smaller ones (such as cfg into tshock.cfg.maxspawns,
tshock.cfg.spawnrate, etc),
Added BanningUser, Date(of ban), and Expiration to the db
On join, Expiration is checked, if ban is expired we remove it and the user is allowed on.
When running the ban command, your UAN is used as the banning user, and the date is that moment, with no expiration.
#531
Currently, this is an extremely complex looking field in the config file now. I don't think we should add a placeholder tho as servers wouldn't realize they had a rest token there. Perhaps when we do a dump of the config file, someone can add the format for this field.
Closes#520
-Added REST endpoint "/v2/server/restart".
-Added REST endpoint "/v2/server/reload".
-Added REST endpoint "/v3/server/rawcmd", will output all returned lines as an array instead.
-Added "uptime", "serverpassword", "rules/ServerSideInventory" fields to REST endpoint "/v2/server/status".
-REST requests are now logged.
-Endpoint "/v2/server/rawcmd" does now check whether the user has the sufficient permission to execute the command.
-Fixed Config.EnableTokenEndpointAuthentication not working properly before.
-Removed obsolete "api" permission (only "restapi" now).
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
Added TotalPermissions method to get the combined total permissions as used for HasPermissions
Added totalpermissions to output of /v2/group/read output in RestAPI
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
- /v2/token/password?username={user}
TSHOCKPLUGINS-1 #resolve #time 5m #comment Deprecating old token create syntax, new endpoint added as a replacement.