|
|
|
@ -3,67 +3,84 @@ |
|
|
|
@using Volo.Abp.PermissionManagement.Localization |
|
|
|
@inherits Volo.Abp.AspNetCore.Components.AbpComponentBase |
|
|
|
@inject AbpBlazorMessageLocalizerHelper<AbpPermissionManagementResource> LH |
|
|
|
|
|
|
|
<Modal @ref="Modal" Closing="@ClosingModal"> |
|
|
|
<ModalContent Size="ModalSize.ExtraLarge" Centered="true"> |
|
|
|
<ModalHeader> |
|
|
|
<ModalTitle>@L["ResourcePermissions"] - @ResourceDisplayName</ModalTitle> |
|
|
|
<ModalTitle>@L["ResourcePermissions"]</ModalTitle> |
|
|
|
<CloseButton Clicked="CloseModal" /> |
|
|
|
</ModalHeader> |
|
|
|
<ModalBody Overflow="Overflow.Hidden"> |
|
|
|
<div class="d-grid gap-2 mb-2 d-md-flex justify-content-md-end"> |
|
|
|
<Button Color="Color.Primary" size="Size.Small" Clicked="OpenCreateModalAsync">@L["AddResourcePermission"]</Button> |
|
|
|
</div> |
|
|
|
<DataGrid TItem="ResourcePermissionGrantInfoDto" |
|
|
|
Data="ResourcePermissionList.Permissions" |
|
|
|
TotalItems="ResourcePermissionList.Permissions.Count" |
|
|
|
ShowPager="true" |
|
|
|
PageSize="PageSize"> |
|
|
|
<DataGridColumns> |
|
|
|
<DataGridColumn |
|
|
|
Width="150px" |
|
|
|
Sortable="false" |
|
|
|
TItem="ResourcePermissionGrantInfoDto" |
|
|
|
Field="@nameof(ResourcePermissionGrantInfoDto.ProviderName)" |
|
|
|
Caption="@L["Actions"]"> |
|
|
|
<DisplayTemplate> |
|
|
|
<Dropdown> |
|
|
|
<DropdownToggle Color="Color.Primary"> |
|
|
|
@L["Actions"] |
|
|
|
</DropdownToggle> |
|
|
|
<DropdownMenu> |
|
|
|
<DropdownItem Clicked="() => OpenEditModalAsync(context)"> |
|
|
|
@L["Edit"] |
|
|
|
</DropdownItem> |
|
|
|
<DropdownItem Clicked="() => DeleteResourcePermissionAsync(context)"> |
|
|
|
@L["Delete"] |
|
|
|
</DropdownItem> |
|
|
|
</DropdownMenu> |
|
|
|
</Dropdown> |
|
|
|
</DisplayTemplate> |
|
|
|
</DataGridColumn> |
|
|
|
<DataGridColumn TItem="ResourcePermissionGrantInfoDto" Field="@nameof(ResourcePermissionGrantInfoDto.ProviderName)" Caption="@L["ResourcePermissionTarget"]" Sortable="false"> |
|
|
|
<DisplayTemplate> |
|
|
|
@{ |
|
|
|
<span class="d-inline-block bg-light rounded-pill px-2 me-1 ms-1 mb-1">@context.ProviderName</span> |
|
|
|
@context.ProviderDisplayName |
|
|
|
} |
|
|
|
</DisplayTemplate> |
|
|
|
</DataGridColumn> |
|
|
|
<DataGridColumn TItem="ResourcePermissionGrantInfoDto" Field="@nameof(ResourcePermissionGrantInfoDto.Permissions)" Caption="@L["ResourcePermissionPermissions"]" Sortable="false"> |
|
|
|
<DisplayTemplate> |
|
|
|
@{ |
|
|
|
foreach (var permission in context.Permissions) |
|
|
|
{ |
|
|
|
<span class="d-inline-block bg-light rounded-pill px-2 me-1 mb-1">@permission.DisplayName</span> |
|
|
|
@if(HasAnyResourcePermission && HasAnyResourceProviderKeyLookupService) |
|
|
|
{ |
|
|
|
<div class="d-grid gap-2 mb-2 d-md-flex justify-content-md-end"> |
|
|
|
<Button Color="Color.Primary" size="Size.Small" Clicked="OpenCreateModalAsync">@L["AddResourcePermission"]</Button> |
|
|
|
</div> |
|
|
|
<DataGrid TItem="ResourcePermissionGrantInfoDto" |
|
|
|
Data="ResourcePermissionList.Permissions" |
|
|
|
TotalItems="ResourcePermissionList.Permissions.Count" |
|
|
|
ShowPager="true" |
|
|
|
PageSize="PageSize"> |
|
|
|
<DataGridColumns> |
|
|
|
<DataGridColumn |
|
|
|
Width="150px" |
|
|
|
Sortable="false" |
|
|
|
TItem="ResourcePermissionGrantInfoDto" |
|
|
|
Field="@nameof(ResourcePermissionGrantInfoDto.ProviderName)" |
|
|
|
Caption="@L["Actions"]"> |
|
|
|
<DisplayTemplate> |
|
|
|
<Dropdown> |
|
|
|
<DropdownToggle Color="Color.Primary"> |
|
|
|
@L["Actions"] |
|
|
|
</DropdownToggle> |
|
|
|
<DropdownMenu> |
|
|
|
<DropdownItem Clicked="() => OpenEditModalAsync(context)"> |
|
|
|
@L["Edit"] |
|
|
|
</DropdownItem> |
|
|
|
<DropdownItem Clicked="() => DeleteResourcePermissionAsync(context)"> |
|
|
|
@L["Delete"] |
|
|
|
</DropdownItem> |
|
|
|
</DropdownMenu> |
|
|
|
</Dropdown> |
|
|
|
</DisplayTemplate> |
|
|
|
</DataGridColumn> |
|
|
|
<DataGridColumn TItem="ResourcePermissionGrantInfoDto" Field="@nameof(ResourcePermissionGrantInfoDto.ProviderName)" Caption="@L["ResourcePermissionTarget"]" Sortable="false"> |
|
|
|
<DisplayTemplate> |
|
|
|
@{ |
|
|
|
<span class="d-inline-block bg-light rounded-pill px-2 me-1 ms-1 mb-1" data-bs-toggle="tooltip" data-bs-placement="right" data-bs-title="@context.ProviderNameDisplayName">@context.ProviderName</span> |
|
|
|
@context.ProviderDisplayName |
|
|
|
} |
|
|
|
} |
|
|
|
</DisplayTemplate> |
|
|
|
</DataGridColumn> |
|
|
|
</DataGridColumns> |
|
|
|
<EmptyTemplate> |
|
|
|
@L["NoDataAvailableInDatatable"] |
|
|
|
</EmptyTemplate> |
|
|
|
</DataGrid> |
|
|
|
</DisplayTemplate> |
|
|
|
</DataGridColumn> |
|
|
|
<DataGridColumn TItem="ResourcePermissionGrantInfoDto" Field="@nameof(ResourcePermissionGrantInfoDto.Permissions)" Caption="@L["ResourcePermissionPermissions"]" Sortable="false"> |
|
|
|
<DisplayTemplate> |
|
|
|
@{ |
|
|
|
foreach (var permission in context.Permissions) |
|
|
|
{ |
|
|
|
<span class="d-inline-block bg-light rounded-pill px-2 me-1 mb-1">@permission.DisplayName</span> |
|
|
|
} |
|
|
|
} |
|
|
|
</DisplayTemplate> |
|
|
|
</DataGridColumn> |
|
|
|
</DataGridColumns> |
|
|
|
<EmptyTemplate> |
|
|
|
@L["NoDataAvailableInDatatable"] |
|
|
|
</EmptyTemplate> |
|
|
|
</DataGrid> |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
<div class="alert alert-warning" role="alert"> |
|
|
|
@if (!HasAnyResourcePermission) |
|
|
|
{ |
|
|
|
@L["NoResourcePermissionFound"] |
|
|
|
} |
|
|
|
else if(!HasAnyResourceProviderKeyLookupService) |
|
|
|
{ |
|
|
|
@L["NoResourceProviderKeyLookupServiceFound"] |
|
|
|
} |
|
|
|
</div> |
|
|
|
} |
|
|
|
</ModalBody> |
|
|
|
<ModalFooter> |
|
|
|
<Button Color="Color.Primary" Outline Clicked="CloseModal">@L["Close"]</Button> |
|
|
|
@ -75,17 +92,12 @@ |
|
|
|
<ModalContent Centered="true"> |
|
|
|
<Form> |
|
|
|
<ModalHeader> |
|
|
|
<ModalTitle>@L["AddResourcePermissions"]</ModalTitle> |
|
|
|
<ModalTitle>@L["AddResourcePermission"]</ModalTitle> |
|
|
|
<CloseButton Clicked="CloseCreateModalAsync" /> |
|
|
|
</ModalHeader> |
|
|
|
<ModalBody> |
|
|
|
<Validations @ref="@CreateValidationsRef" Model="@CreateEntity" ValidateOnLoad="false"> |
|
|
|
<div class="mb-3"> |
|
|
|
<label class="form-label">@L["Resource"]:</label> |
|
|
|
<p>@ResourceDisplayName</p> |
|
|
|
</div> |
|
|
|
<div class="mb-3"> |
|
|
|
<FieldLabel>@L["ProviderName"]:</FieldLabel> |
|
|
|
<RadioGroup TValue="string" |
|
|
|
CheckedValue="@CurrentLookupService" |
|
|
|
CheckedValueChanged="@OnLookupServiceCheckedValueChanged"> |
|
|
|
@ -94,9 +106,6 @@ |
|
|
|
<Radio Value="@(keyLookupService.Name)">@keyLookupService.DisplayName</Radio> |
|
|
|
} |
|
|
|
</RadioGroup> |
|
|
|
</div> |
|
|
|
<div class="mb-3"> |
|
|
|
<FieldLabel>@L["ProviderKey"]: *</FieldLabel> |
|
|
|
<Autocomplete @ref="ProviderKeyAutocompleteRef" |
|
|
|
TItem="SearchProviderKeyInfo" |
|
|
|
TValue="string" |
|
|
|
@ -119,14 +128,14 @@ |
|
|
|
</Validation> |
|
|
|
</div> |
|
|
|
<div class="mb-3"> |
|
|
|
<div class="mb-1 d-flex align-items-center justify-content-between"> |
|
|
|
<label class="form-labe">@L["ResourcePermissionPermissions"]:</label> |
|
|
|
<Check TValue="bool" Checked="CreateEntity.Permissions.All(x => x.IsGranted)" CheckedChanged="GrantAllAsync">@L["GrantAllResourcePermissions"]</Check> |
|
|
|
<h4>@L["ResourcePermissionPermissions"]</h4> |
|
|
|
<Switch TValue="bool" Checked="CreateEntity.Permissions.All(x => x.IsGranted)" CheckedChanged="GrantAllAsync">@L["GrantAllResourcePermissions"]</Switch> |
|
|
|
<div class="mt-2"> |
|
|
|
@foreach (var permission in CreateEntity.Permissions) |
|
|
|
{ |
|
|
|
<Check TValue="bool" Checked="@permission.IsGranted" CheckedChanged="@((c) => OnPermissionCheckedChanged(permission, c))">@permission.DisplayName</Check> |
|
|
|
} |
|
|
|
</div> |
|
|
|
@foreach (var permission in CreateEntity.Permissions) |
|
|
|
{ |
|
|
|
<Check TValue="bool" Checked="@permission.IsGranted" CheckedChanged="@((c) => OnPermissionCheckedChanged(permission, c))">@permission.DisplayName</Check> |
|
|
|
} |
|
|
|
</div> |
|
|
|
</Validations> |
|
|
|
</ModalBody> |
|
|
|
@ -142,24 +151,20 @@ |
|
|
|
<ModalContent Centered="true"> |
|
|
|
<Form> |
|
|
|
<ModalHeader> |
|
|
|
<ModalTitle>@L["UpdateResourcePermissions"]</ModalTitle> |
|
|
|
<ModalTitle>@L["UpdateResourcePermission"]</ModalTitle> |
|
|
|
<CloseButton Clicked="CloseEditModalAsync" /> |
|
|
|
</ModalHeader> |
|
|
|
<ModalBody> |
|
|
|
<Validations @ref="@EditValidationsRef" Model="@EditEntity" ValidateOnLoad="false"> |
|
|
|
<div class="mb-3"> |
|
|
|
<label class="form-label">@L["Resource"]:</label> |
|
|
|
<p>@ResourceDisplayName</p> |
|
|
|
</div> |
|
|
|
<div class="mb-3"> |
|
|
|
<div class="mb-1 d-flex align-items-center justify-content-between"> |
|
|
|
<label class="form-labe">@L["ResourcePermissionPermissions"]:</label> |
|
|
|
<Check TValue="bool" Checked="EditEntity.Permissions.All(x => x.IsGranted)" CheckedChanged="GrantAllAsync">@L["GrantAllResourcePermissions"]</Check> |
|
|
|
<h4>@L["ResourcePermissionPermissions"]</h4> |
|
|
|
<Switch TValue="bool" Checked="EditEntity.Permissions.All(x => x.IsGranted)" CheckedChanged="GrantAllAsync">@L["GrantAllResourcePermissions"]</Switch> |
|
|
|
<div class="mt-2"> |
|
|
|
@foreach (var permission in EditEntity.Permissions) |
|
|
|
{ |
|
|
|
<Check TValue="bool" Checked="@permission.IsGranted" CheckedChanged="@((c) => OnPermissionCheckedChanged(permission, c))">@permission.DisplayName</Check> |
|
|
|
} |
|
|
|
</div> |
|
|
|
@foreach (var permission in EditEntity.Permissions) |
|
|
|
{ |
|
|
|
<Check TValue="bool" Checked="@permission.IsGranted" CheckedChanged="@((c) => OnPermissionCheckedChanged(permission, c))">@permission.DisplayName</Check> |
|
|
|
} |
|
|
|
</div> |
|
|
|
</Validations> |
|
|
|
</ModalBody> |
|
|
|
|