Browse Source

Added entity extension base to Identity module

pull/4861/head
Ahmet Çotur 6 years ago
parent
commit
79f11ee763
  1. 23
      modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/AbpIdentityApplicationContractsModule.cs
  2. 5
      modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityRoleCreateOrUpdateDtoBase.cs
  3. 5
      modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserCreateOrUpdateDtoBase.cs
  4. 8
      modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebAutoMapperProfile.cs
  5. 21
      modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebModule.cs
  6. 26
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/CreateModal.cshtml
  7. 5
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/CreateModal.cshtml.cs
  8. 28
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml
  9. 3
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml.cs
  10. 9
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/Index.cshtml
  11. 155
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/index.js
  12. 24
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml
  13. 3
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml.cs
  14. 25
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml
  15. 3
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs
  16. 11
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/Index.cshtml
  17. 143
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/index.js
  18. 128
      modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/Index.js

23
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) }
);
}
}
}

5
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)
{
}
}
}

5
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)
{
}
}
}

8
modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebAutoMapperProfile.cs

@ -22,7 +22,7 @@ namespace Volo.Abp.Identity.Web
//CreateModal
CreateMap<CreateUserModalModel.UserInfoViewModel, IdentityUserCreateDto>()
.Ignore(x => x.ExtraProperties)
.MapExtraProperties()
.ForMember(dest => dest.RoleNames, opt => opt.Ignore());
CreateMap<IdentityRoleDto, CreateUserModalModel.AssignedRoleViewModel>()
@ -30,7 +30,7 @@ namespace Volo.Abp.Identity.Web
//EditModal
CreateMap<EditUserModalModel.UserInfoViewModel, IdentityUserUpdateDto>()
.Ignore(x => x.ExtraProperties)
.MapExtraProperties()
.ForMember(dest => dest.RoleNames, opt => opt.Ignore());
CreateMap<IdentityRoleDto, EditUserModalModel.AssignedRoleViewModel>()
@ -44,11 +44,11 @@ namespace Volo.Abp.Identity.Web
//CreateModal
CreateMap<CreateModalModel.RoleInfoModel, IdentityRoleCreateDto>()
.Ignore(x => x.ExtraProperties);
.MapExtraProperties();
//EditModal
CreateMap<EditModalModel.RoleInfoModel, IdentityRoleUpdateDto>()
.Ignore(x => x.ExtraProperties);
.MapExtraProperties();
}
}
}

21
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) }
);
}
}
}

26
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<IdentityResource> L
@inject IStringLocalizerFactory StringLocalizerFactory
@{
Layout = null;
}
@ -12,8 +17,27 @@
<abp-modal-header title="@L["NewRole"].Value"></abp-modal-header>
<abp-modal-body>
<abp-input asp-for="Role.Name" />
<abp-input asp-for="Role.IsDefault" />
<abp-input asp-for="Role.IsPublic" />
@foreach (var propertyInfo in ObjectExtensionManager.Instance.GetProperties<CreateModalModel.RoleInfoModel>())
{
if (propertyInfo.Type.IsEnum)
{
<abp-select asp-for="Role.ExtraProperties[propertyInfo.Name]"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"></abp-select>
}
else
{
<abp-input type="@propertyInfo.GetInputType()"
asp-for="Role.ExtraProperties[propertyInfo.Name]"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
asp-format="@propertyInfo.GetInputFormatOrNull()"
value="@propertyInfo.GetInputValueOrNull(Model.Role.ExtraProperties[propertyInfo.Name])" />
}
}
</abp-modal-body>
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"></abp-modal-footer>
</abp-modal>

5
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<IActionResult> OnGetAsync()
{
Role = new RoleInfoModel();
return Task.FromResult<IActionResult>(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))]

28
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<IdentityResource> L
@inject IStringLocalizerFactory StringLocalizerFactory
@{
Layout = null;
}
@ -12,7 +17,9 @@
<abp-modal-header title="@L["Edit"].Value"></abp-modal-header>
<abp-modal-body>
<abp-input asp-for="Role.Id" />
<abp-input asp-for="Role.ConcurrencyStamp" />
@if (Model.Role.IsStatic)
{
<abp-input asp-for="Role.Name" readonly="true" />
@ -21,8 +28,27 @@
{
<abp-input asp-for="Role.Name" />
}
<abp-input asp-for="Role.IsDefault" />
<abp-input asp-for="Role.IsPublic" />
@foreach (var propertyInfo in ObjectExtensionManager.Instance.GetProperties<CreateModalModel.RoleInfoModel>())
{
if (propertyInfo.Type.IsEnum)
{
<abp-select asp-for="Role.ExtraProperties[propertyInfo.Name]"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"></abp-select>
}
else
{
<abp-input type="@propertyInfo.GetInputType()"
asp-for="Role.ExtraProperties[propertyInfo.Name]"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
asp-format="@propertyInfo.GetInputFormatOrNull()"
value="@propertyInfo.GetInputValueOrNull(Model.Role.ExtraProperties[propertyInfo.Name])" />
}
}
</abp-modal-body>
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"></abp-modal-footer>
</abp-modal>

3
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; }

9
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/Index.cshtml

@ -41,13 +41,6 @@
</abp-row>
</abp-card-header>
<abp-card-body>
<abp-table striped-rows="true" class="nowrap">
<thead>
<tr>
<th>@L["Actions"]</th>
<th>@L["RoleName"]</th>
</tr>
</thead>
</abp-table>
<abp-table striped-rows="true" class="nowrap"></abp-table>
</abp-card-body>
</abp-card>

155
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 = '<span>' + data + '</span>';
@ -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()
})
);

24
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<IdentityResource> L
@inject IStringLocalizerFactory StringLocalizerFactory
@{
Layout = null;
}
@ -22,6 +27,23 @@
<abp-input asp-for="UserInfo.PhoneNumber" />
<abp-input asp-for="UserInfo.LockoutEnabled" />
<abp-input asp-for="UserInfo.TwoFactorEnabled" />
@foreach (var propertyInfo in ObjectExtensionManager.Instance.GetProperties<CreateModalModel.UserInfoViewModel>())
{
if (propertyInfo.Type.IsEnum)
{
<abp-select asp-for="UserInfo.ExtraProperties[propertyInfo.Name]"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"></abp-select>
}
else
{
<abp-input type="@propertyInfo.GetInputType()"
asp-for="UserInfo.ExtraProperties[propertyInfo.Name]"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
asp-format="@propertyInfo.GetInputFormatOrNull()"
value="@propertyInfo.GetInputValueOrNull(Model.UserInfo.ExtraProperties[propertyInfo.Name])" />
}
}
</abp-tab>
<abp-tab title="@L["Roles"].Value">
@for (var i = 0; i < Model.Roles.Length; i++)

3
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))]

25
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<IdentityResource> L
@inject IStringLocalizerFactory StringLocalizerFactory
@{
Layout = null;
}
@ -24,6 +29,24 @@
<abp-input asp-for="UserInfo.PhoneNumber" />
<abp-input asp-for="UserInfo.LockoutEnabled" />
<abp-input asp-for="UserInfo.TwoFactorEnabled" />
@foreach (var propertyInfo in ObjectExtensionManager.Instance.GetProperties<EditModalModel.UserInfoViewModel>())
{
if (propertyInfo.Type.IsEnum)
{
<abp-select asp-for="UserInfo.ExtraProperties[propertyInfo.Name]"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"></abp-select>
}
else
{
<abp-input type="@propertyInfo.GetInputType()"
asp-for="UserInfo.ExtraProperties[propertyInfo.Name]"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
asp-format="@propertyInfo.GetInputFormatOrNull()"
value="@propertyInfo.GetInputValueOrNull(Model.UserInfo.ExtraProperties[propertyInfo.Name])" />
}
}
</abp-tab>
<abp-tab title="@L["Roles"].Value">
@for (var i = 0; i < Model.Roles.Length; i++)

3
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; }

11
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/Index.cshtml

@ -42,15 +42,6 @@
</abp-row>
</abp-card-header>
<abp-card-body>
<abp-table striped-rows="true" class="nowrap">
<thead>
<tr>
<th>@L["Actions"]</th>
<th>@L["UserName"]</th>
<th>@L["EmailAddress"]</th>
<th>@L["PhoneNumber"]</th>
</tr>
</thead>
</abp-table>
<abp-table striped-rows="true" class="nowrap"></abp-table>
</abp-card-body>
</abp-card>

143
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()
})
);

128
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(),
})
);

Loading…
Cancel
Save