From ad4dbdad6d4becdc03b85e4042deb61f85ded178 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Fri, 20 Mar 2020 19:57:00 +0900 Subject: [PATCH] Fix the PermissionJsonConverter --- .../JsonConverters/PermissionJsonConverter.cs | 2 +- .../Security/APIKeys/APIKeyAuthorizationHandler.cs | 1 + BTCPayServer/Views/Manage/AddApiKey.cshtml | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/BTCPayServer.Client/JsonConverters/PermissionJsonConverter.cs b/BTCPayServer.Client/JsonConverters/PermissionJsonConverter.cs index 26bf1eace..663fff089 100644 --- a/BTCPayServer.Client/JsonConverters/PermissionJsonConverter.cs +++ b/BTCPayServer.Client/JsonConverters/PermissionJsonConverter.cs @@ -20,7 +20,7 @@ namespace BTCPayServer.Client.JsonConverters return null; if (reader.TokenType != JsonToken.String) throw new JsonObjectException("Type 'Permission' is expected to be a 'String'", reader); - if (reader.ReadAsString() is String s && Permission.TryParse(s, out var permission)) + if (reader.Value is String s && Permission.TryParse(s, out var permission)) return permission; throw new JsonObjectException("Invalid 'Permission' String", reader); } diff --git a/BTCPayServer/Security/APIKeys/APIKeyAuthorizationHandler.cs b/BTCPayServer/Security/APIKeys/APIKeyAuthorizationHandler.cs index a4306ff37..2b5b147e0 100644 --- a/BTCPayServer/Security/APIKeys/APIKeyAuthorizationHandler.cs +++ b/BTCPayServer/Security/APIKeys/APIKeyAuthorizationHandler.cs @@ -38,6 +38,7 @@ namespace BTCPayServer.Security.APIKeys { case Policies.CanModifyProfile: case Policies.CanViewProfile: + case Policies.Unrestricted: success = context.HasPermission(Permission.Create(requirement.Policy)); break; diff --git a/BTCPayServer/Views/Manage/AddApiKey.cshtml b/BTCPayServer/Views/Manage/AddApiKey.cshtml index a44b3b16b..8c1866aed 100644 --- a/BTCPayServer/Views/Manage/AddApiKey.cshtml +++ b/BTCPayServer/Views/Manage/AddApiKey.cshtml @@ -56,16 +56,16 @@ } else if (Model.StoreMode == ManageController.AddApiKeyViewModel.ApiKeyStoreMode.Specific) { -
  • +
    @Model.StoreManagementSelectivePermission.Title
    @Model.StoreManagementSelectivePermission.Description -
  • + @if (!Model.Stores.Any()) { -
  • +
    You currently have no stores configured. -
  • + } @for (var index = 0; index < Model.SpecificStores.Count; index++) {