mirror of
https://github.com/aljazceru/BTCPayServerPlugins.git
synced 2025-12-18 16:14:25 +01:00
fix perms on plugins
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
@using System.Threading
|
||||
@using BTCPayServer.Abstractions.Extensions
|
||||
@using BTCPayServer.Client
|
||||
@using BTCPayServer.Data
|
||||
@using BTCPayServer.Payments
|
||||
@using BTCPayServer.PayoutProcessors
|
||||
@@ -10,6 +11,7 @@
|
||||
@using NBitcoin
|
||||
@implements IAsyncDisposable;
|
||||
|
||||
|
||||
@code {
|
||||
private BringinService.BringinStoreSettings? _settings;
|
||||
private bool _isLoaded = false;
|
||||
@@ -23,6 +25,7 @@
|
||||
[Inject] private BTCPayNetworkProvider BTCPayNetworkProvider { get; set; }
|
||||
[Inject] private IHttpClientFactory HttpClientFactory { get; set; }
|
||||
[Inject] private PayoutProcessorService PayoutProcessorService { get; set; }
|
||||
[Inject] private IAuthorizationService AuthorizationService { get; set; }
|
||||
[Parameter] public string StoreId { get; set; }
|
||||
private decimal? LastFiatBalance { get; set; }
|
||||
private DateTimeOffset? LastDataFetch { get; set; }
|
||||
@@ -66,11 +69,13 @@
|
||||
}
|
||||
|
||||
private bool _editMode;
|
||||
private bool _readOnly;
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
_readOnly = !(await AuthorizationService.AuthorizeAsync(HttpContextAccessor.HttpContext.User, StoreId, Policies.CanModifyStoreSettings )).Succeeded;
|
||||
OnboardLink = LinkGenerator.GetUriByAction(HttpContextAccessor.HttpContext, "Onboard", "Bringin", new {StoreId});
|
||||
PmiLink = $"A payout processor has not been configured for this payment method. Payouts generated by Bringin will not be automatically handled. <a href=\"{LinkGenerator.GetUriByAction(HttpContextAccessor.HttpContext, "ConfigureStorePayoutProcessors", "UIPayoutProcessors", new {StoreId})}\">Configure now</a>";
|
||||
_callbackLink = LinkGenerator.GetUriByAction(HttpContextAccessor.HttpContext, "Callback", "Bringin", new {StoreId});
|
||||
@@ -338,31 +343,34 @@
|
||||
|
||||
</h4>
|
||||
|
||||
<div class="d-flex gap-2">
|
||||
@if (_manualOrder)
|
||||
{
|
||||
<button class="btn btn-sm btn-outline-secondary" @onclick="CancelManual" disabled="@_saving">Cancel order</button>
|
||||
}
|
||||
else if (_settings is not null && !EditMode)
|
||||
{
|
||||
<button class="btn btn-link" @onclick="Edit">Edit</button>
|
||||
<button class="btn btn-link" @onclick="CreateManual">Manual order</button>
|
||||
}
|
||||
else if (_settings is not null && EditMode)
|
||||
{
|
||||
if (ApiKeyError)
|
||||
@if (!_readOnly)
|
||||
{
|
||||
<div class="d-flex gap-2">
|
||||
@if (_manualOrder)
|
||||
{
|
||||
<button class="btn btn-sm btn-outline-secondary" @onclick="TestApiKey" disabled="@_saving">Test API Key</button>
|
||||
<button class="btn btn-sm btn-outline-secondary" @onclick="CancelManual" disabled="@_saving">Cancel order</button>
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(_settings.ApiKey) && !ApiKeyError)
|
||||
else if (_settings is not null && !EditMode)
|
||||
{
|
||||
<button class="btn btn-sm btn-primary" @onclick="Save" disabled="@_saving">Save</button>
|
||||
<button class="btn btn-link" @onclick="Edit">Edit</button>
|
||||
<button class="btn btn-link" @onclick="CreateManual">Manual order</button>
|
||||
}
|
||||
else if (_settings is not null && EditMode)
|
||||
{
|
||||
if (ApiKeyError)
|
||||
{
|
||||
<button class="btn btn-sm btn-outline-secondary" @onclick="TestApiKey" disabled="@_saving">Test API Key</button>
|
||||
}
|
||||
|
||||
<button class="btn btn-sm btn-outline-secondary" @onclick="CancelEdit" disabled="@_saving">Cancel edit</button>
|
||||
}
|
||||
</div>
|
||||
if (!string.IsNullOrEmpty(_settings.ApiKey) && !ApiKeyError)
|
||||
{
|
||||
<button class="btn btn-sm btn-primary" @onclick="Save" disabled="@_saving">Save</button>
|
||||
}
|
||||
|
||||
<button class="btn btn-sm btn-outline-secondary" @onclick="CancelEdit" disabled="@_saving">Cancel edit</button>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</header>
|
||||
|
||||
|
||||
@@ -371,9 +379,13 @@
|
||||
<p class="text-secondary my-3">
|
||||
Bringin is a service that allows you to automatically convert your BTC to EUR and send it to your bank account. Start configuring it by clicking on the button below.
|
||||
</p>
|
||||
<div class="d-flex">
|
||||
<button class="btn btn-lg btn-outline-primary" @onclick="Edit">Configure</button>
|
||||
</div>
|
||||
|
||||
@if (!_readOnly)
|
||||
{
|
||||
<div class="d-flex">
|
||||
<button class="btn btn-lg btn-outline-primary" @onclick="Edit">Configure</button>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
else if (_manualOrder)
|
||||
{
|
||||
@@ -439,7 +451,7 @@
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else if (!EditMode)
|
||||
else if (!EditMode || _readOnly)
|
||||
{
|
||||
@if (LastFiatBalance is not null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user