diff --git a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/AbpIdentityApplicationContractsModule.cs b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/AbpIdentityApplicationContractsModule.cs index 107acba9d1..43481ff30a 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/AbpIdentityApplicationContractsModule.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/AbpIdentityApplicationContractsModule.cs @@ -1,6 +1,8 @@ using Volo.Abp.Application; using Volo.Abp.Authorization; using Volo.Abp.Modularity; +using Volo.Abp.ObjectExtending; +using Volo.Abp.ObjectExtending.Modularity; using Volo.Abp.PermissionManagement; using Volo.Abp.Users; @@ -19,5 +21,26 @@ namespace Volo.Abp.Identity { } + + public override void PostConfigureServices(ServiceConfigurationContext context) + { + ModuleExtensionConfigurationHelper + .ApplyEntityConfigurationToApi( + IdentityModuleExtensionConsts.ModuleName, + IdentityModuleExtensionConsts.EntityNames.Role, + getApiTypes: new[] { typeof(IdentityRoleDto) }, + createApiTypes: new[] { typeof(IdentityRoleCreateDto) }, + updateApiTypes: new[] { typeof(IdentityRoleUpdateDto) } + ); + + ModuleExtensionConfigurationHelper + .ApplyEntityConfigurationToApi( + IdentityModuleExtensionConsts.ModuleName, + IdentityModuleExtensionConsts.EntityNames.User, + getApiTypes: new[] { typeof(IdentityUserDto) }, + createApiTypes: new[] { typeof(IdentityUserCreateDto) }, + updateApiTypes: new[] { typeof(IdentityUserUpdateDto) } + ); + } } } \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityRoleCreateOrUpdateDtoBase.cs b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityRoleCreateOrUpdateDtoBase.cs index 491e82d766..6b68c43568 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityRoleCreateOrUpdateDtoBase.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityRoleCreateOrUpdateDtoBase.cs @@ -13,5 +13,10 @@ namespace Volo.Abp.Identity public bool IsDefault { get; set; } public bool IsPublic { get; set; } + + protected IdentityRoleCreateOrUpdateDtoBase() : base(false) + { + + } } } \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserCreateOrUpdateDtoBase.cs b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserCreateOrUpdateDtoBase.cs index e06ea8b987..41981b2ca8 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserCreateOrUpdateDtoBase.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserCreateOrUpdateDtoBase.cs @@ -32,5 +32,10 @@ namespace Volo.Abp.Identity [CanBeNull] public string[] RoleNames { get; set; } + + protected IdentityUserCreateOrUpdateDtoBase() : base(false) + { + + } } } \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebAutoMapperProfile.cs b/modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebAutoMapperProfile.cs index b0154f543f..f7dfc69099 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebAutoMapperProfile.cs +++ b/modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebAutoMapperProfile.cs @@ -22,7 +22,7 @@ namespace Volo.Abp.Identity.Web //CreateModal CreateMap() - .Ignore(x => x.ExtraProperties) + .MapExtraProperties() .ForMember(dest => dest.RoleNames, opt => opt.Ignore()); CreateMap() @@ -30,7 +30,7 @@ namespace Volo.Abp.Identity.Web //EditModal CreateMap() - .Ignore(x => x.ExtraProperties) + .MapExtraProperties() .ForMember(dest => dest.RoleNames, opt => opt.Ignore()); CreateMap() @@ -44,11 +44,11 @@ namespace Volo.Abp.Identity.Web //CreateModal CreateMap() - .Ignore(x => x.ExtraProperties); + .MapExtraProperties(); //EditModal CreateMap() - .Ignore(x => x.ExtraProperties); + .MapExtraProperties(); } } } diff --git a/modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebModule.cs b/modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebModule.cs index 79b636418c..23a4529502 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebModule.cs +++ b/modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebModule.cs @@ -7,6 +7,8 @@ using Volo.Abp.AutoMapper; using Volo.Abp.Identity.Localization; using Volo.Abp.Identity.Web.Navigation; using Volo.Abp.Modularity; +using Volo.Abp.ObjectExtending; +using Volo.Abp.ObjectExtending.Modularity; using Volo.Abp.PermissionManagement.Web; using Volo.Abp.UI.Navigation; using Volo.Abp.VirtualFileSystem; @@ -62,5 +64,24 @@ namespace Volo.Abp.Identity.Web options.Conventions.AuthorizePage("/Identity/Roles/EditModal", IdentityPermissions.Roles.Update); }); } + + public override void PostConfigureServices(ServiceConfigurationContext context) + { + ModuleExtensionConfigurationHelper + .ApplyEntityConfigurationToUi( + IdentityModuleExtensionConsts.ModuleName, + IdentityModuleExtensionConsts.EntityNames.Role, + createFormTypes: new[] { typeof(Volo.Abp.Identity.Web.Pages.Identity.Roles.CreateModalModel.RoleInfoModel) }, + editFormTypes: new[] { typeof(Volo.Abp.Identity.Web.Pages.Identity.Roles.EditModalModel.RoleInfoModel) } + ); + + ModuleExtensionConfigurationHelper + .ApplyEntityConfigurationToUi( + IdentityModuleExtensionConsts.ModuleName, + IdentityModuleExtensionConsts.EntityNames.User, + createFormTypes: new[] { typeof(Volo.Abp.Identity.Web.Pages.Identity.Users.CreateModalModel.UserInfoViewModel) }, + editFormTypes: new[] { typeof(Volo.Abp.Identity.Web.Pages.Identity.Users.EditModalModel.UserInfoViewModel) } + ); + } } } diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/CreateModal.cshtml b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/CreateModal.cshtml index ce075d0b58..72ea9da317 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/CreateModal.cshtml +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/CreateModal.cshtml @@ -1,9 +1,14 @@ @page @using Microsoft.AspNetCore.Mvc.Localization +@using Microsoft.Extensions.Localization @using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal @using Volo.Abp.Identity.Localization -@model Volo.Abp.Identity.Web.Pages.Identity.Roles.CreateModalModel +@using Volo.Abp.Identity.Web.Pages.Identity.Roles +@using Volo.Abp.Localization +@using Volo.Abp.ObjectExtending +@model CreateModalModel @inject IHtmlLocalizer L +@inject IStringLocalizerFactory StringLocalizerFactory @{ Layout = null; } @@ -12,8 +17,27 @@ + + + + @foreach (var propertyInfo in ObjectExtensionManager.Instance.GetProperties()) + { + if (propertyInfo.Type.IsEnum) + { + + } + else + { + + } + } diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/CreateModal.cshtml.cs b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/CreateModal.cshtml.cs index df86acd94d..79787da08b 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/CreateModal.cshtml.cs +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/CreateModal.cshtml.cs @@ -1,6 +1,7 @@ using System.ComponentModel.DataAnnotations; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; +using Volo.Abp.ObjectExtending; using Volo.Abp.Validation; namespace Volo.Abp.Identity.Web.Pages.Identity.Roles @@ -19,6 +20,8 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Roles public virtual Task OnGetAsync() { + Role = new RoleInfoModel(); + return Task.FromResult(Page()); } @@ -32,7 +35,7 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Roles return NoContent(); } - public class RoleInfoModel + public class RoleInfoModel : ExtensibleObject { [Required] [DynamicStringLength(typeof(IdentityRoleConsts), nameof(IdentityRoleConsts.MaxNameLength))] diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml index 0a3cd3668d..8ef33b32cc 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml @@ -1,9 +1,14 @@ @page @using Microsoft.AspNetCore.Mvc.Localization +@using Microsoft.Extensions.Localization @using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal @using Volo.Abp.Identity.Localization -@model Volo.Abp.Identity.Web.Pages.Identity.Roles.EditModalModel +@using Volo.Abp.Identity.Web.Pages.Identity.Roles +@using Volo.Abp.Localization +@using Volo.Abp.ObjectExtending +@model EditModalModel @inject IHtmlLocalizer L +@inject IStringLocalizerFactory StringLocalizerFactory @{ Layout = null; } @@ -12,7 +17,9 @@ + + @if (Model.Role.IsStatic) { @@ -21,8 +28,27 @@ { } + + + + @foreach (var propertyInfo in ObjectExtensionManager.Instance.GetProperties()) + { + if (propertyInfo.Type.IsEnum) + { + + } + else + { + + } + } diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml.cs b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml.cs index 8a004e95a5..14236c1466 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml.cs +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml.cs @@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Volo.Abp.Domain.Entities; +using Volo.Abp.ObjectExtending; using Volo.Abp.Validation; namespace Volo.Abp.Identity.Web.Pages.Identity.Roles @@ -36,7 +37,7 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Roles return NoContent(); } - public class RoleInfoModel : IHasConcurrencyStamp + public class RoleInfoModel : ExtensibleObject, IHasConcurrencyStamp { [HiddenInput] public Guid Id { get; set; } diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/Index.cshtml b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/Index.cshtml index 4658f44013..734fc40fe5 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/Index.cshtml +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/Index.cshtml @@ -41,13 +41,6 @@ - - - - @L["Actions"] - @L["RoleName"] - - - + \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/index.js b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/index.js index 4331ab4229..d66d7240e3 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/index.js +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/index.js @@ -12,76 +12,76 @@ abp.appPath + 'Identity/Roles/CreateModal' ); - $(function () { - var _$wrapper = $('#IdentityRolesWrapper'); - var _$table = _$wrapper.find('table'); + var _dataTable = null; - var _dataTable = _$table.DataTable( - abp.libs.datatables.normalizeConfiguration({ - order: [[1, 'asc']], - searching: false, - processing: true, - serverSide: true, - scrollX: true, - paging: true, - ajax: abp.libs.datatables.createAjax( - _identityRoleAppService.getList - ), - columnDefs: [ + abp.ui.extensions.entityActions.get('identity.role').addContributor( + function(actionList) { + return actionList.addManyTail( + [ { - rowAction: { - items: [ - { - text: l('Edit'), - visible: abp.auth.isGranted( - 'AbpIdentity.Roles.Update' - ), - action: function (data) { - _editModal.open({ - id: data.record.id, - }); - }, - }, - { - text: l('Permissions'), - visible: abp.auth.isGranted( - 'AbpIdentity.Roles.ManagePermissions' - ), - action: function (data) { - _permissionsModal.open({ - providerName: 'R', - providerKey: data.record.name, - }); - }, - }, - { - text: l('Delete'), - visible: function (data) { - return ( - !data.isStatic && - abp.auth.isGranted( - 'AbpIdentity.Roles.Delete' - ) - ); //TODO: Check permission - }, - confirmMessage: function (data) { - return l( - 'RoleDeletionConfirmationMessage', - data.record.name - ); - }, - action: function (data) { - _identityRoleAppService - .delete(data.record.id) - .then(function () { - _dataTable.ajax.reload(); - }); - }, - }, - ], + text: l('Edit'), + visible: abp.auth.isGranted( + 'AbpIdentity.Roles.Update' + ), + action: function (data) { + _editModal.open({ + id: data.record.id, + }); + }, + }, + { + text: l('Permissions'), + visible: abp.auth.isGranted( + 'AbpIdentity.Roles.ManagePermissions' + ), + action: function (data) { + _permissionsModal.open({ + providerName: 'R', + providerKey: data.record.name, + }); + }, + }, + { + text: l('Delete'), + visible: function (data) { + return ( + !data.isStatic && + abp.auth.isGranted( + 'AbpIdentity.Roles.Delete' + ) + ); //TODO: Check permission + }, + confirmMessage: function (data) { + return l( + 'RoleDeletionConfirmationMessage', + data.record.name + ); }, + action: function (data) { + _identityRoleAppService + .delete(data.record.id) + .then(function () { + _dataTable.ajax.reload(); + }); + }, + } + ] + ); + } + ); + + abp.ui.extensions.tableColumns.get('identity.role').addContributor( + function (columnList) { + columnList.addManyTail( + [ + { + title: l("Actions"), + rowAction: { + items: abp.ui.extensions.entityActions.get('identity.role').actions.toArray() + } }, { + title: l('RoleName'), data: 'name', render: function (data, type, row) { var name = '' + data + ''; @@ -99,8 +99,29 @@ } return name; }, - }, - ], + } + ] + ); + }, + 0 //adds as the first contributor + ); + + $(function () { + var _$wrapper = $('#IdentityRolesWrapper'); + var _$table = _$wrapper.find('table'); + + _dataTable = _$table.DataTable( + abp.libs.datatables.normalizeConfiguration({ + order: [[1, 'asc']], + searching: false, + processing: true, + serverSide: true, + scrollX: true, + paging: true, + ajax: abp.libs.datatables.createAjax( + _identityRoleAppService.getList + ), + columnDefs: abp.ui.extensions.tableColumns.get('identity.role').columns.toArray() }) ); diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml index d20d0a0026..b171b785a2 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml @@ -1,9 +1,14 @@ @page @using Microsoft.AspNetCore.Mvc.Localization +@using Microsoft.Extensions.Localization @using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal @using Volo.Abp.Identity.Localization -@model Volo.Abp.Identity.Web.Pages.Identity.Users.CreateModalModel +@using Volo.Abp.Identity.Web.Pages.Identity.Users +@using Volo.Abp.Localization +@using Volo.Abp.ObjectExtending +@model CreateModalModel @inject IHtmlLocalizer L +@inject IStringLocalizerFactory StringLocalizerFactory @{ Layout = null; } @@ -22,6 +27,23 @@ + + @foreach (var propertyInfo in ObjectExtensionManager.Instance.GetProperties()) + { + if (propertyInfo.Type.IsEnum) + { + + } + else + { + + } + } @for (var i = 0; i < Model.Roles.Length; i++) diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml.cs b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml.cs index 6149c676b8..a868890632 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml.cs +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Volo.Abp.Auditing; using Volo.Abp.Application.Dtos; +using Volo.Abp.ObjectExtending; using Volo.Abp.Validation; namespace Volo.Abp.Identity.Web.Pages.Identity.Users @@ -52,7 +53,7 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Users return NoContent(); } - public class UserInfoViewModel + public class UserInfoViewModel : ExtensibleObject { [Required] [DynamicStringLength(typeof(IdentityUserConsts), nameof(IdentityUserConsts.MaxUserNameLength))] diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml index 26962350e0..56ac3929f1 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml @@ -1,9 +1,14 @@ @page @using Microsoft.AspNetCore.Mvc.Localization +@using Microsoft.Extensions.Localization @using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal @using Volo.Abp.Identity.Localization -@model Volo.Abp.Identity.Web.Pages.Identity.Users.EditModalModel +@using Volo.Abp.Identity.Web.Pages.Identity.Users +@using Volo.Abp.Localization +@using Volo.Abp.ObjectExtending +@model EditModalModel @inject IHtmlLocalizer L +@inject IStringLocalizerFactory StringLocalizerFactory @{ Layout = null; } @@ -24,6 +29,24 @@ + + @foreach (var propertyInfo in ObjectExtensionManager.Instance.GetProperties()) + { + if (propertyInfo.Type.IsEnum) + { + + } + else + { + + } + } + @for (var i = 0; i < Model.Roles.Length; i++) diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs index 08c5ae0dd9..a2336c2b8e 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Mvc; using Volo.Abp.Auditing; using Volo.Abp.Application.Dtos; using Volo.Abp.Domain.Entities; +using Volo.Abp.ObjectExtending; using Volo.Abp.Validation; namespace Volo.Abp.Identity.Web.Pages.Identity.Users @@ -55,7 +56,7 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Users return NoContent(); } - public class UserInfoViewModel : IHasConcurrencyStamp + public class UserInfoViewModel : ExtensibleObject, IHasConcurrencyStamp { [HiddenInput] public Guid Id { get; set; } diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/Index.cshtml b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/Index.cshtml index 23f7747ac8..ee9192d58f 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/Index.cshtml +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/Index.cshtml @@ -42,15 +42,6 @@ - - - - @L["Actions"] - @L["UserName"] - @L["EmailAddress"] - @L["PhoneNumber"] - - - + \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/index.js b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/index.js index 53f66ddb5e..71675d8b8e 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/index.js +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/index.js @@ -12,10 +12,91 @@ abp.appPath + 'AbpPermissionManagement/PermissionManagementModal' ); + var _dataTable = null; + + abp.ui.extensions.entityActions.get('identity.user').addContributor( + function(actionList) { + return actionList.addManyTail( + [ + { + text: l('Edit'), + visible: abp.auth.isGranted( + 'AbpIdentity.Users.Update' + ), + action: function (data) { + _editModal.open({ + id: data.record.id, + }); + }, + }, + { + text: l('Permissions'), + visible: abp.auth.isGranted( + 'AbpIdentity.Users.ManagePermissions' + ), + action: function (data) { + _permissionsModal.open({ + providerName: 'U', + providerKey: data.record.id, + }); + }, + }, + { + text: l('Delete'), + visible: abp.auth.isGranted( + 'AbpIdentity.Users.Delete' + ), + confirmMessage: function (data) { + return l( + 'UserDeletionConfirmationMessage', + data.record.userName + ); + }, + action: function (data) { + _identityUserAppService + .delete(data.record.id) + .then(function () { + _dataTable.ajax.reload(); + }); + }, + } + ] + ); + } + ); + + abp.ui.extensions.tableColumns.get('identity.user').addContributor( + function (columnList) { + columnList.addManyTail( + [ + { + title: l("Actions"), + rowAction: { + items: abp.ui.extensions.entityActions.get('identity.user').actions.toArray() + } + }, + { + title: l('UserName'), + data: 'userName', + }, + { + title: l('EmailAddress'), + data: 'email', + }, + { + title: l('PhoneNumber'), + data: 'phoneNumber', + } + ] + ); + }, + 0 //adds as the first contributor + ); + $(function () { var _$wrapper = $('#IdentityUsersWrapper'); var _$table = _$wrapper.find('table'); - var _dataTable = _$table.DataTable( + _dataTable = _$table.DataTable( abp.libs.datatables.normalizeConfiguration({ order: [[1, 'asc']], processing: true, @@ -25,65 +106,7 @@ ajax: abp.libs.datatables.createAjax( _identityUserAppService.getList ), - columnDefs: [ - { - rowAction: { - items: [ - { - text: l('Edit'), - visible: abp.auth.isGranted( - 'AbpIdentity.Users.Update' - ), - action: function (data) { - _editModal.open({ - id: data.record.id, - }); - }, - }, - { - text: l('Permissions'), - visible: abp.auth.isGranted( - 'AbpIdentity.Users.ManagePermissions' - ), - action: function (data) { - _permissionsModal.open({ - providerName: 'U', - providerKey: data.record.id, - }); - }, - }, - { - text: l('Delete'), - visible: abp.auth.isGranted( - 'AbpIdentity.Users.Delete' - ), - confirmMessage: function (data) { - return l( - 'UserDeletionConfirmationMessage', - data.record.userName - ); - }, - action: function (data) { - _identityUserAppService - .delete(data.record.id) - .then(function () { - _dataTable.ajax.reload(); - }); - }, - }, - ], - }, - }, - { - data: 'userName', - }, - { - data: 'email', - }, - { - data: 'phoneNumber', - }, - ], + columnDefs: abp.ui.extensions.tableColumns.get('identity.user').columns.toArray() }) ); diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/Index.js b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/Index.js index b168fe0fb6..4b19d0bbb7 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/Index.js +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/Index.js @@ -17,69 +17,79 @@ modalClass: 'TenantConnectionStringManagement', }); - abp.ui.extensions.tableColumns.get("tenant").addContributor( + var _dataTable = null; + + abp.ui.extensions.entityActions.get('tenantManagement.tenant').addContributor( + function(actionList) { + return actionList.addManyTail( + [ + { + text: l('Edit'), + visible: abp.auth.isGranted( + 'AbpTenantManagement.Tenants.Update' + ), + action: function (data) { + _editModal.open({ + id: data.record.id, + }); + }, + }, + { + text: l('ConnectionStrings'), + visible: abp.auth.isGranted( + 'AbpTenantManagement.Tenants.ManageConnectionStrings' + ), + action: function (data) { + _connectionStringsModal.open({ + id: data.record.id, + }); + }, + }, + { + text: l('Features'), + visible: abp.auth.isGranted( + 'AbpTenantManagement.Tenants.ManageFeatures' + ), + action: function (data) { + _featuresModal.open({ + providerName: 'T', + providerKey: data.record.id, + }); + }, + }, + { + text: l('Delete'), + visible: abp.auth.isGranted( + 'AbpTenantManagement.Tenants.Delete' + ), + confirmMessage: function (data) { + return l( + 'TenantDeletionConfirmationMessage', + data.record.name + ); + }, + action: function (data) { + _tenantAppService + .delete(data.record.id) + .then(function () { + _dataTable.ajax.reload(); + }); + }, + } + ] + ); + } + ); + + abp.ui.extensions.tableColumns.get('tenantManagement.tenant').addContributor( function (columnList) { columnList.addManyTail( [ { title: l("Actions"), rowAction: { - items: [ - { - text: l('Edit'), - visible: abp.auth.isGranted( - 'AbpTenantManagement.Tenants.Update' - ), - action: function (data) { - _editModal.open({ - id: data.record.id, - }); - }, - }, - { - text: l('ConnectionStrings'), - visible: abp.auth.isGranted( - 'AbpTenantManagement.Tenants.ManageConnectionStrings' - ), - action: function (data) { - _connectionStringsModal.open({ - id: data.record.id, - }); - }, - }, - { - text: l('Features'), - visible: abp.auth.isGranted( - 'AbpTenantManagement.Tenants.ManageFeatures' - ), - action: function (data) { - _featuresModal.open({ - providerName: 'T', - providerKey: data.record.id, - }); - }, - }, - { - text: l('Delete'), - visible: abp.auth.isGranted( - 'AbpTenantManagement.Tenants.Delete' - ), - confirmMessage: function (data) { - return l( - 'TenantDeletionConfirmationMessage', - data.record.name - ); - }, - action: function (data) { - _tenantAppService - .delete(data.record.id) - .then(function () { - _dataTable.ajax.reload(); - }); - }, - }, - ], - }, + items: abp.ui.extensions.entityActions.get('tenantManagement.tenant').actions.toArray() + } }, { title: l("TenantName"), @@ -94,7 +104,7 @@ $(function () { var _$wrapper = $('#TenantsWrapper'); - var _dataTable = _$wrapper.find('table').DataTable( + _dataTable = _$wrapper.find('table').DataTable( abp.libs.datatables.normalizeConfiguration({ order: [[1, 'asc']], processing: true, @@ -102,7 +112,7 @@ scrollX: true, serverSide: true, ajax: abp.libs.datatables.createAjax(_tenantAppService.getList), - columnDefs: abp.ui.extensions.tableColumns.get("tenant").columns.toArray(), + columnDefs: abp.ui.extensions.tableColumns.get('tenantManagement.tenant').columns.toArray(), }) );