mirror of https://github.com/abpframework/abp.git
5 changed files with 99 additions and 6 deletions
@ -1,3 +1,40 @@ |
|||
<div class="my-component"> |
|||
Permission management modal! |
|||
</div> |
|||
@using Microsoft.Extensions.Localization |
|||
@using Volo.Abp.PermissionManagement.Localization |
|||
@inject IStringLocalizer<AbpPermissionManagementResource> L |
|||
<Modal @ref="_modal"> |
|||
<ModalBackdrop /> |
|||
<ModalContent IsCentered="true"> |
|||
<ModalHeader> |
|||
<ModalTitle>Edit role</ModalTitle> |
|||
<CloseButton Clicked="CloseModal" /> |
|||
</ModalHeader> |
|||
<ModalBody> |
|||
@if (_groups != null) |
|||
{ |
|||
<Tabs Pills="true"> |
|||
<Items> |
|||
@foreach (var group in _groups) |
|||
{ |
|||
<Tab Name="@GetNormalizedGroupName(group.Name)">@group.DisplayName</Tab> |
|||
} |
|||
</Items> |
|||
<Content> |
|||
@foreach (var group in _groups) |
|||
{ |
|||
<TabPanel Name="@GetNormalizedGroupName(group.Name)"> |
|||
@foreach (var permission in group.Permissions) |
|||
{ |
|||
<Check @bind-checked="@permission.IsGranted" TValue="bool">@permission.DisplayName (@permission.IsGranted.ToString())</Check> |
|||
} |
|||
</TabPanel> |
|||
} |
|||
</Content> |
|||
</Tabs> |
|||
} |
|||
</ModalBody> |
|||
<ModalFooter> |
|||
<Button Color="Color.Secondary" Clicked="CloseModal">@L["Cancel"]</Button> |
|||
<Button Color="Color.Primary" Clicked="SaveAsync">@L["Save"]</Button> |
|||
</ModalFooter> |
|||
</ModalContent> |
|||
</Modal> |
|||
@ -0,0 +1,48 @@ |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using Blazorise; |
|||
using Microsoft.AspNetCore.Components; |
|||
|
|||
namespace Volo.Abp.PermissionManagement.Blazor.Components |
|||
{ |
|||
public partial class PermissionManagementModal |
|||
{ |
|||
[Inject] private IPermissionAppService PermissionAppService { get; set; } |
|||
|
|||
private Modal _modal; |
|||
|
|||
private string _providerName; |
|||
private string _providerKey; |
|||
|
|||
private string _entityDisplayName; |
|||
private List<PermissionGroupDto> _groups; |
|||
|
|||
public async Task OpenAsync(string providerName, string providerKey) |
|||
{ |
|||
_providerName = providerName; |
|||
_providerKey = providerKey; |
|||
|
|||
var result = await PermissionAppService.GetAsync(_providerName, _providerKey); |
|||
|
|||
_entityDisplayName = result.EntityDisplayName; |
|||
_groups = result.Groups; |
|||
|
|||
_modal.Show(); |
|||
} |
|||
|
|||
private void CloseModal() |
|||
{ |
|||
_modal.Hide(); |
|||
} |
|||
|
|||
private async Task SaveAsync() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public string GetNormalizedGroupName(string name) |
|||
{ |
|||
return "PermissionGroup_" + name.Replace(".", "_"); |
|||
} |
|||
} |
|||
} |
|||
@ -1 +1,5 @@ |
|||
@using Microsoft.AspNetCore.Components.Web |
|||
@using Volo.Abp.AspNetCore.Components.WebAssembly |
|||
@using Volo.Abp.BlazoriseUI |
|||
@using Blazorise |
|||
@using Blazorise.DataGrid |
|||
Loading…
Reference in new issue