From 031f9ef44bf51e99288932705ad7b72b95d2dbee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?alir=C4=B1za=20ad=C4=B1yah=C5=9Fi?= Date: Wed, 11 Oct 2017 14:16:14 +0300 Subject: [PATCH] Edit user roles --- src/AbpDesk/Web_PlugIns/AbpDesk.MongoBlog.dll | Bin 15360 -> 15872 bytes .../Abp/Identity/IIdentityUserAppService.cs | 2 + .../IdentityUserCreateOrUpdateOutput.cs | 2 +- .../Abp/Identity/IdentityUserAppService.cs | 5 +- .../Identity/Controllers/UsersController.cs | 4 +- .../Areas/Identity/Views/Users/_Create.cshtml | 61 +++++++++--------- .../Areas/Identity/Views/Users/_Update.cshtml | 58 +++++++++++++---- .../modules/identity/views/users/index.js | 39 +++++++---- .../Services/IAsyncCrudAppService.cs | 2 - 9 files changed, 113 insertions(+), 60 deletions(-) diff --git a/src/AbpDesk/Web_PlugIns/AbpDesk.MongoBlog.dll b/src/AbpDesk/Web_PlugIns/AbpDesk.MongoBlog.dll index b7cc055fbd1dab34af45b3dcaa3e4568c123b15d..9b260304f6fb90dcd88df8d7d4d0f83597b85d3b 100644 GIT binary patch delta 5342 zcmZu#3vg7`8UD|?ckgR=Z+7oyHz8TVCM4lzH^ERtCB(WrxV+M1T8Qq=k=PH82Awkp(Dl}_=+^gCx4gpNCNzx%)c z|NiGcC-)}z{oM7p{-lb3@0s_g@H;?N2|sHjYKB0|3uko>J$SzTP6yF)A-I%ir!rI- z3FL?Z;O9Uw!#mhi?{%>$)`BL861bYZpRyF2;XTEsusPm1tEw&Ugc!fGaB=d{f?A^I ztBIJDBG^)*Mgx(O*;ejOAhKYmtb#r26^CCeLix)AB$5hk9l5~h;@)^P@ADZie9Nso)(rd%|@ zA}u{dSR#BX=DHvQw4xw0APbtViCe@M_SH`zJ#zuPO&6_6-Mk3Ra8ttht7!ZGhDR&7 zqZO%$YKGNxy*H#3TMaO+&9jdx)miOW6cv?+wcZNhG8I~?Nf&|6EaKFYIR{Yee4SM+ zE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!MV`HCmjWpbvPe)+XAQfZUL^(m7=IFL^l|B0RO_*x!(uoEFDKt+<_OUD!8qxALQWHNa-H;+P$2yf^LQfUq>thI1xA8^bFq+^785>hAeNgt zWe+Hl!M`yHDc$3wzu|_^i%2=};322O13xjL6d*|{@DR7{jPDlA6i6Smpb2m%7o;BH zLEH)))e)KKnC}(l5kj;j%5g_CLzunTm} za8iadS9<1#0?V;#OqlDel!-KmMRhdxi$FX}s)B;YA~T$mD|Q!NL9%{uw(2+++wU)C zwuPC`1`QOUb)1goB2fZorDR&T;XYQ`TrMi3XDh`uLy)4g6wNVmK+6zrG#*LK68$Fp z(;G8Gr$&P7%y3&RQP}j0ko4g6Gg)U@cMDG0EfD2Jy=+@%FE+;%O1Vwmh{|l+&M=vn z+m#sEW=zC=1s#xYfP}64YP^PXa=(v%(fwsrh;@5w>W%OhlP@?xta+L^Yb){d;yxb6s(-$pSv>>_2?HO9(Y=!OF=LJDWI!nTQ m`*b%jtP+Rozfp>izq?`BVAgF9|5o8|5AF_J^f~LS)Bgt<6fQFW diff --git a/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IIdentityUserAppService.cs b/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IIdentityUserAppService.cs index c620ebd917..afe51f01ea 100644 --- a/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IIdentityUserAppService.cs +++ b/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IIdentityUserAppService.cs @@ -10,5 +10,7 @@ namespace Volo.Abp.Identity Task> GetRolesAsync(Guid id); Task UpdateRolesAsync(Guid id, IdentityUserUpdateRolesDto input); + + Task GetUserForCreateOrUpdateAsync(Guid? id); } } diff --git a/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserCreateOrUpdateOutput.cs b/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserCreateOrUpdateOutput.cs index e107db6b71..7a390bbc25 100644 --- a/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserCreateOrUpdateOutput.cs +++ b/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserCreateOrUpdateOutput.cs @@ -2,7 +2,7 @@ namespace Volo.Abp.Identity { - public class IdentityUserCreateOrUpdateOutput: EntityDto + public class IdentityUserCreateOrUpdateOutput { public IdentityUserDto User { get; set; } diff --git a/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs b/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs index 68b92a04c5..af2150a6cf 100644 --- a/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs +++ b/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs @@ -29,7 +29,7 @@ namespace Volo.Abp.Identity ); } - public async Task GetUserForCreateOrUpdateAsync(Guid id) + public async Task GetUserForCreateOrUpdateAsync(Guid? id) { var userRoleDtos = ObjectMapper.Map, IdentityUserRoleDto[]>(await _roleRepository.GetListAsync()); var output = new IdentityUserCreateOrUpdateOutput @@ -37,8 +37,9 @@ namespace Volo.Abp.Identity Roles = userRoleDtos }; - var user = await _userManager.GetByIdAsync(id); + if (!id.HasValue) return output; + var user = await _userManager.GetByIdAsync(id.Value); output.User = ObjectMapper.Map(user); foreach (var userRoleDto in userRoleDtos) diff --git a/src/Volo.Abp.Identity.Web/Areas/Identity/Controllers/UsersController.cs b/src/Volo.Abp.Identity.Web/Areas/Identity/Controllers/UsersController.cs index 300395bf19..48ab86f57a 100644 --- a/src/Volo.Abp.Identity.Web/Areas/Identity/Controllers/UsersController.cs +++ b/src/Volo.Abp.Identity.Web/Areas/Identity/Controllers/UsersController.cs @@ -22,7 +22,9 @@ namespace Volo.Abp.Identity.Web.Areas.Identity.Controllers public async Task _Create() { - return PartialView(); + var identityUser = await _identityUserAppService.GetUserForCreateOrUpdateAsync(null); + + return PartialView(identityUser); } public async Task _Update(Guid id) diff --git a/src/Volo.Abp.Identity.Web/Areas/Identity/Views/Users/_Create.cshtml b/src/Volo.Abp.Identity.Web/Areas/Identity/Views/Users/_Create.cshtml index 623fae0570..3df61db2ab 100644 --- a/src/Volo.Abp.Identity.Web/Areas/Identity/Views/Users/_Create.cshtml +++ b/src/Volo.Abp.Identity.Web/Areas/Identity/Views/Users/_Create.cshtml @@ -1,4 +1,4 @@ -@model Volo.Abp.Identity.IdentityUserDto +@model Volo.Abp.Identity.IdentityUserCreateOrUpdateOutput