From 93b52fbdb392a56d940a89072a8627a31d96606e Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Wed, 2 Feb 2022 20:24:22 +0900 Subject: [PATCH] Redirect on 403 page rather than crashing if permission missing --- BTCPayServer/Controllers/UIInvoiceController.UI.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/BTCPayServer/Controllers/UIInvoiceController.UI.cs b/BTCPayServer/Controllers/UIInvoiceController.UI.cs index ab47cdb6c..9a1ccdd29 100644 --- a/BTCPayServer/Controllers/UIInvoiceController.UI.cs +++ b/BTCPayServer/Controllers/UIInvoiceController.UI.cs @@ -406,7 +406,7 @@ namespace BTCPayServer.Controllers } [HttpPost("invoices/{invoiceId}/archive")] - [Authorize(AuthenticationSchemes = AuthenticationSchemes.Cookie)] + [Authorize(AuthenticationSchemes = AuthenticationSchemes.Cookie, Policy = Policies.CanViewInvoices)] [BitpayAPIConstraint(false)] public async Task ToggleArchive(string invoiceId) { @@ -430,6 +430,7 @@ namespace BTCPayServer.Controllers } [HttpPost] + [Authorize(AuthenticationSchemes = AuthenticationSchemes.Cookie, Policy = Policies.CanViewInvoices)] public async Task MassAction(string command, string[] selectedItems, string? storeId = null) { if (selectedItems != null) @@ -812,7 +813,7 @@ namespace BTCPayServer.Controllers } [HttpGet] - [Authorize(AuthenticationSchemes = AuthenticationSchemes.Cookie)] + [Authorize(AuthenticationSchemes = AuthenticationSchemes.Cookie, Policy = Policies.CanViewInvoices)] [BitpayAPIConstraint(false)] public async Task Export(string format, string? searchTerm = null, int timezoneOffset = 0) { @@ -948,7 +949,7 @@ namespace BTCPayServer.Controllers [HttpPost] [Route("invoices/{invoiceId}/changestate/{newState}")] [Route("stores/{storeId}/invoices/{invoiceId}/changestate/{newState}")] - [Authorize(AuthenticationSchemes = AuthenticationSchemes.Cookie)] + [Authorize(AuthenticationSchemes = AuthenticationSchemes.Cookie, Policy = Policies.CanViewInvoices)] [BitpayAPIConstraint(false)] public async Task ChangeInvoiceState(string invoiceId, string newState) {