mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 22:44:29 +01:00
Fix build
This commit is contained in:
@@ -20,7 +20,7 @@ using BTCPayServer.Security.Bitpay;
|
|||||||
namespace BTCPayServer.Controllers
|
namespace BTCPayServer.Controllers
|
||||||
{
|
{
|
||||||
[EnableCors(CorsPolicies.All)]
|
[EnableCors(CorsPolicies.All)]
|
||||||
[Authorize(Policy = Policies.CanGetRates.Key, AuthenticationSchemes = Security.AuthenticationSchemes.Bitpay)]
|
[Authorize(Policy = ServerPolicies.CanGetRates.Key, AuthenticationSchemes = Security.AuthenticationSchemes.Bitpay)]
|
||||||
public class RateController : Controller
|
public class RateController : Controller
|
||||||
{
|
{
|
||||||
public StoreData CurrentStore
|
public StoreData CurrentStore
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ namespace BTCPayServer.Controllers.RestApi.Users
|
|||||||
if (anyAdmin && request.IsAdministrator is true && !isAuth)
|
if (anyAdmin && request.IsAdministrator is true && !isAuth)
|
||||||
return Forbid(AuthenticationSchemes.ApiKey);
|
return Forbid(AuthenticationSchemes.ApiKey);
|
||||||
// You are de-facto admin if there is no other admin, else you need to be auth and pass policy requirements
|
// You are de-facto admin if there is no other admin, else you need to be auth and pass policy requirements
|
||||||
bool isAdmin = anyAdmin ? (await _authorizationService.AuthorizeAsync(User, null, new PolicyRequirement(Permission.CanModifyServerSettings))).Succeeded
|
bool isAdmin = anyAdmin ? (await _authorizationService.AuthorizeAsync(User, null, new PolicyRequirement(Policies.CanModifyServerSettings))).Succeeded
|
||||||
&& isAuth
|
&& isAuth
|
||||||
: true;
|
: true;
|
||||||
// You need to be admin to create an admin
|
// You need to be admin to create an admin
|
||||||
@@ -97,7 +97,7 @@ namespace BTCPayServer.Controllers.RestApi.Users
|
|||||||
if (!isAdmin && policies.LockSubscription)
|
if (!isAdmin && policies.LockSubscription)
|
||||||
{
|
{
|
||||||
// If we are not admin and subscriptions are locked, we need to check the Policies.CanCreateUser.Key permission
|
// If we are not admin and subscriptions are locked, we need to check the Policies.CanCreateUser.Key permission
|
||||||
var canCreateUser = (await _authorizationService.AuthorizeAsync(User, null, new PolicyRequirement(Permission.CanCreateUser))).Succeeded;
|
var canCreateUser = (await _authorizationService.AuthorizeAsync(User, null, new PolicyRequirement(Policies.CanCreateUser))).Succeeded;
|
||||||
if (!isAuth || !canCreateUser)
|
if (!isAuth || !canCreateUser)
|
||||||
return Forbid(AuthenticationSchemes.ApiKey);
|
return Forbid(AuthenticationSchemes.ApiKey);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ using BTCPayServer.Client;
|
|||||||
|
|
||||||
namespace BTCPayServer.Controllers
|
namespace BTCPayServer.Controllers
|
||||||
{
|
{
|
||||||
[Authorize(Policy = Policies.CanModifyServerSettings,
|
[Authorize(Policy = BTCPayServer.Client.Policies.CanModifyServerSettings,
|
||||||
AuthenticationSchemes = BTCPayServer.Security.AuthenticationSchemes.Cookie)]
|
AuthenticationSchemes = BTCPayServer.Security.AuthenticationSchemes.Cookie)]
|
||||||
public partial class ServerController : Controller
|
public partial class ServerController : Controller
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -367,7 +367,7 @@ namespace BTCPayServer.Controllers
|
|||||||
|
|
||||||
private async Task<bool> CanUseHotWallet()
|
private async Task<bool> CanUseHotWallet()
|
||||||
{
|
{
|
||||||
var isAdmin = (await _authorizationService.AuthorizeAsync(User, Permission.CanModifyServerSettings)).Succeeded;
|
var isAdmin = (await _authorizationService.AuthorizeAsync(User, Policies.CanModifyServerSettings)).Succeeded;
|
||||||
if (isAdmin)
|
if (isAdmin)
|
||||||
return true;
|
return true;
|
||||||
var policies = await _settingsRepository.GetSettingAsync<PoliciesSettings>();
|
var policies = await _settingsRepository.GetSettingAsync<PoliciesSettings>();
|
||||||
|
|||||||
Reference in New Issue
Block a user