mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 18:11:36 +01:00
29 lines
860 B
C#
29 lines
860 B
C#
using BTCPayServer.Client;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
namespace BTCPayServer.Security
|
|
{
|
|
public static class ServerPolicies
|
|
{
|
|
public static AuthorizationOptions AddBTCPayPolicies(this AuthorizationOptions options)
|
|
{
|
|
foreach (var p in Policies.AllPolicies)
|
|
{
|
|
options.AddPolicy(p);
|
|
}
|
|
options.AddPolicy(Policies.CanModifyStoreSettingsUnscoped);
|
|
options.AddPolicy(CanGetRates.Key);
|
|
return options;
|
|
}
|
|
|
|
public static void AddPolicy(this AuthorizationOptions options, string policy)
|
|
{
|
|
options.AddPolicy(policy, o => o.AddRequirements(new PolicyRequirement(policy)));
|
|
}
|
|
public class CanGetRates
|
|
{
|
|
public const string Key = "btcpay.store.cangetrates";
|
|
}
|
|
}
|
|
}
|