Fix the PermissionJsonConverter

This commit is contained in:
nicolas.dorier 2020-03-20 19:57:00 +09:00
parent 094307d688
commit ad4dbdad6d
No known key found for this signature in database
GPG Key ID: 6618763EF09186FE
3 changed files with 6 additions and 5 deletions

View File

@ -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);
}

View File

@ -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;

View File

@ -56,16 +56,16 @@
}
else if (Model.StoreMode == ManageController.AddApiKeyViewModel.ApiKeyStoreMode.Specific)
{
<li class="list-group-item ">
<div class="list-group-item ">
<h5 class="mb-1">@Model.StoreManagementSelectivePermission.Title</h5>
<span class="form-text text-muted">@Model.StoreManagementSelectivePermission.Description</span>
<button type="submit" class="btn btn-link" name="command" value="change-store-mode">Give permission to all stores instead</button>
</li>
</div>
@if (!Model.Stores.Any())
{
<li class="list-group-item alert-warning">
<div class="list-group-item alert-warning">
You currently have no stores configured.
</li>
</div>
}
@for (var index = 0; index < Model.SpecificStores.Count; index++)
{