Browse Source

Merge branch 'blazor-ui' of https://github.com/abpframework/abp into blazor-ui

pull/5399/head
Halil İbrahim Kalkan 6 years ago
parent
commit
7e079d1ee2
  1. 5
      modules/identity/src/Volo.Abp.Identity.Blazor/AbpIdentityBlazorAutoMapperProfile.cs
  2. 18
      modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor
  3. 12
      modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor.cs

5
modules/identity/src/Volo.Abp.Identity.Blazor/AbpIdentityBlazorAutoMapperProfile.cs

@ -7,6 +7,11 @@ namespace Volo.Abp.Identity.Blazor
{ {
public AbpIdentityBlazorAutoMapperProfile() public AbpIdentityBlazorAutoMapperProfile()
{ {
CreateMap<IdentityUserDto, IdentityUserUpdateDto>()
.MapExtraProperties()
.Ignore(x => x.Password)
.Ignore(x => x.RoleNames);
CreateMap<IdentityRoleDto, IdentityRoleUpdateDto>() CreateMap<IdentityRoleDto, IdentityRoleUpdateDto>()
.MapExtraProperties(); .MapExtraProperties();

18
modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor

@ -4,6 +4,7 @@
@using Microsoft.Extensions.Localization @using Microsoft.Extensions.Localization
@using Volo.Abp.Application.Dtos @using Volo.Abp.Application.Dtos
@using Volo.Abp.Identity.Localization @using Volo.Abp.Identity.Localization
@using Volo.Abp.PermissionManagement.Blazor.Components
@inherits BlazorisePageBase<IIdentityUserAppService, IdentityUserDto, Guid, GetIdentityUsersInput, IdentityUserCreateDto, IdentityUserUpdateDto> @inherits BlazorisePageBase<IIdentityUserAppService, IdentityUserDto, Guid, GetIdentityUsersInput, IdentityUserCreateDto, IdentityUserUpdateDto>
@inject IStringLocalizer<IdentityResource> L @inject IStringLocalizer<IdentityResource> L
@ -35,6 +36,7 @@
</DropdownToggle> </DropdownToggle>
<DropdownMenu> <DropdownMenu>
<DropdownItem Clicked="() => OpenEditModalAsync(context.As<IdentityUserDto>().Id)">@L["Edit"]</DropdownItem> <DropdownItem Clicked="() => OpenEditModalAsync(context.As<IdentityUserDto>().Id)">@L["Edit"]</DropdownItem>
<DropdownItem Clicked="() => PermissionManagementModal.OpenAsync(PermissionProviderName,context.As<IdentityUserDto>().Id.ToString())">@L["Permissions"]</DropdownItem>
<DropdownDivider/> <DropdownDivider/>
<DropdownItem Clicked="() => DeleteEntityAsync(context.As<IdentityUserDto>())">@L["Delete"]</DropdownItem> <DropdownItem Clicked="() => DeleteEntityAsync(context.As<IdentityUserDto>())">@L["Delete"]</DropdownItem>
</DropdownMenu> </DropdownMenu>
@ -89,7 +91,7 @@
</Field> </Field>
<Field> <Field>
<FieldLabel>@L["DisplayName:Password"]</FieldLabel> <FieldLabel>@L["DisplayName:Password"]</FieldLabel>
<TextEdit @bind-text="NewEntity.Password" /> <TextEdit Role="TextRole.Password" @bind-text="NewEntity.Password" />
</Field> </Field>
<Field> <Field>
<FieldLabel>@L["DisplayName:Email"]</FieldLabel> <FieldLabel>@L["DisplayName:Email"]</FieldLabel>
@ -107,9 +109,9 @@
</Field> </Field>
</TabPanel> </TabPanel>
<TabPanel Name="Roles"> <TabPanel Name="Roles">
@if (NewEntityRoles != null) @if (NewUserRoles != null)
{ {
@foreach (var role in NewEntityRoles) @foreach (var role in NewUserRoles)
{ {
<Field> <Field>
<input type="hidden" @bind-value="@role.Name" /> <input type="hidden" @bind-value="@role.Name" />
@ -160,7 +162,7 @@
</Field> </Field>
<Field> <Field>
<FieldLabel>@L["DisplayName:Password"]</FieldLabel> <FieldLabel>@L["DisplayName:Password"]</FieldLabel>
<TextEdit @bind-text="EditingEntity.Password" /> <TextEdit Role="TextRole.Password" @bind-text="EditingEntity.Password" />
</Field> </Field>
<Field> <Field>
<FieldLabel>@L["DisplayName:Email"]</FieldLabel> <FieldLabel>@L["DisplayName:Email"]</FieldLabel>
@ -178,9 +180,9 @@
</Field> </Field>
</TabPanel> </TabPanel>
<TabPanel Name="Roles"> <TabPanel Name="Roles">
@if (EditEntityRoles != null) @if (EditUserRoles != null)
{ {
@foreach (var role in EditEntityRoles) @foreach (var role in EditUserRoles)
{ {
<Field> <Field>
<input type="hidden" @bind-value="@role.Name" /> <input type="hidden" @bind-value="@role.Name" />
@ -197,4 +199,6 @@
<Button Color="Color.Primary" Clicked="UpdateEntityAsync">@L["Save"]</Button> <Button Color="Color.Primary" Clicked="UpdateEntityAsync">@L["Save"]</Button>
</ModalFooter> </ModalFooter>
</ModalContent> </ModalContent>
</Modal> </Modal>
<PermissionManagementModal @ref="PermissionManagementModal"/>

12
modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor.cs

@ -15,9 +15,9 @@ namespace Volo.Abp.Identity.Blazor.Pages.Identity
protected IReadOnlyList<IdentityRoleDto> Roles; protected IReadOnlyList<IdentityRoleDto> Roles;
protected AssignedRoleViewModel[] NewEntityRoles; protected AssignedRoleViewModel[] NewUserRoles;
protected AssignedRoleViewModel[] EditEntityRoles; protected AssignedRoleViewModel[] EditUserRoles;
public UserManagement() public UserManagement()
{ {
@ -34,7 +34,7 @@ namespace Volo.Abp.Identity.Blazor.Pages.Identity
protected override void OpenCreateModal() protected override void OpenCreateModal()
{ {
NewEntityRoles = Roles.Select(x => new AssignedRoleViewModel NewUserRoles = Roles.Select(x => new AssignedRoleViewModel
{ {
Name = x.Name, Name = x.Name,
IsAssigned = x.IsDefault IsAssigned = x.IsDefault
@ -45,7 +45,7 @@ namespace Volo.Abp.Identity.Blazor.Pages.Identity
protected override Task CreateEntityAsync() protected override Task CreateEntityAsync()
{ {
NewEntity.RoleNames = NewEntityRoles.Where(x => x.IsAssigned).Select(x => x.Name).ToArray(); NewEntity.RoleNames = NewUserRoles.Where(x => x.IsAssigned).Select(x => x.Name).ToArray();
return base.CreateEntityAsync(); return base.CreateEntityAsync();
} }
@ -54,7 +54,7 @@ namespace Volo.Abp.Identity.Blazor.Pages.Identity
{ {
var userRoleNames = (await AppService.GetRolesAsync(id)).Items.Select(r => r.Name).ToList(); var userRoleNames = (await AppService.GetRolesAsync(id)).Items.Select(r => r.Name).ToList();
EditEntityRoles = Roles.Select(x => new AssignedRoleViewModel EditUserRoles = Roles.Select(x => new AssignedRoleViewModel
{ {
Name = x.Name, Name = x.Name,
IsAssigned = userRoleNames.Contains(x.Name) IsAssigned = userRoleNames.Contains(x.Name)
@ -65,7 +65,7 @@ namespace Volo.Abp.Identity.Blazor.Pages.Identity
protected override Task UpdateEntityAsync() protected override Task UpdateEntityAsync()
{ {
EditingEntity.RoleNames = EditEntityRoles.Where(x => x.IsAssigned).Select(x => x.Name).ToArray(); EditingEntity.RoleNames = EditUserRoles.Where(x => x.IsAssigned).Select(x => x.Name).ToArray();
return base.UpdateEntityAsync(); return base.UpdateEntityAsync();
} }

Loading…
Cancel
Save