Skip to content

Commit

Permalink
Restrict wallet edition and moving funds out of wallets to Finance Ma…
Browse files Browse the repository at this point in the history
…nagers
  • Loading branch information
Jossec101 committed Nov 8, 2024
1 parent d3cbf59 commit b95238e
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/Pages/Wallets.razor
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
@ref="_walletsDataGrid"
@bind-SelectedRow="_selectedWallet"
Data="_wallets"
Editable="@_isFinanceManager"
Editable="true"
EditMode="DataGridEditMode.Popup"
Responsive="true"
ResizeMode="TableResizeMode.Columns"
Expand All @@ -55,8 +55,7 @@
<DataGridColumns>
<DataGridCommandColumn TItem="Wallet">
<NewCommandTemplate>
@if (_isFinanceManager)
{
<AuthorizeView Roles="Superadmin,FinanceManager">
<Dropdown>
<DropdownToggle Color="Color.Primary">
</DropdownToggle>
Expand All @@ -67,19 +66,20 @@

</DropdownMenu>
</Dropdown>
}

</AuthorizeView>
</NewCommandTemplate>
<EditCommandTemplate>
<Dropdown @onclick:stopPropagation="true">
<DropdownToggle Color="Color.Primary">
</DropdownToggle>
<DropdownMenu>
<AuthorizeView Roles="Superadmin,FinanceManager">
<DropdownItem Clicked="context.Clicked">Edit</DropdownItem>

Check failure on line 77 in src/Pages/Wallets.razor

View workflow job for this annotation

GitHub Actions / build-and-test

'AuthenticationState' does not contain a definition for 'Clicked' and no accessible extension method 'Clicked' accepting a first argument of type 'AuthenticationState' could be found (are you missing a using directive or an assembly reference?)
<DropdownItem Disabled="!context.Item.IsFinalised || context.Item.IsWatchOnly" Clicked="@(() => ShowTransferFundsModal(context.Item))">Transfer funds</DropdownItem>

Check failure on line 78 in src/Pages/Wallets.razor

View workflow job for this annotation

GitHub Actions / build-and-test

'AuthenticationState' does not contain a definition for 'Item' and no accessible extension method 'Item' accepting a first argument of type 'AuthenticationState' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 78 in src/Pages/Wallets.razor

View workflow job for this annotation

GitHub Actions / build-and-test

'AuthenticationState' does not contain a definition for 'Item' and no accessible extension method 'Item' accepting a first argument of type 'AuthenticationState' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 78 in src/Pages/Wallets.razor

View workflow job for this annotation

GitHub Actions / build-and-test

'AuthenticationState' does not contain a definition for 'Item' and no accessible extension method 'Item' accepting a first argument of type 'AuthenticationState' could be found (are you missing a using directive or an assembly reference?)
</AuthorizeView>

<DropdownItem Clicked="context.Clicked">Edit</DropdownItem>
<DropdownItem Disabled="!context.Item.IsFinalised" Clicked="@(() => LoadAndOpenDetailsModal(context.Item))">Details</DropdownItem>
<DropdownItem Disabled="!context.Item.IsFinalised" Clicked="@(() => LoadAndOpenModalTextModalUnusedAddress(context.Item))">Get address</DropdownItem>
<DropdownItem Disabled="!context.Item.IsFinalised || context.Item.IsWatchOnly" Clicked="@(() => ShowTransferFundsModal(context.Item))">Transfer funds</DropdownItem>
<DropdownItem Disabled="!context.Item.IsFinalised" Clicked="@(() => RescanWallet(context.Item))">Rescan wallet</DropdownItem>
<DropdownItem Disabled="!context.Item.IsFinalised" Clicked="@(() => LoadAndOpenExportOutputDescriptor(context.Item))">Export output descriptor</DropdownItem>

Expand Down Expand Up @@ -784,8 +784,6 @@
private Modal _finaliseModalRef;
private Wallet? _selectedWalletToFinalise;
private bool _isFinanceManager = false;
private decimal _btcPrice;
private Check<bool> _hotWalletCheckComponent;
Expand Down Expand Up @@ -862,10 +860,6 @@
}
if (LoggedUser != null)
{
if (ClaimsPrincipal.IsInRole(ApplicationUserRole.FinanceManager.ToString()))
{
_isFinanceManager = true;
}
await GetData();
}
}
Expand Down

0 comments on commit b95238e

Please sign in to comment.