mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-01-18 21:32:27 +01:00
[Greenfield] Send forbid 403 rather than empty results on /api/v1/stores (#3215)
This commit is contained in:
parent
163d1a195d
commit
c68141119c
@ -656,6 +656,8 @@ namespace BTCPayServer.Tests
|
||||
await user.CreateClient(Permission.Create(Policies.CanViewStoreSettings, user.StoreId).ToString());
|
||||
Assert.Single(await scopedClient.GetStores());
|
||||
|
||||
var noauth = await user.CreateClient(Array.Empty<string>());
|
||||
await AssertAPIError("missing-permission", () => noauth.GetStores());
|
||||
|
||||
// We strip the user's Owner right, so the key should not work
|
||||
using var ctx = tester.PayTester.GetService<Data.ApplicationDbContextFactory>().CreateContext();
|
||||
|
@ -94,6 +94,8 @@ namespace BTCPayServer.Security.GreenField
|
||||
if (context.HasPermission(Permission.Create(policy, store.Id), requiredUnscoped))
|
||||
permissionedStores.Add(store);
|
||||
}
|
||||
if (!requiredUnscoped && permissionedStores.Count is 0)
|
||||
break;
|
||||
_HttpContext.SetStoresData(permissionedStores.ToArray());
|
||||
success = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user