-Added REST per-endpoint permissions.

-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).
This commit is contained in:
CoderCow 2013-07-25 12:31:11 +02:00
parent 4e7b497ae4
commit 0ea83746cf
9 changed files with 415 additions and 237 deletions

View file

@ -759,13 +759,13 @@ namespace TShockAPI
}
}
public class TSRestPlayer : TSServerPlayer
public class TSRestPlayer : TSPlayer
{
internal List<string> CommandReturn = new List<string>();
internal List<string> CommandOutput = new List<string>();
public TSRestPlayer()
public TSRestPlayer(string playerName, Group playerGroup): base(playerName)
{
Group = new SuperAdminGroup();
Group = playerGroup;
AwaitingResponse = new Dictionary<string, Action<object>>();
}
@ -781,7 +781,7 @@ namespace TShockAPI
public override void SendMessage(string msg, byte red, byte green, byte blue)
{
CommandReturn.Add(msg);
this.CommandOutput.Add(msg);
}
public override void SendInfoMessage(string msg)
@ -806,7 +806,7 @@ namespace TShockAPI
public List<string> GetCommandOutput()
{
return CommandReturn;
return this.CommandOutput;
}
}