diff --git a/src/AbpDesk/Web_PlugIns/AbpDesk.MongoBlog.dll b/src/AbpDesk/Web_PlugIns/AbpDesk.MongoBlog.dll index 243e6fa82e..9b260304f6 100644 Binary files a/src/AbpDesk/Web_PlugIns/AbpDesk.MongoBlog.dll and b/src/AbpDesk/Web_PlugIns/AbpDesk.MongoBlog.dll differ diff --git a/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/GetIdentityRolesInput.cs b/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/GetIdentityRolesInput.cs new file mode 100644 index 0000000000..c5db3405a8 --- /dev/null +++ b/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/GetIdentityRolesInput.cs @@ -0,0 +1,9 @@ +using Volo.Abp.Application.Dtos; + +namespace Volo.Abp.Identity +{ + public class GetIdentityRolesInput : PagedAndSortedResultRequestDto + { + public string Filter { get; set; } + } +} diff --git a/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/GetIdentityUsersInput.cs b/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/GetIdentityUsersInput.cs new file mode 100644 index 0000000000..29c6e296e7 --- /dev/null +++ b/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/GetIdentityUsersInput.cs @@ -0,0 +1,9 @@ +using Volo.Abp.Application.Dtos; + +namespace Volo.Abp.Identity +{ + public class GetIdentityUsersInput : PagedAndSortedResultRequestDto + { + public string Filter { get; set; } + } +} diff --git a/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IIdentityRoleAppService.cs b/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IIdentityRoleAppService.cs index 7dfb85a4fd..cc72600e16 100644 --- a/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IIdentityRoleAppService.cs +++ b/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IIdentityRoleAppService.cs @@ -1,11 +1,13 @@ using System; -using Volo.Abp.Application.Dtos; +using System.Collections.Generic; +using System.Threading.Tasks; using Volo.Abp.Application.Services; namespace Volo.Abp.Identity { - public interface IIdentityRoleAppService : IAsyncCrudAppService + public interface IIdentityRoleAppService : IAsyncCrudAppService { - + //TODO: remove after a better design + Task> GetAllListAsync(); } } 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 8738265374..c620ebd917 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 @@ -5,7 +5,7 @@ using Volo.Abp.Application.Services; namespace Volo.Abp.Identity { - public interface IIdentityUserAppService : IAsyncCrudAppService + public interface IIdentityUserAppService : IAsyncCrudAppService { Task> GetRolesAsync(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 new file mode 100644 index 0000000000..7a390bbc25 --- /dev/null +++ b/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserCreateOrUpdateOutput.cs @@ -0,0 +1,11 @@ +using Volo.Abp.Application.Dtos; + +namespace Volo.Abp.Identity +{ + public class IdentityUserCreateOrUpdateOutput + { + public IdentityUserDto User { get; set; } + + public IdentityUserRoleDto[] Roles { get; set; } + } +} \ No newline at end of file diff --git a/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserRoleDto.cs b/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserRoleDto.cs new file mode 100644 index 0000000000..eea833d957 --- /dev/null +++ b/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserRoleDto.cs @@ -0,0 +1,13 @@ +using System; + +namespace Volo.Abp.Identity +{ + public class IdentityUserRoleDto + { + public Guid Id { get; set; } + + public string Name { get; set; } + + public bool IsAssigned { get; set; } + } +} diff --git a/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserUpdateDto.cs b/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserUpdateDto.cs index cc551a7398..3117ff8003 100644 --- a/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserUpdateDto.cs +++ b/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserUpdateDto.cs @@ -2,6 +2,5 @@ { public class IdentityUserUpdateDto : IdentityUserCreateOrUpdateDtoBase { - } } \ No newline at end of file diff --git a/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/AbpDeskApplicationModuleAutoMapperProfile.cs b/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/AbpDeskApplicationModuleAutoMapperProfile.cs index e796a0a7ae..d99da9de7d 100644 --- a/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/AbpDeskApplicationModuleAutoMapperProfile.cs +++ b/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/AbpDeskApplicationModuleAutoMapperProfile.cs @@ -1,4 +1,5 @@ -using AutoMapper; +using System.Collections.Generic; +using AutoMapper; namespace Volo.Abp.Identity { @@ -8,6 +9,7 @@ namespace Volo.Abp.Identity { CreateMap(); CreateMap(); + CreateMap(); } } } \ No newline at end of file diff --git a/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs b/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs index 6cbbf8ca41..0113ef86ba 100644 --- a/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs +++ b/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs @@ -12,7 +12,7 @@ namespace Volo.Abp.Identity private readonly IIdentityRoleRepository _roleRepository; public IdentityRoleAppService( - IdentityRoleManager roleManager, + IdentityRoleManager roleManager, IIdentityRoleRepository roleRepository) { _roleManager = roleManager; @@ -26,10 +26,10 @@ namespace Volo.Abp.Identity ); } - public async Task> GetListAsync(PagedAndSortedResultRequestDto input) + public async Task> GetListAsync(GetIdentityRolesInput input) { var count = (int)await _roleRepository.GetCountAsync(); - var list = await _roleRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount); + var list = await _roleRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter); return new PagedResultDto( count, @@ -37,6 +37,13 @@ namespace Volo.Abp.Identity ); } + public async Task> GetAllListAsync() + { + var list = await _roleRepository.GetAllListAsync(); + + return ObjectMapper.Map, List>(list); + } + public async Task CreateAsync(IdentityRoleCreateDto input) { var role = new IdentityRole(GuidGenerator.Create(), input.Name); 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 4fdd77c26e..2558b711c4 100644 --- a/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs +++ b/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; @@ -26,10 +27,10 @@ namespace Volo.Abp.Identity ); } - public async Task> GetListAsync(PagedAndSortedResultRequestDto input) + public async Task> GetListAsync(GetIdentityUsersInput input) { var count = (int)await _userRepository.GetCountAsync(); - var list = await _userRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount); + var list = await _userRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter); return new PagedResultDto( count, diff --git a/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IIdentityRoleRepository.cs b/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IIdentityRoleRepository.cs index 7ff67aba2c..f18ce2edd4 100644 --- a/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IIdentityRoleRepository.cs +++ b/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IIdentityRoleRepository.cs @@ -9,6 +9,9 @@ namespace Volo.Abp.Identity { Task FindByNormalizedNameAsync(string normalizedRoleName, CancellationToken cancellationToken); - Task> GetListAsync(string sorting, int maxResultCount, int skipCount); + Task> GetListAsync(string sorting, int maxResultCount, int skipCount, string filter); + + //TODO: remove after a better design + Task> GetAllListAsync(); } } \ No newline at end of file diff --git a/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IIdentityUserRepository.cs b/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IIdentityUserRepository.cs index d583b83f46..39b1b649bb 100644 --- a/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IIdentityUserRepository.cs +++ b/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IIdentityUserRepository.cs @@ -24,7 +24,8 @@ namespace Volo.Abp.Identity //TODO: Why not return List instead of IList Task> GetListByNormalizedRoleNameAsync(string normalizedRoleName, CancellationToken cancellationToken); - Task> GetListAsync(string sorting, int maxResultCount, int skipCount); + //TODO: DTO can be used instead of parameters + Task> GetListAsync(string sorting, int maxResultCount, int skipCount, string filter); Task> GetRolesAsync(Guid userId); } diff --git a/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EfCoreIdentityRoleRepository.cs b/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EfCoreIdentityRoleRepository.cs index fd5e343ee7..40047101c8 100644 --- a/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EfCoreIdentityRoleRepository.cs +++ b/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EfCoreIdentityRoleRepository.cs @@ -7,6 +7,7 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.Identity.EntityFrameworkCore; +using System; namespace Volo.Abp.Identity { @@ -22,9 +23,18 @@ namespace Volo.Abp.Identity return DbSet.FirstOrDefaultAsync(r => r.NormalizedName == normalizedRoleName, cancellationToken); } - public async Task> GetListAsync(string sorting, int maxResultCount, int skipCount) + public async Task> GetListAsync(string sorting, int maxResultCount, int skipCount, string filter) { - return await this.OrderBy(sorting ?? nameof(IdentityRole.Name)).PageBy(skipCount, maxResultCount).ToListAsync(); + return await this.WhereIf( + !filter.IsNullOrWhiteSpace(), + r => r.Name.Contains(filter) + ).OrderBy(sorting ?? nameof(IdentityRole.Name)) + .PageBy(skipCount, maxResultCount).ToListAsync(); + } + + public async Task> GetAllListAsync() + { + return await GetQueryable().ToListAsync(); } } } \ No newline at end of file diff --git a/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EfCoreIdentityUserRepository.cs b/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EfCoreIdentityUserRepository.cs index a845d8faf8..70b301e125 100644 --- a/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EfCoreIdentityUserRepository.cs +++ b/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EfCoreIdentityUserRepository.cs @@ -78,6 +78,18 @@ namespace Volo.Abp.Identity return await query.ToListAsync(cancellationToken); } + public async Task> GetListAsync(string sorting, int maxResultCount, int skipCount, string filter) + { + return await this.WhereIf( + !filter.IsNullOrWhiteSpace(), + u => + u.UserName.Contains(filter) || + u.Email.Contains(filter) + ) + .OrderBy(sorting ?? nameof(IdentityUser.UserName)) + .PageBy(skipCount, maxResultCount).ToListAsync(); + } + public async Task> GetListAsync(string sorting, int maxResultCount, int skipCount) { return await this.OrderBy(sorting ?? nameof(IdentityUser.UserName)).PageBy(skipCount, maxResultCount).ToListAsync(); @@ -87,6 +99,7 @@ namespace Volo.Abp.Identity { var query = from userRole in DbContext.UserRoles join role in DbContext.Roles on userRole.RoleId equals role.Id + where userRole.UserId == userId select role; return await query.ToListAsync(); 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 cb43d9833e..15437c706b 100644 --- a/src/Volo.Abp.Identity.Web/Areas/Identity/Controllers/UsersController.cs +++ b/src/Volo.Abp.Identity.Web/Areas/Identity/Controllers/UsersController.cs @@ -1,8 +1,11 @@ -using System.Threading.Tasks; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Volo.Abp.Application.Dtos; using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.Identity.Web.Areas.Identity.Models; namespace Volo.Abp.Identity.Web.Areas.Identity.Controllers { @@ -10,17 +13,63 @@ namespace Volo.Abp.Identity.Web.Areas.Identity.Controllers [Authorize] public class UsersController : AbpController { - private readonly IIdentityUserAppService _userAppService; + private readonly IIdentityUserAppService _identityUserAppService; + private readonly IIdentityRoleAppService _identityRoleAppService; - public UsersController(IIdentityUserAppService userAppService) + public UsersController(IIdentityUserAppService identityUserAppService, IIdentityRoleAppService identityRoleAppService) { - _userAppService = userAppService; + _identityUserAppService = identityUserAppService; + _identityRoleAppService = identityRoleAppService; } public async Task Index() { - var result = await _userAppService.GetListAsync(new PagedAndSortedResultRequestDto()); - return View(result.Items); + return View(); + } + + public async Task Create() + { + + var model = await CreateViewModel(null); + + return PartialView("_Create", model); + } + + public async Task Update(Guid id) + { + var user = await _identityUserAppService.GetAsync(id); + await _identityRoleAppService.GetAllListAsync(); + var model = await CreateViewModel(user); + + return PartialView("_Update", model); + } + + private async Task CreateViewModel(IdentityUserDto user) + { + var allRoles = await _identityRoleAppService.GetAllListAsync(); + + var model = new CreateOrUpdateUserViewModel + { + User = user ?? new IdentityUserDto(), + Roles = ObjectMapper.Map, IdentityUserRoleDto[]>(allRoles) + }; + + var userRoles = new List(); + + if (user != null) + { + userRoles = (await _identityUserAppService.GetRolesAsync(user.Id)).Items.ToList(); + } + + foreach (var role in model.Roles) + { + if (userRoles.Select(x=>x.Name).Contains(role.Name)) + { + role.IsAssigned = true; + } + } + + return model; } } } diff --git a/src/Volo.Abp.Identity.Web/Areas/Identity/Models/CreateOrUpdateUserViewModel.cs b/src/Volo.Abp.Identity.Web/Areas/Identity/Models/CreateOrUpdateUserViewModel.cs new file mode 100644 index 0000000000..5f92205779 --- /dev/null +++ b/src/Volo.Abp.Identity.Web/Areas/Identity/Models/CreateOrUpdateUserViewModel.cs @@ -0,0 +1,8 @@ +namespace Volo.Abp.Identity.Web.Areas.Identity.Models +{ + public class CreateOrUpdateUserViewModel + { + public IdentityUserDto User { get; set; } + public IdentityUserRoleDto[] Roles { get; set; } + } +} diff --git a/src/Volo.Abp.Identity.Web/Areas/Identity/Views/Users/Index.cshtml b/src/Volo.Abp.Identity.Web/Areas/Identity/Views/Users/Index.cshtml index ed16546d72..051fb34a2a 100644 --- a/src/Volo.Abp.Identity.Web/Areas/Identity/Views/Users/Index.cshtml +++ b/src/Volo.Abp.Identity.Web/Areas/Identity/Views/Users/Index.cshtml @@ -1,34 +1,42 @@ -@model IReadOnlyList - -@section styles { +@section styles { } @section scripts { - + } -

Users

+
+
+

Users

+
+
+ + +
+
- +
- - - - - + + + + + + - - @foreach (var user in Model) - { - - - - - - } - -
UsernameEmail AddressPhone Number
ActionsUsernameEmail AddressPhone Number
@user.UserName@user.Email@(user.PhoneNumber ?? "-")
\ No newline at end of file + + + + \ No newline at end of file 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 new file mode 100644 index 0000000000..f48c141f13 --- /dev/null +++ b/src/Volo.Abp.Identity.Web/Areas/Identity/Views/Users/_Create.cshtml @@ -0,0 +1,64 @@ +@model Volo.Abp.Identity.Web.Areas.Identity.Controllers.CreateOrUpdateUserViewModel + + + + \ No newline at end of file diff --git a/src/Volo.Abp.Identity.Web/Areas/Identity/Views/Users/_Update.cshtml b/src/Volo.Abp.Identity.Web/Areas/Identity/Views/Users/_Update.cshtml new file mode 100644 index 0000000000..26fad72c1d --- /dev/null +++ b/src/Volo.Abp.Identity.Web/Areas/Identity/Views/Users/_Update.cshtml @@ -0,0 +1,62 @@ +@model Volo.Abp.Identity.Web.Areas.Identity.Controllers.CreateOrUpdateUserViewModel + + + + \ No newline at end of file diff --git a/src/Volo.Abp.Identity.Web/Volo.Abp.Identity.Web.csproj b/src/Volo.Abp.Identity.Web/Volo.Abp.Identity.Web.csproj index f96478d5eb..8351793d79 100644 --- a/src/Volo.Abp.Identity.Web/Volo.Abp.Identity.Web.csproj +++ b/src/Volo.Abp.Identity.Web/Volo.Abp.Identity.Web.csproj @@ -11,7 +11,16 @@ - + + + + + + + + + + diff --git a/src/Volo.Abp.Identity.Web/wwwroot/modules/identity/views/users/index.css b/src/Volo.Abp.Identity.Web/wwwroot/modules/identity/views/users/index.css index 00bc312198..4f53b593a8 100644 --- a/src/Volo.Abp.Identity.Web/wwwroot/modules/identity/views/users/index.css +++ b/src/Volo.Abp.Identity.Web/wwwroot/modules/identity/views/users/index.css @@ -1,3 +1,8 @@ -#IdentityUsersTable { - width: 100%; +.dataTable { + width: 100% !important; + border-spacing: 0 !important; +} +.table td, +.table th { + padding: 8px 10px; } \ No newline at end of file diff --git a/src/Volo.Abp.Identity.Web/wwwroot/modules/identity/views/users/index.js b/src/Volo.Abp.Identity.Web/wwwroot/modules/identity/views/users/index.js index 7170f72224..79e437535d 100644 --- a/src/Volo.Abp.Identity.Web/wwwroot/modules/identity/views/users/index.js +++ b/src/Volo.Abp.Identity.Web/wwwroot/modules/identity/views/users/index.js @@ -1,3 +1,155 @@ -$(function() { - $('#IdentityUsersTable').DataTable(); -}); \ No newline at end of file +$(function () { + var _identityUserAppService = volo.abp.identity.identityUser; + + var dataTable = $('#IdentityUsersTable').DataTable({ + paging: true, + serverSide: true, + processing: true, + responsive: true, + order: [[1, "asc"]], + ajax: function (requestData, callback, settings) { + var inputFilter = {}; + + //set paging filters + if (settings.oInit.paging) { + inputFilter = $.extend(inputFilter, { + maxResultCount: requestData.length, + skipCount: requestData.start + }); + } + + //set sorting filter + if (requestData.order && requestData.order.length > 0) { + var orderingField = requestData.order[0]; + if (requestData.columns[orderingField.column].data) { + inputFilter.sorting = requestData.columns[orderingField.column].data + " " + orderingField.dir; + } + } + + //set searching filter + if (requestData.search && requestData.search.value !== "") { + inputFilter.filter = requestData.search.value; + } + + if (callback) { + _identityUserAppService.getList(inputFilter).done(function (result) { + callback({ + recordsTotal: result.totalCount, + recordsFiltered: result.totalCount, + data: result.items + }); + }); + } + }, + columnDefs: [ + { + targets: 0, + data: null, + orderable: false, + autoWidth: false, + defaultContent: '', + render: function (list, type, record, meta) { + return ''; + } + }, + { + targets: 1, + data: "userName" + }, + { + targets: 2, + data: "email" + }, + { + targets: 3, + data: "phoneNumber" + } + ] + }); + + $('#IdentityUsersTable').on('click', '.update-user', function () { + var id = $(this).data('id'); + + $('#createUpdateUserModal').modal('show') + .find('.modal-content') + .load(abp.appPath + 'Identity/Users/Update', { id: id }); + }); + + $('#IdentityUsersTable').on('click', '.delete-user', function () { + var id = $(this).data('id'); + + if (confirm('Are you sure you want to delete?')) { + _identityUserAppService.delete(id).done(function () { + dataTable.ajax.reload(); + }); + } + }); + + $('.create-user').click(function () { + $('#createUpdateUserModal').modal('show') + .find('.modal-content') + .load(abp.appPath + 'Identity/Users/Create'); + }); + + $('#createUpdateUserModal').on('click', '#btnCreateUserSave', function () { + var $createUserForm = $('#createUserForm'); + var user = $createUserForm.serializeFormToObject(); + user.RoleNames = findAssignedRoleNames(); + + _identityUserAppService.create(user).done(function () { + $('#createUpdateUserModal').modal('hide'); + dataTable.ajax.reload(); + }); + }); + + $('#createUpdateUserModal').on('click', '#btnUpdateUserSave', function () { + var $updateUserForm = $('#updateUserForm'); + var user = $updateUserForm.serializeFormToObject(); + user.RoleNames = findAssignedRoleNames(); + + _identityUserAppService.update(user.Id, user).done(function () { + $('#createUpdateUserModal').modal('hide'); + dataTable.ajax.reload(); + }); + }); +}); + + +function findAssignedRoleNames() { + var assignedRoleNames = []; + + $(document).find('.user-role-checkbox-list input[type=checkbox]') + .each(function () { + if ($(this).is(':checked')) { + assignedRoleNames.push($(this).attr('name')); + } + }); + + return assignedRoleNames; +} + +//TODO: move to common script file +$.fn.serializeFormToObject = function () { + //serialize to array + var data = $(this).serializeArray(); + + //add also disabled items + $(':disabled[name]', this) + .each(function () { + data.push({ name: this.name, value: $(this).val() }); + }); + + //map to object + var obj = {}; + data.map(function (x) { obj[x.name] = x.value; }); + + return obj; +}; diff --git a/src/Volo.Abp.Identity.Web/wwwroot/modules/identity/views/users/index.less b/src/Volo.Abp.Identity.Web/wwwroot/modules/identity/views/users/index.less index f267dfefb8..c49b79238d 100644 --- a/src/Volo.Abp.Identity.Web/wwwroot/modules/identity/views/users/index.less +++ b/src/Volo.Abp.Identity.Web/wwwroot/modules/identity/views/users/index.less @@ -1,3 +1,8 @@ -#IdentityUsersTable { - width: 100%; +.dataTable { + width: 100% !important; + border-spacing: 0 !important; +} + +.table td, .table th { + padding: 8px 10px; } diff --git a/src/Volo.Abp.Identity.Web/wwwroot/modules/identity/views/users/index.min.css b/src/Volo.Abp.Identity.Web/wwwroot/modules/identity/views/users/index.min.css index 3690048700..283dedaa8a 100644 --- a/src/Volo.Abp.Identity.Web/wwwroot/modules/identity/views/users/index.min.css +++ b/src/Volo.Abp.Identity.Web/wwwroot/modules/identity/views/users/index.min.css @@ -1 +1 @@ -#IdentityUsersTable{width:100%;} \ No newline at end of file +.dataTable{width:100% !important;border-spacing:0 !important;}.table td,.table th{padding:8px 10px;} \ No newline at end of file diff --git a/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs b/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs index f648bfd9b6..1eedd46355 100644 --- a/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs +++ b/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs @@ -40,7 +40,7 @@ namespace Volo.Abp.Identity { //Act - var result = await _roleAppService.GetListAsync(new PagedAndSortedResultRequestDto()); + var result = await _roleAppService.GetListAsync(new GetIdentityRolesInput()); //Assert diff --git a/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserAppService_Tests.cs b/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserAppService_Tests.cs index a4bbb9af11..4025713ae1 100644 --- a/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserAppService_Tests.cs +++ b/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserAppService_Tests.cs @@ -44,7 +44,7 @@ namespace Volo.Abp.Identity { //Act - var result = await _userAppService.GetListAsync(new PagedAndSortedResultRequestDto()); + var result = await _userAppService.GetListAsync(new GetIdentityUsersInput()); //Assert