From a91949a60ae9fa20450ea1a0c9fb402f32d5dfa2 Mon Sep 17 00:00:00 2001 From: Zack Piispanen Date: Sun, 15 Apr 2012 15:51:33 -0400 Subject: [PATCH] Rest api now has a permission, Permissions.restapi. However, the string attached to the permission is "api" for backwards compatability. We should give server owners and plugin devs a notice and change it to "restapi" in a few days/weeks. --- TShockAPI/Permissions.cs | 6 ++++++ TShockAPI/TShock.cs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/TShockAPI/Permissions.cs b/TShockAPI/Permissions.cs index beffceb0..2450aa53 100644 --- a/TShockAPI/Permissions.cs +++ b/TShockAPI/Permissions.cs @@ -164,12 +164,18 @@ namespace TShockAPI [Description("User can save all the players SSI state.")] public static readonly string savessi; + [Description("User can use rest api calls.")] + public static readonly string restapi; + static Permissions() { foreach (var field in typeof (Permissions).GetFields()) { field.SetValue(null, field.Name); } + + //Backwards compatability. + restapi = "api"; } private static List GetCommands(string perm) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 7fd56bb5..97727cfb 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -256,7 +256,7 @@ namespace TShockAPI {Error = "Invalid username/password combination provided. Please re-submit your query with a correct pair."}; } - if (!Utils.GetGroup(userAccount.Group).HasPermission("api") && userAccount.Group != "superadmin") + if (!Utils.GetGroup(userAccount.Group).HasPermission(Permissions.restapi) && userAccount.Group != "superadmin") { return new RestObject("403") {