Browse Source

增加身份资源管理功能

pull/1/head
cKey 6 years ago
parent
commit
a7bd380e74
  1. 20
      aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/AbpIdentityServerErrorConsts.cs
  2. 11
      aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/AbpIdentityServerPermissionDefinitionProvider.cs
  3. 15
      aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/AbpIdentityServerPermissions.cs
  4. 4
      aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientCloneInputDto.cs
  5. 7
      aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityClaimDto.cs
  6. 37
      aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceCreateDto.cs
  7. 39
      aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceDto.cs
  8. 9
      aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceGetByIdInputDto.cs
  9. 9
      aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceGetByPagedInputDto.cs
  10. 23
      aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourcePropertyCreateDto.cs
  11. 9
      aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourcePropertyDto.cs
  12. 15
      aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourcePropertyGetByKeyDto.cs
  13. 44
      aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceUpdateDto.cs
  14. 23
      aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/IIdentityResourceAppService.cs
  15. 8
      aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Localization/Resources/en.json
  16. 8
      aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Localization/Resources/zh-Hans.json
  17. 19
      aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application/LINGYUN/Abp/IdentityServer/AbpIdentityServerAutoMapperProfile.cs
  18. 6
      aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application/LINGYUN/Abp/IdentityServer/ApiResources/ApiResourceAppService.cs
  19. 121
      aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application/LINGYUN/Abp/IdentityServer/IdentityResources/IdentityResourceAppService.cs
  20. 66
      aspnet-core/modules/identityServer/LINGYUN.IdentityServer.HttpApi/LINGYUN/Abp/IdentityServer/IdentityResources/IdentityResourceController.cs
  21. 6
      aspnet-core/services/start-all.bat
  22. 2
      aspnet-core/services/start-apigateway-host.cmd
  23. 245
      vueJs/src/api/identityresources.ts
  24. 1
      vueJs/src/api/types.ts
  25. 69
      vueJs/src/lang/zh.ts
  26. 12
      vueJs/src/router/index.ts
  27. 14
      vueJs/src/views/admin/identityServer/api-resources/components/ApiResourceCreateOrEditForm.vue
  28. 7
      vueJs/src/views/admin/identityServer/api-resources/components/ApiResourceScopeEditForm.vue
  29. 5
      vueJs/src/views/admin/identityServer/api-resources/components/ApiResourceSecretEditForm.vue
  30. 14
      vueJs/src/views/admin/identityServer/api-resources/index.vue
  31. 9
      vueJs/src/views/admin/identityServer/client/components/ClientEditForm.vue
  32. 196
      vueJs/src/views/admin/identityServer/identity-resources/components/IdentityResourceCreateOrEditForm.vue
  33. 173
      vueJs/src/views/admin/identityServer/identity-resources/components/IdentityResourcePropertyEditForm.vue
  34. 367
      vueJs/src/views/admin/identityServer/identity-resources/index.vue
  35. 34
      vueJs/src/views/admin/users/components/UserProfile.vue
  36. 1
      vueJs/src/views/admin/users/index.vue

20
aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/AbpIdentityServerErrorConsts.cs

@ -7,6 +7,21 @@
/// </summary> /// </summary>
public const string ClientIdExisted = "ClientIdExisted"; public const string ClientIdExisted = "ClientIdExisted";
/// <summary>
/// Api资源已经存在
/// </summary>
public const string ApiResourceNameExisted = "ApiResourceNameExisted";
/// <summary>
/// 身份资源已经存在
/// </summary>
public const string IdentityResourceNameExisted = "IdentityResourceNameExisted";
/// <summary>
/// 身份资源属性已经存在
/// </summary>
public const string IdentityResourcePropertyExisted = "IdentityResourcePropertyExisted";
/// <summary> /// <summary>
/// 客户端声明不存在 /// 客户端声明不存在
/// </summary> /// </summary>
@ -21,5 +36,10 @@
/// 客户端属性不存在 /// 客户端属性不存在
/// </summary> /// </summary>
public const string ClientPropertyNotFound = "ClientPropertyNotFound"; public const string ClientPropertyNotFound = "ClientPropertyNotFound";
/// <summary>
/// 身份资源属性不存在
/// </summary>
public const string IdentityResourcePropertyNotFound = "IdentityResourcePropertyNotFound";
} }
} }

11
aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/AbpIdentityServerPermissionDefinitionProvider.cs

@ -55,6 +55,17 @@ namespace LINGYUN.Abp.IdentityServer
apiResourceSecretPermissions.AddChild(AbpIdentityServerPermissions.ApiResources.Secrets.Create, L("Permissions:Create")); apiResourceSecretPermissions.AddChild(AbpIdentityServerPermissions.ApiResources.Secrets.Create, L("Permissions:Create"));
apiResourceSecretPermissions.AddChild(AbpIdentityServerPermissions.ApiResources.Secrets.Update, L("Permissions:Update")); apiResourceSecretPermissions.AddChild(AbpIdentityServerPermissions.ApiResources.Secrets.Update, L("Permissions:Update"));
apiResourceSecretPermissions.AddChild(AbpIdentityServerPermissions.ApiResources.Secrets.Delete, L("Permissions:Delete")); apiResourceSecretPermissions.AddChild(AbpIdentityServerPermissions.ApiResources.Secrets.Delete, L("Permissions:Delete"));
// 身份资源权限
var identityResourcePermissions = identityServerGroup.AddPermission(AbpIdentityServerPermissions.IdentityResources.Default, L("Permissions:IdentityResources"));
identityResourcePermissions.AddChild(AbpIdentityServerPermissions.IdentityResources.Create, L("Permissions:Create"));
identityResourcePermissions.AddChild(AbpIdentityServerPermissions.IdentityResources.Update, L("Permissions:Update"));
identityResourcePermissions.AddChild(AbpIdentityServerPermissions.IdentityResources.Delete, L("Permissions:Delete"));
// 身份资源属性权限
var identityResourcePropertyPermissiosn = identityResourcePermissions.AddChild(AbpIdentityServerPermissions.IdentityResources.Properties.Default, L("Permissions:IdentityResources:Properties"));
identityResourcePropertyPermissiosn.AddChild(AbpIdentityServerPermissions.IdentityResources.Properties.Create, L("Permissions:Create"));
identityResourcePropertyPermissiosn.AddChild(AbpIdentityServerPermissions.IdentityResources.Properties.Delete, L("Permissions:Delete"));
} }
protected virtual LocalizableString L(string name) protected virtual LocalizableString L(string name)

15
aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/AbpIdentityServerPermissions.cs

@ -62,5 +62,20 @@
public const string Delete = Default + ".Delete"; public const string Delete = Default + ".Delete";
} }
} }
public static class IdentityResources
{
public const string Default = GroupName + ".IdentityResources";
public const string Create = Default + ".Create";
public const string Update = Default + ".Update";
public const string Delete = Default + ".Delete";
public static class Properties
{
public const string Default = IdentityResources.Default + ".Properties";
public const string Create = Default + ".Create";
public const string Delete = Default + ".Delete";
}
}
} }
} }

4
aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientCloneInputDto.cs

@ -53,11 +53,11 @@ namespace LINGYUN.Abp.IdentityServer.Clients
/// </summary> /// </summary>
public bool CopyPostLogoutRedirectUri { get; set; } public bool CopyPostLogoutRedirectUri { get; set; }
/// <summary> /// <summary>
/// 客户端 IdP 限制 /// 复制客户端属性
/// </summary> /// </summary>
public bool CopyPropertie { get; set; } public bool CopyPropertie { get; set; }
/// <summary> /// <summary>
/// 复制客户端属性 /// 复制客户端 IdP 限制
/// </summary> /// </summary>
public bool CopyIdentityProviderRestriction { get; set; } public bool CopyIdentityProviderRestriction { get; set; }
public ClientCloneInputDto() public ClientCloneInputDto()

7
aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityClaimDto.cs

@ -0,0 +1,7 @@
namespace LINGYUN.Abp.IdentityServer.IdentityResources
{
public class IdentityClaimDto
{
public string Type { get; set; }
}
}

37
aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceCreateDto.cs

@ -0,0 +1,37 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.IdentityServer.IdentityResources;
namespace LINGYUN.Abp.IdentityServer.IdentityResources
{
public class IdentityResourceCreateDto
{
[Required]
[StringLength(IdentityResourceConsts.NameMaxLength)]
public string Name { get; set; }
[StringLength(IdentityResourceConsts.DisplayNameMaxLength)]
public string DisplayName { get; set; }
[StringLength(IdentityResourceConsts.DescriptionMaxLength)]
public string Description { get; set; }
public bool Enabled { get; set; }
public bool Required { get; set; }
public bool Emphasize { get; set; }
public bool ShowInDiscoveryDocument { get; set; }
public List<IdentityClaimDto> UserClaims { get; set; }
public IdentityResourceCreateDto()
{
Enabled = true;
Required = false;
ShowInDiscoveryDocument = false;
UserClaims = new List<IdentityClaimDto>();
}
}
}

39
aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceDto.cs

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Application.Dtos;
using Volo.Abp.IdentityServer.IdentityResources;
namespace LINGYUN.Abp.IdentityServer.IdentityResources
{
public class IdentityResourceDto : FullAuditedEntityDto<Guid>
{
public string Name { get; set; }
public string DisplayName { get; set; }
public string Description { get; set; }
public string ConcurrencyStamp { get; set; }
public bool Enabled { get; set; }
public bool Required { get; set; }
public bool Emphasize { get; set; }
public bool ShowInDiscoveryDocument { get; set; }
public List<IdentityClaimDto> UserClaims { get; set; }
public List<IdentityResourcePropertyDto> Properties { get; set; }
public IdentityResourceDto()
{
UserClaims = new List<IdentityClaimDto>();
Properties = new List<IdentityResourcePropertyDto>();
}
}
}

9
aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceGetByIdInputDto.cs

@ -0,0 +1,9 @@
using System;
using Volo.Abp.Application.Dtos;
namespace LINGYUN.Abp.IdentityServer.IdentityResources
{
public class IdentityResourceGetByIdInputDto : EntityDto<Guid>
{
}
}

9
aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceGetByPagedInputDto.cs

@ -0,0 +1,9 @@
using Volo.Abp.Application.Dtos;
namespace LINGYUN.Abp.IdentityServer.IdentityResources
{
public class IdentityResourceGetByPagedInputDto : PagedAndSortedResultRequestDto
{
public string Filter { get; set; }
}
}

23
aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourcePropertyCreateDto.cs

@ -0,0 +1,23 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace LINGYUN.Abp.IdentityServer.IdentityResources
{
public class IdentityResourcePropertyCreateDto
{
[Required]
public Guid IdentityResourceId { get; set; }
[Required]
[StringLength(2000)]
public string ConcurrencyStamp { get; set; }
[Required]
[StringLength(100)]
public string Key { get; set; }
[Required]
[StringLength(2000)]
public string Value { get; set; }
}
}

9
aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourcePropertyDto.cs

@ -0,0 +1,9 @@
namespace LINGYUN.Abp.IdentityServer.IdentityResources
{
public class IdentityResourcePropertyDto
{
public string Key { get; set; }
public string Value { get; set; }
}
}

15
aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourcePropertyGetByKeyDto.cs

@ -0,0 +1,15 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace LINGYUN.Abp.IdentityServer.IdentityResources
{
public class IdentityResourcePropertyGetByKeyDto
{
[Required]
public Guid IdentityResourceId { get; set; }
[Required]
[StringLength(100)]
public string Key { get; set; }
}
}

44
aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceUpdateDto.cs

@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.IdentityServer.IdentityResources;
namespace LINGYUN.Abp.IdentityServer.IdentityResources
{
public class IdentityResourceUpdateDto
{
[Required]
public Guid Id { get; set; }
[Required]
[StringLength(2000)]
public string ConcurrencyStamp { get; set; }
[StringLength(IdentityResourceConsts.NameMaxLength)]
public string Name { get; set; }
[StringLength(IdentityResourceConsts.DisplayNameMaxLength)]
public string DisplayName { get; set; }
[StringLength(IdentityResourceConsts.DescriptionMaxLength)]
public string Description { get; set; }
public bool Enabled { get; set; }
public bool Required { get; set; }
public bool Emphasize { get; set; }
public bool ShowInDiscoveryDocument { get; set; }
public List<IdentityClaimDto> UserClaims { get; set; }
public IdentityResourceUpdateDto()
{
Enabled = true;
Required = false;
ShowInDiscoveryDocument = false;
UserClaims = new List<IdentityClaimDto>();
}
}
}

23
aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/IIdentityResourceAppService.cs

@ -0,0 +1,23 @@
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
namespace LINGYUN.Abp.IdentityServer.IdentityResources
{
public interface IIdentityResourceAppService : IApplicationService
{
Task<IdentityResourceDto> GetAsync(IdentityResourceGetByIdInputDto identityResourceGetById);
Task<PagedResultDto<IdentityResourceDto>> GetAsync(IdentityResourceGetByPagedInputDto identityResourceGetByPaged);
Task<IdentityResourceDto> CreateAsync(IdentityResourceCreateDto identityResourceCreate);
Task<IdentityResourceDto> UpdateAsync(IdentityResourceUpdateDto identityResourceUpdate);
Task DeleteAsync(IdentityResourceGetByIdInputDto identityResourceGetById);
Task<IdentityResourcePropertyDto> AddPropertyAsync(IdentityResourcePropertyCreateDto identityResourcePropertyCreate);
Task DeletePropertyAsync(IdentityResourcePropertyGetByKeyDto identityResourcePropertyGetByKey);
}
}

8
aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Localization/Resources/en.json

@ -16,9 +16,15 @@
"Permissions:ApiResources": "ApiResources", "Permissions:ApiResources": "ApiResources",
"Permissions:ApiResources:Scope": "Api scope", "Permissions:ApiResources:Scope": "Api scope",
"Permissions:ApiResources:Secrets": "Api secret", "Permissions:ApiResources:Secrets": "Api secret",
"Permissions:IdentityResources": "IdentityResources",
"Permissions:IdentityResources:Properties": "Identity property",
"ClientIdExisted": "Client id: {0} already exists!", "ClientIdExisted": "Client id: {0} already exists!",
"ApiResourceNameExisted": "Api resource name: {0} already exists!",
"IdentityResourceNameExisted": "Identity resource name: {0} already exists!",
"IdentityResourcePropertyExisted": "Identity resource property: {0} already exists!",
"ClientClaimNotFound": "Client claim: {0} not found!", "ClientClaimNotFound": "Client claim: {0} not found!",
"ClientSecretNotFound": "Client secret: {0} not found!", "ClientSecretNotFound": "Client secret: {0} not found!",
"ClientPropertyNotFound": "Client property: {0} not found!" "ClientPropertyNotFound": "Client property: {0} not found!",
"IdentityResourcePropertyNotFound": "Identity resource property: {0} not found!"
} }
} }

8
aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Localization/Resources/zh-Hans.json

@ -16,9 +16,15 @@
"Permissions:ApiResources": "Api资源管理", "Permissions:ApiResources": "Api资源管理",
"Permissions:ApiResources:Scope": "授权范围", "Permissions:ApiResources:Scope": "授权范围",
"Permissions:ApiResources:Secrets": "Api密钥", "Permissions:ApiResources:Secrets": "Api密钥",
"Permissions:IdentityResources": "身份资源管理",
"Permissions:IdentityResources:Properties": "身份资源属性",
"ClientIdExisted": "客户端标识: {0} 已经存在!", "ClientIdExisted": "客户端标识: {0} 已经存在!",
"ApiResourceNameExisted": "Api资源: {0} 已经存在!",
"IdentityResourceNameExisted": "身份资源: {0} 已经存在!",
"IdentityResourcePropertyExisted": "身份资源属性: {0} 已经存在!",
"ClientClaimNotFound": "客户端声明: {0} 不存在!", "ClientClaimNotFound": "客户端声明: {0} 不存在!",
"ClientSecretNotFound": "客户端密钥: {0} 不存在!", "ClientSecretNotFound": "客户端密钥: {0} 不存在!",
"ClientPropertyNotFound": "客户端属性: {0} 不存在!" "ClientPropertyNotFound": "客户端属性: {0} 不存在!",
"IdentityResourcePropertyNotFound": "身份资源属性: {0} 不存在!"
} }
} }

19
aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application/LINGYUN/Abp/IdentityServer/AbpIdentityServerAutoMapperProfile.cs

@ -1,8 +1,11 @@
using AutoMapper; using AutoMapper;
using LINGYUN.Abp.IdentityServer.ApiResources; using LINGYUN.Abp.IdentityServer.ApiResources;
using LINGYUN.Abp.IdentityServer.Clients; using LINGYUN.Abp.IdentityServer.Clients;
using LINGYUN.Abp.IdentityServer.IdentityResources;
using System.Collections.Generic;
using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.ApiResources;
using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Clients;
using Volo.Abp.IdentityServer.IdentityResources;
namespace LINGYUN.Abp.IdentityServer namespace LINGYUN.Abp.IdentityServer
{ {
@ -26,6 +29,22 @@ namespace LINGYUN.Abp.IdentityServer
CreateMap<ApiScopeClaim, ApiScopeClaimDto>(); CreateMap<ApiScopeClaim, ApiScopeClaimDto>();
CreateMap<ApiResourceClaim, ApiResourceClaimDto>(); CreateMap<ApiResourceClaim, ApiResourceClaimDto>();
CreateMap<ApiResource, ApiResourceDto>(); CreateMap<ApiResource, ApiResourceDto>();
CreateMap<IdentityClaim, IdentityClaimDto>();
CreateMap<IdentityResource, IdentityResourceDto>()
.ForMember(dto => dto.Properties, map => map.MapFrom((src, d) =>
{
var properties = new List<IdentityResourcePropertyDto>();
foreach (var property in src.Properties)
{
properties.Add(new IdentityResourcePropertyDto
{
Key = property.Key,
Value = property.Value
});
}
return properties;
}));
} }
} }
} }

6
aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application/LINGYUN/Abp/IdentityServer/ApiResources/ApiResourceAppService.cs

@ -3,6 +3,7 @@ using IdentityServer4.Models;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.ApiResources;
using ApiResource = Volo.Abp.IdentityServer.ApiResources.ApiResource; using ApiResource = Volo.Abp.IdentityServer.ApiResources.ApiResource;
@ -40,6 +41,11 @@ namespace LINGYUN.Abp.IdentityServer.ApiResources
[Authorize(AbpIdentityServerPermissions.ApiResources.Create)] [Authorize(AbpIdentityServerPermissions.ApiResources.Create)]
public virtual async Task<ApiResourceDto> CreateAsync(ApiResourceCreateDto apiResourceCreate) public virtual async Task<ApiResourceDto> CreateAsync(ApiResourceCreateDto apiResourceCreate)
{ {
var apiResourceExists = await ApiResourceRepository.CheckNameExistAsync(apiResourceCreate.Name);
if (apiResourceExists)
{
throw new UserFriendlyException(L[AbpIdentityServerErrorConsts.ApiResourceNameExisted, apiResourceCreate.Name]);
}
var apiResource = new ApiResource(GuidGenerator.Create(), apiResourceCreate.Name, var apiResource = new ApiResource(GuidGenerator.Create(), apiResourceCreate.Name,
apiResourceCreate.DisplayName, apiResourceCreate.Description); apiResourceCreate.DisplayName, apiResourceCreate.Description);
apiResource.Enabled = apiResourceCreate.Enabled; apiResource.Enabled = apiResourceCreate.Enabled;

121
aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application/LINGYUN/Abp/IdentityServer/IdentityResources/IdentityResourceAppService.cs

@ -0,0 +1,121 @@
using Microsoft.AspNetCore.Authorization;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.IdentityServer.IdentityResources;
namespace LINGYUN.Abp.IdentityServer.IdentityResources
{
[Authorize(AbpIdentityServerPermissions.IdentityResources.Default)]
public class IdentityResourceAppService : AbpIdentityServerAppServiceBase, IIdentityResourceAppService
{
protected IIdentityResourceRepository IdentityResourceRepository { get; }
public IdentityResourceAppService(
IIdentityResourceRepository identityResourceRepository)
{
IdentityResourceRepository = identityResourceRepository;
}
public virtual async Task<IdentityResourceDto> GetAsync(IdentityResourceGetByIdInputDto identityResourceGetById)
{
var identityResource = await IdentityResourceRepository.GetAsync(identityResourceGetById.Id);
return ObjectMapper.Map<IdentityResource, IdentityResourceDto>(identityResource);
}
public virtual async Task<PagedResultDto<IdentityResourceDto>> GetAsync(IdentityResourceGetByPagedInputDto identityResourceGetByPaged)
{
var identityResources = await IdentityResourceRepository.GetListAsync(identityResourceGetByPaged.Sorting,
identityResourceGetByPaged.SkipCount, identityResourceGetByPaged.MaxResultCount, true);
var identityResourceCount = await IdentityResourceRepository.GetCountAsync();
return new PagedResultDto<IdentityResourceDto>(identityResourceCount,
ObjectMapper.Map<List<IdentityResource>, List<IdentityResourceDto>>(identityResources));
}
[Authorize(AbpIdentityServerPermissions.IdentityResources.Create)]
public virtual async Task<IdentityResourceDto> CreateAsync(IdentityResourceCreateDto identityResourceCreate)
{
var identityResourceExists = await IdentityResourceRepository.CheckNameExistAsync(identityResourceCreate.Name);
if (identityResourceExists)
{
throw new UserFriendlyException(L[AbpIdentityServerErrorConsts.IdentityResourceNameExisted, identityResourceCreate.Name]);
}
var identityResource = new IdentityResource(GuidGenerator.Create(), identityResourceCreate.Name, identityResourceCreate.DisplayName,
identityResourceCreate.Description, identityResourceCreate.Enabled, identityResourceCreate.Required, identityResourceCreate.Emphasize,
identityResourceCreate.ShowInDiscoveryDocument);
foreach(var claim in identityResourceCreate.UserClaims)
{
identityResource.AddUserClaim(claim.Type);
}
identityResource = await IdentityResourceRepository.InsertAsync(identityResource);
return ObjectMapper.Map<IdentityResource, IdentityResourceDto>(identityResource);
}
[Authorize(AbpIdentityServerPermissions.IdentityResources.Update)]
public virtual async Task<IdentityResourceDto> UpdateAsync(IdentityResourceUpdateDto identityResourceUpdate)
{
var identityResource = await IdentityResourceRepository.GetAsync(identityResourceUpdate.Id);
identityResource.ConcurrencyStamp = identityResourceUpdate.ConcurrencyStamp;
identityResource.Name = identityResourceUpdate.Name ?? identityResource.Name;
identityResource.DisplayName = identityResourceUpdate.DisplayName ?? identityResource.DisplayName;
identityResource.Description = identityResourceUpdate.Description ?? identityResource.Description;
identityResource.Enabled = identityResourceUpdate.Enabled;
identityResource.Emphasize = identityResourceUpdate.Emphasize;
identityResource.ShowInDiscoveryDocument = identityResourceUpdate.ShowInDiscoveryDocument;
if (identityResourceUpdate.UserClaims.Count > 0)
{
identityResource.RemoveAllUserClaims();
foreach (var claim in identityResourceUpdate.UserClaims)
{
identityResource.AddUserClaim(claim.Type);
}
}
identityResource = await IdentityResourceRepository.UpdateAsync(identityResource);
return ObjectMapper.Map<IdentityResource, IdentityResourceDto>(identityResource);
}
[Authorize(AbpIdentityServerPermissions.IdentityResources.Delete)]
public virtual async Task DeleteAsync(IdentityResourceGetByIdInputDto identityResourceGetById)
{
await IdentityResourceRepository.DeleteAsync(identityResourceGetById.Id);
}
[Authorize(AbpIdentityServerPermissions.IdentityResources.Properties.Create)]
public virtual async Task<IdentityResourcePropertyDto> AddPropertyAsync(IdentityResourcePropertyCreateDto identityResourcePropertyCreate)
{
var identityResource = await IdentityResourceRepository.GetAsync(identityResourcePropertyCreate.IdentityResourceId);
if (identityResource.Properties.ContainsKey(identityResourcePropertyCreate.Key))
{
throw new UserFriendlyException(L[AbpIdentityServerErrorConsts.IdentityResourcePropertyExisted, identityResourcePropertyCreate.Key]);
}
identityResource.ConcurrencyStamp = identityResourcePropertyCreate.ConcurrencyStamp;
identityResource.Properties.Add(identityResourcePropertyCreate.Key, identityResourcePropertyCreate.Value);
await IdentityResourceRepository.UpdateAsync(identityResource);
return new IdentityResourcePropertyDto
{
Key = identityResourcePropertyCreate.Key,
Value = identityResourcePropertyCreate.Value
};
}
[Authorize(AbpIdentityServerPermissions.IdentityResources.Properties.Delete)]
public virtual async Task DeletePropertyAsync(IdentityResourcePropertyGetByKeyDto identityResourcePropertyGetByKey)
{
var identityResource = await IdentityResourceRepository.GetAsync(identityResourcePropertyGetByKey.IdentityResourceId);
if (!identityResource.Properties.ContainsKey(identityResourcePropertyGetByKey.Key))
{
throw new UserFriendlyException(L[AbpIdentityServerErrorConsts.IdentityResourcePropertyNotFound, identityResourcePropertyGetByKey.Key]);
}
identityResource.Properties.Remove(identityResourcePropertyGetByKey.Key);
await IdentityResourceRepository.UpdateAsync(identityResource);
}
}
}

66
aspnet-core/modules/identityServer/LINGYUN.IdentityServer.HttpApi/LINGYUN/Abp/IdentityServer/IdentityResources/IdentityResourceController.cs

@ -0,0 +1,66 @@
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.AspNetCore.Mvc;
namespace LINGYUN.Abp.IdentityServer.IdentityResources
{
[RemoteService(Name = AbpIdentityServerConsts.RemoteServiceName)]
[Area("IdentityServer")]
[Route("api/IdentityServer/IdentityResources")]
public class IdentityResourceController : AbpController, IIdentityResourceAppService
{
protected IIdentityResourceAppService IdentityResourceAppService { get; }
public IdentityResourceController(
IIdentityResourceAppService identityResourceAppService)
{
IdentityResourceAppService = identityResourceAppService;
}
[HttpGet]
[Route("{Id}")]
public virtual async Task<IdentityResourceDto> GetAsync(IdentityResourceGetByIdInputDto identityResourceGetById)
{
return await IdentityResourceAppService.GetAsync(identityResourceGetById);
}
[HttpGet]
public virtual async Task<PagedResultDto<IdentityResourceDto>> GetAsync(IdentityResourceGetByPagedInputDto identityResourceGetByPaged)
{
return await IdentityResourceAppService.GetAsync(identityResourceGetByPaged);
}
[HttpPost]
public virtual async Task<IdentityResourceDto> CreateAsync(IdentityResourceCreateDto identityResourceCreate)
{
return await IdentityResourceAppService.CreateAsync(identityResourceCreate);
}
[HttpPut]
public virtual async Task<IdentityResourceDto> UpdateAsync(IdentityResourceUpdateDto identityResourceUpdate)
{
return await IdentityResourceAppService.UpdateAsync(identityResourceUpdate);
}
[HttpDelete]
public virtual async Task DeleteAsync(IdentityResourceGetByIdInputDto identityResourceGetById)
{
await IdentityResourceAppService.DeleteAsync(identityResourceGetById);
}
[HttpPost]
[Route("Properties")]
public virtual async Task<IdentityResourcePropertyDto> AddPropertyAsync(IdentityResourcePropertyCreateDto identityResourcePropertyCreate)
{
return await IdentityResourceAppService.AddPropertyAsync(identityResourcePropertyCreate);
}
[HttpDelete]
[Route("Properties")]
public virtual async Task DeletePropertyAsync(IdentityResourcePropertyGetByKeyDto identityResourcePropertyGetByKey)
{
await IdentityResourceAppService.DeletePropertyAsync(identityResourcePropertyGetByKey);
}
}
}

6
aspnet-core/services/start-all.bat

@ -0,0 +1,6 @@
@echo off
cls
start .\start-identity-server.bat --run
start .\start-apigateway-admin.cmd --run
start .\start-apigateway-host.cmd --run

2
aspnet-core/services/start-apigateway-host.cmd

@ -9,7 +9,7 @@ cd .\apigateway\LINGYUN.ApiGateway.Host
if '%1' equ '--publish' goto publish if '%1' equ '--publish' goto publish
if '%1' equ '--run' goto run if '%1' equ '--run' goto run
if '%1' equ '--restore' goto restore if '%1' equ '--restore' goto restore
if '%1' equ '' goto run
:publish :publish
dotnet publish -c Release -o ..\..\Publish\apigateway-host --no-cache --no-restore dotnet publish -c Release -o ..\..\Publish\apigateway-host --no-cache --no-restore

245
vueJs/src/api/identityresources.ts

@ -0,0 +1,245 @@
import ApiService from './serviceBase'
import { pagerFormat } from '@/utils/index'
import { FullAuditedEntityDto, PagedResultDto, PagedAndSortedResultRequestDto } from './types'
/** 远程服务地址 */
const serviceUrl = process.env.VUE_APP_BASE_API
/** 身份资源Api接口 */
export default class IdentityResourceService {
/**
*
* @param id
* @returns IdentityResource
*/
public static getIdentityResourceById(id: string) {
let _url = '/api/IdentityServer/IdentityResources/'
_url += id
return ApiService.Get<IdentityResource>(_url, serviceUrl)
}
/**
*
* @param payload
* @returns IdentityResource
*/
public static getIdentityResources(payload: IdentityResourceGetByPaged) {
let _url = '/api/IdentityServer/IdentityResources'
_url += '?filter=' + payload.filter
_url += '&sorting=' + payload.sorting
_url += '&skipCount=' + pagerFormat(payload.skipCount)
_url += '&maxResultCount=' + payload.maxResultCount
return ApiService.Get<PagedResultDto<IdentityResource>>(_url, serviceUrl)
}
/**
*
* @param payload IdentityResourceCreate
* @returns IdentityResource
*/
public static createIdentityResource(payload: IdentityResourceCreate) {
const _url = '/api/IdentityServer/IdentityResources'
return ApiService.Post<IdentityResource>(_url, payload, serviceUrl)
}
/**
*
* @param payload IdentityResourceUpdate
* @returns IdentityResource
*/
public static updateIdentityResource(payload: IdentityResourceUpdate) {
const _url = '/api/IdentityServer/IdentityResources'
return ApiService.Put<IdentityResource>(_url, payload, serviceUrl)
}
/**
*
* @param id
*/
public static deleteIdentityResource(id: string) {
let _url = '/api/IdentityServer/IdentityResources'
_url += '?id=' + id
return ApiService.Delete(_url, serviceUrl)
}
/**
*
* @param payload IdentityPropertyCreate
* @returns IdentityProperty
*/
public static createProperty(payload: IdentityPropertyCreate) {
const _url = '/api/IdentityServer/IdentityResources/Properties'
return ApiService.Post<IdentityProperty>(_url, payload, serviceUrl)
}
/**
*
* @param identityResourceId
* @param key
*/
public static deleteProperty(identityResourceId: string, key: string) {
let _url = '/api/IdentityServer/IdentityResources/Properties'
_url += '?identityResourceId=' + identityResourceId
_url += '&key=' + key
return ApiService.Delete(_url, serviceUrl)
}
}
/** 身份资源用户声明 */
export class IdentityClaim {
/** 用户声明 */
type = ''
}
/** 身份资源属性 */
export class IdentityProperty {
/** 键 */
key = ''
/** 值 */
value = ''
}
/** 身份资源属性创建对象 */
export class IdentityPropertyCreate {
/** 身份资源标识 */
identityResourceId = ''
/** 键 */
key = ''
/** 值 */
value = ''
/** 并发令牌 */
concurrencyStamp = ''
/** 返回一个空对象 */
public static empty() {
return new IdentityPropertyCreate()
}
}
/** 身份资源分页查询对象 */
export class IdentityResourceGetByPaged extends PagedAndSortedResultRequestDto {
/** 过滤参数 */
filter = ''
/** 返回一个空对象 */
public static empty() {
return new IdentityResourceGetByPaged()
}
}
/** 身份资源创建对象 */
export class IdentityResourceCreate {
/** 名称 */
name = ''
/** 显示名称 */
displayName? = ''
/** 说明 */
description? = ''
/** 启用 */
enabled = true
/** 必须 */
required = false
/** 强调 */
emphasize = false
/** 在发现文档显示 */
showInDiscoveryDocument = false
/** 用户声明 */
userClaims = new Array<IdentityClaim>()
/** 返回一个空对象 */
public static empty() {
return new IdentityResourceCreate()
}
/** 创建身份资源 */
public static create(identityResource: IdentityResource) {
let resource = new IdentityResourceCreate()
resource.description = identityResource.description
resource.displayName = identityResource.displayName
resource.emphasize = identityResource.emphasize
resource.enabled = identityResource.enabled
resource.name = identityResource.name
resource.required = identityResource.required
resource.showInDiscoveryDocument = identityResource.showInDiscoveryDocument
resource.userClaims = identityResource.userClaims
return resource
}
}
/** 身份资源变更对象 */
export class IdentityResourceUpdate {
/** 身份资源标识 */
id = ''
/** 名称 */
name = ''
/** 显示名称 */
displayName? = ''
/** 说明 */
description? = ''
/** 启用 */
enabled = true
/** 必须 */
required = false
/** 强调 */
emphasize = false
/** 在发现文档显示 */
showInDiscoveryDocument = false
/** 并发令牌 */
concurrencyStamp = ''
/** 用户声明 */
userClaims = new Array<IdentityClaim>()
/** 返回一个空对象 */
public static empty() {
return new IdentityResourceUpdate()
}
/** 创建身份资源 */
public static create(identityResource: IdentityResource) {
let resource = new IdentityResourceUpdate()
resource.concurrencyStamp = identityResource.concurrencyStamp
resource.description = identityResource.description
resource.displayName = identityResource.displayName
resource.emphasize = identityResource.emphasize
resource.enabled = identityResource.enabled
resource.id = identityResource.id
resource.name = identityResource.name
resource.required = identityResource.required
resource.showInDiscoveryDocument = identityResource.showInDiscoveryDocument
resource.userClaims = identityResource.userClaims
return resource
}
}
/** 身份资源对象 */
export class IdentityResource extends FullAuditedEntityDto {
/** 身份资源标识 */
id!: string
/** 名称 */
name!: string
/** 显示名称 */
displayName?: string
/** 说明 */
description?: string
/** 并发令牌 */
concurrencyStamp!: string
/** 启用 */
enabled!: boolean
/** 必须 */
required!: boolean
/** 强调 */
emphasize!: boolean
/** 在发现文档显示 */
showInDiscoveryDocument!: boolean
/** 用户声明 */
userClaims!: IdentityClaim[]
/** 属性 */
properties!: IdentityProperty[]
/** 返回一个空对象 */
public static empty() {
const resource = new IdentityResource()
resource.enabled = true
return resource
}
}

1
vueJs/src/api/types.ts

@ -52,6 +52,7 @@ export interface IPermission {
isGranted: boolean isGranted: boolean
} }
/** 分页排序查询对象 */
export class PagedAndSortedResultRequestDto implements IPagedResultRequest, ISortedResultRequest { export class PagedAndSortedResultRequestDto implements IPagedResultRequest, ISortedResultRequest {
/** 查询页码 */ /** 查询页码 */
skipCount: number skipCount: number

69
vueJs/src/lang/zh.ts

@ -74,7 +74,8 @@ export default {
route: '路由配置', route: '路由配置',
identityServer: '身份认证服务器', identityServer: '身份认证服务器',
clients: '客户端管理', clients: '客户端管理',
apiresources: 'Api资源管理' apiresources: 'Api资源管理',
identityresources: '身份资源管理'
}, },
navbar: { navbar: {
logOut: '退出登录', logOut: '退出登录',
@ -397,10 +398,10 @@ export default {
createClaimSuccess: '客户端声明: {type} 已添加!', createClaimSuccess: '客户端声明: {type} 已添加!',
createClaim: '添加客户端声明', createClaim: '添加客户端声明',
deleteProperty: '删除属性', deleteProperty: '删除属性',
deletePropertyByType: '是否要删除客户端属性: {key}', deleteClientPropertyByType: '是否要删除客户端属性: {key}',
deletePropertySuccess: '客户端属性: {key} 已删除!', deleteClientPropertySuccess: '客户端属性: {key} 已删除!',
createPropertySuccess: '客户端属性: {key} 已添加!', createClientPropertySuccess: '客户端属性: {key} 已添加!',
createProperty: '添加客户端属性', createClientProperty: '添加客户端属性',
createClient: '添加客户端', createClient: '添加客户端',
clientId: '客户端标识', clientId: '客户端标识',
clientName: '客户端名称', clientName: '客户端名称',
@ -413,7 +414,7 @@ export default {
copyAllowedCorsOrigin: '复制客户端跨域来源', copyAllowedCorsOrigin: '复制客户端跨域来源',
copyPostLogoutRedirectUri: '复制客户端注销重定向Uri', copyPostLogoutRedirectUri: '复制客户端注销重定向Uri',
copyPropertie: '复制客户端属性', copyPropertie: '复制客户端属性',
copyIdentityProviderRestriction: '身份提供程序限制', copyIdentityProviderRestriction: '复制身份提供程序限制',
protocolType: '协议类型', protocolType: '协议类型',
requireClientSecret: '需要客户端密钥', requireClientSecret: '需要客户端密钥',
requirePkce: '需要Pkce', requirePkce: '需要Pkce',
@ -483,17 +484,59 @@ export default {
deleteApiScopeSuccess: 'Api作用域 {name} 已删除!', deleteApiScopeSuccess: 'Api作用域 {name} 已删除!',
apiResourceScope: 'Api 作用域', apiResourceScope: 'Api 作用域',
deleteApiResource: '删除资源', deleteApiResource: '删除资源',
apiResourceName: '资源名称', resourceName: '资源名称',
apiResourceDisplayName: '显示名称', resourceDisplayName: '显示名称',
enabledApiResource: '启用资源', enabledResource: '启用资源',
apiResourceStatus: '资源状态', resourceStatus: '资源状态',
apiResourceDescription: '资源说明', resourceDescription: '资源说明',
apiResourceUserClaims: '用户声明', resourceUserClaims: '用户声明',
apiScopeName: '名称', apiScopeName: '名称',
apiScopeDisplayName: '显示名称', apiScopeDisplayName: '显示名称',
apiScopeDescription: '描述', apiScopeDescription: '描述',
apiScopeRequired: '必须', apiScopeRequired: '必须',
apiScopeEmphasize: '强调', apiScopeEmphasize: '强调',
apiScopeShowInDiscoveryDocument: '在发现文档显示' apiScopeShowInDiscoveryDocument: '在发现文档显示',
createIdentityResource: '添加身份资源',
updateIdentityResource: '编辑身份资源',
identityResourceProperties: '资源属性',
deleteIdentityResource: '删除资源',
updateIdentityResourceByName: '编辑身份资源 {name}',
deleteIdentityResourceByName: '删除身份资源 {name}',
createIdentityResourceSuccess: '身份资源 {name} 已添加!',
deleteIdentityResourceSuccess: '身份资源 {name} 已删除!',
updateIdentityResourceSuccess: '身份资源 {name} 已修改!',
identityResourceRequired: '必须',
identityResourceEmphasize: '强调',
identityResourceShowInDiscoveryDocument: '在发现文档显示',
deleteIdentityPropertyByKey: '是否要删除身份资源属性: {key}',
deleteIdentityPropertySuccess: '身份资源属性: {key} 已删除!',
createIdentityPropertySuccess: '身份资源属性: {key} 已添加!',
createIdentityProperty: '添加身份资源属性'
},
global: {
name: '名称',
displayName: '显示名称',
description: '说明',
operaActions: '操作方法',
queryFilter: '查询过滤',
filterString: '过滤字符',
searchList: '查询列表',
creationTime: '创建时间',
successful: '提交成功',
pleaseInputBy: '请输入{key}',
pleaseSelectBy: '请选择{key}',
none: '未定义',
questingDeleteByMessage: '是否要删除{message}?',
delNotRecoverData: '请注意,删除后不可恢复!',
whetherDeleteData: '是否删除选择的记录 {name} ?',
dataHasBeenDeleted: '选定的记录 {name} 已删除!',
fieldLengthMustBeRange: '字段的长度必须在{min}到{max}之间!',
enabled: '启用',
disbled: '停用',
status: '状态',
lastModificationTime: '修改时间',
otherOpera: '更多操作',
cancel: '取 消',
confirm: '确 定'
} }
} }

12
vueJs/src/router/index.ts

@ -359,7 +359,7 @@ export const asyncRoutes: RouteConfig[] = [
meta: { meta: {
title: 'identityServer', title: 'identityServer',
icon: 'manager', icon: 'manager',
roles: ['IdentityServer.Clients'], roles: ['IdentityServer.Clients', 'IdentityServer.ApiResources', 'IdentityServer.IdentityResources'],
alwaysShow: true alwaysShow: true
}, },
children: [ children: [
@ -382,6 +382,16 @@ export const asyncRoutes: RouteConfig[] = [
icon: 'apiresources', icon: 'apiresources',
roles: ['IdentityServer.ApiResources'] roles: ['IdentityServer.ApiResources']
} }
},
{
path: 'identityresources',
component: () => import('@/views/admin/identityServer/identity-resources/index.vue'),
name: 'identityresources',
meta: {
title: 'identityresources',
icon: 'identityresources',
roles: ['IdentityServer.IdentityResources']
}
} }
] ]
}, },

14
vueJs/src/views/admin/identityServer/api-resources/components/ApiResourceCreateOrEditForm.vue

@ -9,7 +9,7 @@
> >
<el-form-item <el-form-item
prop="enabled" prop="enabled"
:label="$t('identityServer.enabledApiResource')" :label="$t('identityServer.enabledResource')"
> >
<el-switch <el-switch
v-model="apiResource.enabled" v-model="apiResource.enabled"
@ -17,17 +17,17 @@
</el-form-item> </el-form-item>
<el-form-item <el-form-item
prop="name" prop="name"
:label="$t('identityServer.apiResourceName')" :label="$t('identityServer.resourceName')"
> >
<el-input <el-input
v-model="apiResource.name" v-model="apiResource.name"
:readonly="isEdit" :readonly="isEdit"
:placeholder="$t('pleaseInputBy', {key: $t('identityServer.apiResourceName')})" :placeholder="$t('pleaseInputBy', {key: $t('identityServer.resourceName')})"
/> />
</el-form-item> </el-form-item>
<el-form-item <el-form-item
prop="displayName" prop="displayName"
:label="$t('identityServer.apiResourceDisplayName')" :label="$t('identityServer.resourceDisplayName')"
> >
<el-input <el-input
v-model="apiResource.displayName" v-model="apiResource.displayName"
@ -35,7 +35,7 @@
</el-form-item> </el-form-item>
<el-form-item <el-form-item
prop="description" prop="description"
:label="$t('identityServer.apiResourceDescription')" :label="$t('identityServer.resourceDescription')"
> >
<el-input <el-input
v-model="apiResource.description" v-model="apiResource.description"
@ -43,7 +43,7 @@
</el-form-item> </el-form-item>
<el-form-item <el-form-item
prop="userClaims" prop="userClaims"
:label="$t('identityServer.apiResourceUserClaims')" :label="$t('identityServer.resourceUserClaims')"
> >
<el-input-tag-ex <el-input-tag-ex
v-model="apiResource.userClaims" v-model="apiResource.userClaims"
@ -113,6 +113,8 @@ export default class extends Vue {
ApiResourceService.getApiResourceById(this.apiResourceId).then(resource => { ApiResourceService.getApiResourceById(this.apiResourceId).then(resource => {
this.apiResource = resource this.apiResource = resource
}) })
} else {
this.apiResource = ApiResource.empty()
} }
} }

7
vueJs/src/views/admin/identityServer/api-resources/components/ApiResourceScopeEditForm.vue

@ -2,6 +2,7 @@
<div class="app-container"> <div class="app-container">
<div class="filter-container"> <div class="filter-container">
<el-form <el-form
v-if="checkPermission(['IdentityServer.ApiResources.Secrets.Create'])"
ref="formApiScope" ref="formApiScope"
label-width="120px" label-width="120px"
:model="apiScope" :model="apiScope"
@ -58,7 +59,7 @@
</el-form-item> </el-form-item>
<el-form-item <el-form-item
prop="userClaims" prop="userClaims"
:label="$t('identityServer.apiResourceUserClaims')" :label="$t('identityServer.resourceUserClaims')"
> >
<el-input-tag-ex <el-input-tag-ex
v-model="apiScope.userClaims" v-model="apiScope.userClaims"
@ -73,17 +74,15 @@
<el-button <el-button
type="primary" type="primary"
style="width:180px" style="width:180px"
:disabled="!checkPermission(['IdentityServer.ApiResources.Secrets.Create'])"
@click="onSaveApiScope" @click="onSaveApiScope"
> >
{{ $t('identityServer.createApiScope') }} {{ $t('identityServer.createApiScope') }}
</el-button> </el-button>
</el-form-item> </el-form-item>
<el-divider />
</el-form> </el-form>
</div> </div>
<el-divider />
<el-table <el-table
row-key="value" row-key="value"
:data="apiScopes" :data="apiScopes"

5
vueJs/src/views/admin/identityServer/api-resources/components/ApiResourceSecretEditForm.vue

@ -2,6 +2,7 @@
<div class="app-container"> <div class="app-container">
<div class="filter-container"> <div class="filter-container">
<el-form <el-form
v-if="checkPermission(['IdentityServer.ApiResources.Secrets.Create'])"
ref="formApiSecret" ref="formApiSecret"
label-width="100px" label-width="100px"
:model="apiSecret" :model="apiSecret"
@ -107,17 +108,15 @@
<el-button <el-button
type="primary" type="primary"
style="width:180px" style="width:180px"
:disabled="!checkPermission(['IdentityServer.ApiResources.Secrets.Create'])"
@click="onSaveApiSecret" @click="onSaveApiSecret"
> >
{{ $t('identityServer.createApiSecret') }} {{ $t('identityServer.createApiSecret') }}
</el-button> </el-button>
</el-form-item> </el-form-item>
<el-divider />
</el-form> </el-form>
</div> </div>
<el-divider />
<el-table <el-table
row-key="value" row-key="value"
:data="apiSecrets" :data="apiSecrets"

14
vueJs/src/views/admin/identityServer/api-resources/index.vue

@ -40,7 +40,7 @@
@sort-change="handleSortChange" @sort-change="handleSortChange"
> >
<el-table-column <el-table-column
:label="$t('identityServer.apiResourceName')" :label="$t('identityServer.resourceName')"
prop="name" prop="name"
sortable sortable
width="150px" width="150px"
@ -51,7 +51,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
:label="$t('identityServer.apiResourceDisplayName')" :label="$t('identityServer.resourceDisplayName')"
prop="displayName" prop="displayName"
sortable sortable
width="200px" width="200px"
@ -62,7 +62,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
:label="$t('identityServer.apiResourceStatus')" :label="$t('identityServer.resourceStatus')"
prop="enabled" prop="enabled"
sortable sortable
width="140px" width="140px"
@ -75,7 +75,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
:label="$t('identityServer.apiResourceDescription')" :label="$t('identityServer.resourceDescription')"
prop="description" prop="description"
sortable sortable
width="200px" width="200px"
@ -86,7 +86,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
:label="$t('creationTime')" :label="$t('global.creationTime')"
prop="creationTime" prop="creationTime"
width="170px" width="170px"
align="center" align="center"
@ -100,7 +100,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
:label="$t('lastModificationTime')" :label="$t('global.lastModificationTime')"
prop="lastModificationTime" prop="lastModificationTime"
width="170px" width="170px"
align="center" align="center"
@ -114,7 +114,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
:label="$t('operaActions')" :label="$t('global.operaActions')"
align="center" align="center"
width="250px" width="250px"
fixed="right" fixed="right"

9
vueJs/src/views/admin/identityServer/client/components/ClientEditForm.vue

@ -576,7 +576,7 @@ export default class extends Vue {
constructor() { constructor() {
super() super()
this.client = new Client() this.client = Client.empty()
} }
@Watch('clientId', { immediate: true }) @Watch('clientId', { immediate: true })
@ -585,6 +585,8 @@ export default class extends Vue {
ClientService.getClientById(id).then(client => { ClientService.getClientById(id).then(client => {
this.client = client this.client = client
}) })
} else {
this.client = Client.empty()
} }
} }
@ -615,11 +617,6 @@ export default class extends Vue {
private l(name: string, values?: any[] | { [key: string]: any }) { private l(name: string, values?: any[] | { [key: string]: any }) {
return this.$t(name, values).toString() return this.$t(name, values).toString()
} }
private test(v: any) {
console.log(v)
console.log(this.client.redirectUris)
}
} }
</script> </script>

196
vueJs/src/views/admin/identityServer/identity-resources/components/IdentityResourceCreateOrEditForm.vue

@ -0,0 +1,196 @@
<template>
<div class="app-container">
<div class="filter-container">
<el-form
ref="formIdentityResource"
label-width="120px"
:model="identityResource"
:rules="identityResourceRules"
>
<el-form-item
prop="enabled"
:label="$t('identityServer.enabledResource')"
>
<el-switch
v-model="identityResource.enabled"
/>
</el-form-item>
<el-form-item
prop="name"
:label="$t('identityServer.resourceName')"
>
<el-input
v-model="identityResource.name"
:readonly="isEdit"
:placeholder="$t('pleaseInputBy', {key: $t('identityServer.resourceName')})"
/>
</el-form-item>
<el-form-item
prop="displayName"
:label="$t('identityServer.resourceDisplayName')"
>
<el-input
v-model="identityResource.displayName"
/>
</el-form-item>
<el-form-item
prop="description"
:label="$t('identityServer.resourceDescription')"
>
<el-input
v-model="identityResource.description"
/>
</el-form-item>
<el-form-item
prop="required"
:label="$t('identityServer.identityResourceRequired')"
>
<el-switch
v-model="identityResource.required"
/>
</el-form-item>
<el-form-item
prop="emphasize"
:label="$t('identityServer.identityResourceEmphasize')"
>
<el-switch
v-model="identityResource.emphasize"
/>
</el-form-item>
<el-form-item
prop="showInDiscoveryDocument"
:label="$t('identityServer.identityResourceShowInDiscoveryDocument')"
>
<el-switch
v-model="identityResource.showInDiscoveryDocument"
/>
</el-form-item>
<el-form-item
prop="userClaims"
:label="$t('identityServer.resourceUserClaims')"
>
<el-input-tag-ex
v-model="identityResource.userClaims"
label="type"
/>
</el-form-item>
<el-form-item>
<el-button
class="cancel"
style="width:100px"
@click="onCancel"
>
{{ $t('global.cancel') }}
</el-button>
<el-button
class="confirm"
type="primary"
style="width:100px"
@click="onSaveIdentityResource"
>
{{ $t('global.confirm') }}
</el-button>
</el-form-item>
</el-form>
</div>
</div>
</template>
<script lang="ts">
import IdentityResourceService, { IdentityResourceCreate, IdentityResourceUpdate, IdentityResource } from '@/api/identityresources'
import { Component, Prop, Vue, Watch } from 'vue-property-decorator'
import ElInputTagEx from '@/components/InputTagEx/index.vue'
@Component({
name: 'IdentityResourceCreateOrEditForm',
components: {
ElInputTagEx
}
})
export default class extends Vue {
@Prop({ default: '' })
private identityResourceId!: string
private identityResource: IdentityResource
private identityResourceRules = {
name: [
{ required: true, message: this.l('pleaseInputBy', { key: this.l('identityServer.resourceName') }), trigger: 'blur' }
]
}
get isEdit() {
if (this.identityResource.id) {
return true
}
return false
}
constructor() {
super()
this.identityResource = IdentityResource.empty()
}
@Watch('identityResourceId', { immediate: true })
private onIdentityResourceIdChanged() {
if (this.identityResourceId) {
IdentityResourceService.getIdentityResourceById(this.identityResourceId).then(resource => {
this.identityResource = resource
})
} else {
this.identityResource = IdentityResource.empty()
}
}
private onSaveIdentityResource() {
const frmIdentityResource = this.$refs.formIdentityResource as any
frmIdentityResource.validate((valid: boolean) => {
if (valid) {
if (this.isEdit) {
const updateIdentityResource = IdentityResourceUpdate.create(this.identityResource)
IdentityResourceService.updateIdentityResource(updateIdentityResource).then(resource => {
this.identityResource = resource
const successMessage = this.l('identityServer.updateIdentityResourceSuccess', { name: resource.name })
this.$message.success(successMessage)
frmIdentityResource.resetFields()
this.$emit('closed', true)
})
} else {
const createIdentityResource = IdentityResourceCreate.create(this.identityResource)
IdentityResourceService.createIdentityResource(createIdentityResource).then(resource => {
this.identityResource = resource
const successMessage = this.l('identityServer.createIdentityResourceSuccess', { name: resource.name })
this.$message.success(successMessage)
this.resetFields()
this.$emit('closed', true)
})
}
}
})
}
private onCancel() {
this.resetFields()
this.$emit('closed', false)
}
public resetFields() {
this.identityResource = IdentityResource.empty()
}
private l(name: string, values?: any[] | { [key: string]: any }) {
return this.$t(name, values).toString()
}
}
</script>
<style lang="scss" scoped>
.confirm {
position: absolute;
right: 10px;
}
.cancel {
position: absolute;
right: 120px;
}
</style>

173
vueJs/src/views/admin/identityServer/identity-resources/components/IdentityResourcePropertyEditForm.vue

@ -0,0 +1,173 @@
<template>
<div class="app-container">
<div class="filter-container">
<el-form
v-if="checkPermission(['IdentityServer.IdentityResources.Properties.Create'])"
ref="formIdentityProperty"
label-width="100px"
:model="identityProperty"
:rules="identityPropertyRules"
>
<el-form-item
prop="key"
:label="$t('identityServer.propertyKey')"
>
<el-input
v-model="identityProperty.key"
:placeholder="$t('pleaseInputBy', {key: $t('identityServer.propertyKey')})"
/>
</el-form-item>
<el-form-item
prop="value"
:label="$t('identityServer.propertyValue')"
>
<el-input
v-model="identityProperty.value"
:placeholder="$t('pleaseInputBy', {key: $t('identityServer.propertyValue')})"
/>
</el-form-item>
<el-form-item
style="text-align: center;"
label-width="0px"
>
<el-button
type="primary"
style="width:180px"
@click="onSaveIdentityProperty"
>
{{ $t('identityServer.createIdentityProperty') }}
</el-button>
</el-form-item>
<el-divider />
</el-form>
</div>
<el-table
row-key="key"
:data="identityResource.properties"
border
fit
highlight-current-row
style="width: 100%;"
>
<el-table-column
:label="$t('identityServer.propertyKey')"
prop="key"
sortable
width="200px"
align="center"
>
<template slot-scope="{row}">
<span>{{ row.key }}</span>
</template>
</el-table-column>
<el-table-column
:label="$t('identityServer.propertyValue')"
prop="value"
sortable
min-width="400px"
align="center"
>
<template slot-scope="{row}">
<span>{{ row.value }}</span>
</template>
</el-table-column>
<el-table-column
:label="$t('operaActions')"
align="center"
width="150px"
fixed="right"
>
<template slot-scope="{row}">
<el-button
:disabled="!checkPermission(['IdentityServer.Clients.Properties.Delete'])"
size="mini"
type="primary"
@click="handleDeleteIdentityProperty(row.key, row.value)"
>
{{ $t('identityServer.deleteProperty') }}
</el-button>
</template>
</el-table-column>
</el-table>
</div>
</template>
<script lang="ts">
import IdentityResourceService, { IdentityResource, IdentityPropertyCreate } from '@/api/identityresources'
import { Component, Vue, Prop } from 'vue-property-decorator'
import { checkPermission } from '@/utils/permission'
@Component({
name: 'IdentityPropertyEditForm',
methods: {
checkPermission
}
})
export default class extends Vue {
@Prop({ default: () => IdentityResource.empty() })
private identityResource!: IdentityResource
private identityProperty: IdentityPropertyCreate
private identityPropertyRules = {
key: [
{ required: true, message: this.l('pleaseInputBy', { key: this.l('identityServer.propertyKey') }), trigger: 'blur' }
],
value: [
{ required: true, message: this.l('pleaseInputBy', { key: this.l('identityServer.propertyValue') }), trigger: 'blur' }
]
}
constructor() {
super()
this.identityProperty = IdentityPropertyCreate.empty()
}
private handleDeleteIdentityProperty(key: string) {
this.$confirm(this.l('identityServer.deleteIdentityPropertyByKey', { key: key }),
this.l('identityServer.deleteProperty'), {
callback: (action) => {
if (action === 'confirm') {
IdentityResourceService.deleteProperty(this.identityResource.id, key).then(() => {
const deletePropertyIndex = this.identityResource.properties.findIndex(p => p.key === key && p.value === key)
this.identityResource.properties.splice(deletePropertyIndex, 1)
this.$message.success(this.l('identityServer.deleteIdentityPropertySuccess', { key: key }))
this.$emit('closed', true)
})
}
}
})
}
private onSaveIdentityProperty() {
const frmIdentityProperty = this.$refs.formIdentityProperty as any
frmIdentityProperty.validate((valid: boolean) => {
if (valid) {
this.identityProperty.identityResourceId = this.identityResource.id
this.identityProperty.concurrencyStamp = this.identityResource.concurrencyStamp
IdentityResourceService.createProperty(this.identityProperty).then(property => {
this.identityResource.properties.push(property)
const successMessage = this.l('identityServer.createIdentityPropertySuccess', { key: this.identityProperty.key })
this.$message.success(successMessage)
this.resetFields()
this.$emit('closed', true)
})
}
})
}
public resetFields() {
this.identityProperty = IdentityPropertyCreate.empty()
}
private l(name: string, values?: any[] | { [key: string]: any }) {
return this.$t(name, values).toString()
}
}
</script>
<style lang="scss" scoped>
.full-select {
width: 100%;
}
</style>

367
vueJs/src/views/admin/identityServer/identity-resources/index.vue

@ -0,0 +1,367 @@
<template>
<div class="app-container">
<div class="filter-container">
<label
class="radio-label"
style="padding-left:10px;"
>{{ $t('global.queryFilter') }}</label>
<el-input
v-model="identityResourceGetPagedFilter.filter"
:placeholder="$t('filterString')"
style="width: 250px;margin-left: 10px;"
class="filter-item"
/>
<el-button
class="filter-item"
style="margin-left: 10px; text-alignt"
type="primary"
@click="handleGetIdentityResources"
>
{{ $t('global.searchList') }}
</el-button>
<el-button
class="filter-item"
type="primary"
:disabled="!checkPermission(['IdentityServer.IdentityResources.Create'])"
@click="handleShowEditIdentityResourceForm"
>
{{ $t('identityServer.createIdentityResource') }}
</el-button>
</div>
<el-table
v-loading="identityResourceListLoading"
row-key="id"
:data="identityResourceList"
border
fit
highlight-current-row
style="width: 100%;"
@sort-change="handleSortChange"
>
<el-table-column
:label="$t('global.name')"
prop="name"
sortable
width="150px"
align="center"
>
<template slot-scope="{row}">
<span>{{ row.name }}</span>
</template>
</el-table-column>
<el-table-column
:label="$t('global.displayName')"
prop="displayName"
sortable
width="200px"
align="center"
>
<template slot-scope="{row}">
<span>{{ row.displayName }}</span>
</template>
</el-table-column>
<el-table-column
:label="$t('global.status')"
prop="enabled"
sortable
width="140px"
align="center"
>
<template slot-scope="{row}">
<el-tag :type="row.enabled | statusFilter">
{{ formatStatusText(row.enabled) }}
</el-tag>
</template>
</el-table-column>
<el-table-column
:label="$t('global.description')"
prop="description"
sortable
width="200px"
align="center"
>
<template slot-scope="{row}">
<span>{{ row.description }}</span>
</template>
</el-table-column>
<el-table-column
:label="$t('global.creationTime')"
prop="creationTime"
width="170px"
align="center"
>
<template slot-scope="{row}">
<span>
<el-tag>
{{ row.creationTime | datetimeFilter }}
</el-tag>
</span>
</template>
</el-table-column>
<el-table-column
:label="$t('global.lastModificationTime')"
prop="lastModificationTime"
width="170px"
align="center"
>
<template slot-scope="{row}">
<span>
<el-tag type="warning">
{{ row.lastModificationTime | datetimeFilter }}
</el-tag>
</span>
</template>
</el-table-column>
<el-table-column
:label="$t('global.operaActions')"
align="center"
width="250px"
fixed="right"
>
<template slot-scope="{row}">
<el-button
:disabled="!checkPermission(['IdentityServer.IdentityResources.Update'])"
size="mini"
type="primary"
@click="handleShowEditIdentityResourceForm(row)"
>
{{ $t('identityServer.updateIdentityResource') }}
</el-button>
<el-dropdown
class="options"
@command="handleCommand"
>
<el-button
v-permission="['IdentityServer.IdentityResources']"
size="mini"
type="info"
>
{{ $t('global.otherOpera') }}<i class="el-icon-arrow-down el-icon--right" />
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item
:command="{key: 'property', row}"
:disabled="!checkPermission(['IdentityServer.IdentityResources.Properties'])"
>
{{ $t('identityServer.identityResourceProperties') }}
</el-dropdown-item>
<el-dropdown-item
divided
:command="{key: 'delete', row}"
:disabled="!checkPermission(['IdentityServer.IdentityResources.Delete'])"
>
{{ $t('identityServer.deleteIdentityResource') }}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<Pagination
v-show="identityResourceListCount>0"
:total="identityResourceListCount"
:page.sync="identityResourceGetPagedFilter.skipCount"
:limit.sync="identityResourceGetPagedFilter.maxResultCount"
@pagination="handleGetIdentityResources"
@sort-change="handleSortChange"
/>
<el-dialog
v-el-draggable-dialog
width="800px"
:visible.sync="showEditIdentityResourceDialog"
:title="editIdentityResourceTitle"
custom-class="modal-form"
:show-close="false"
:close-on-click-modal="false"
:close-on-press-escape="false"
@closed="handleIdentityResourceEditFormClosed"
>
<IdentityResourceCreateOrEditForm
ref="formIdentityResource"
:identity-resource-id="editIdentityResource.id"
@closed="handleIdentityResourceEditFormClosed"
/>
</el-dialog>
<el-dialog
v-el-draggable-dialog
width="800px"
:visible.sync="showEditIdentityPropertyDialog"
:title="$t('identityServer.identityResourceProperties')"
custom-class="modal-form"
:show-close="false"
@closed="handleIdentityPropertyEditFormClosed"
>
<IdentityPropertyEditForm
ref="formIdentityProperty"
:identity-resource="editIdentityResource"
@closed="handleIdentityPropertyEditFormClosed"
/>
</el-dialog>
</div>
</template>
<script lang="ts">
import { checkPermission } from '@/utils/permission'
import { Component, Vue } from 'vue-property-decorator'
import { dateFormat } from '@/utils/index'
import Pagination from '@/components/Pagination/index.vue'
import IdentityPropertyEditForm from './components/IdentityResourcePropertyEditForm.vue'
import IdentityResourceCreateOrEditForm from './components/IdentityResourceCreateOrEditForm.vue'
import IdentityResourceService, { IdentityResource, IdentityResourceGetByPaged } from '@/api/identityresources'
@Component({
name: 'IdentityServerIdentityResource',
components: {
Pagination,
IdentityPropertyEditForm,
IdentityResourceCreateOrEditForm
},
methods: {
checkPermission
},
filters: {
statusFilter(status: boolean) {
if (status) {
return 'success'
}
return 'warning'
},
datetimeFilter(val: string) {
const date = new Date(val)
return dateFormat(date, 'YYYY-mm-dd HH:MM')
}
}
})
export default class extends Vue {
private editIdentityResource: IdentityResource
private identityResourceListCount: number
private editIdentityResourceTitle: any
private identityResourceList: IdentityResource[]
private identityResourceListLoading: boolean
private identityResourceGetPagedFilter: IdentityResourceGetByPaged
private showEditIdentityPropertyDialog: boolean
private showEditIdentityResourceDialog: boolean
constructor() {
super()
this.identityResourceListCount = 0
this.editIdentityResourceTitle = ''
this.identityResourceListLoading = false
this.editIdentityResource = IdentityResource.empty()
this.identityResourceList = new Array<IdentityResource>()
this.identityResourceGetPagedFilter = new IdentityResourceGetByPaged()
this.showEditIdentityPropertyDialog = false
this.showEditIdentityResourceDialog = false
}
mounted() {
this.handleGetIdentityResources()
}
private handleGetIdentityResources() {
this.identityResourceListLoading = true
IdentityResourceService.getIdentityResources(this.identityResourceGetPagedFilter).then(resources => {
this.identityResourceList = resources.items
this.identityResourceListCount = resources.totalCount
}).finally(() => {
this.identityResourceListLoading = false
})
}
private handleSortChange(column: any) {
this.identityResourceGetPagedFilter.sorting = column.prop
}
private handleShowEditIdentityResourceForm(resource: IdentityResource) {
this.editIdentityResource = IdentityResource.empty()
if (resource) {
this.editIdentityResource = resource
this.editIdentityResourceTitle = this.l('identityServer.updateIdentityResourceByName', { name: this.editIdentityResource.name })
} else {
this.editIdentityResourceTitle = this.l('identityServer.createIdentityResource')
}
this.showEditIdentityResourceDialog = true
}
private handleIdentityResourceEditFormClosed(changed: boolean) {
this.reset(changed)
}
private handleIdentityPropertyEditFormClosed(changed: boolean) {
this.reset(changed)
}
private handleDeleteIdentityResource(id: string, name: string) {
this.$confirm(this.l('identityServer.deleteIdentityResourceByName', { name: name }),
this.l('identityServer.deleteIdentityResource'), {
callback: (action) => {
if (action === 'confirm') {
IdentityResourceService.deleteIdentityResource(id).then(() => {
this.$message.success(this.l('identityServer.deleteIdentityResourceSuccess', { name: name }))
this.handleGetIdentityResources()
})
}
}
})
}
private handleCommand(command: {key: string, row: IdentityResource}) {
this.editIdentityResource = command.row
switch (command.key) {
case 'property' :
this.showEditIdentityPropertyDialog = true
break
case 'delete' :
this.handleDeleteIdentityResource(command.row.id, command.row.name)
break
default: break
}
}
private l(name: string, values?: any[] | { [key: string]: any }) {
return this.$t(name, values).toString()
}
private formatStatusText(status: boolean) {
let statusText = ''
if (status) {
statusText = this.l('enabled')
} else {
statusText = this.l('disbled')
}
return statusText
}
private reset(changed: boolean) {
this.editIdentityResourceTitle = ''
this.editIdentityResource = IdentityResource.empty()
this.showEditIdentityResourceDialog = false
this.showEditIdentityPropertyDialog = false
if (changed) {
this.handleGetIdentityResources()
}
}
}
</script>
<style lang="scss" scoped>
.roleItem {
width: 40px;
}
.options {
vertical-align: top;
margin-left: 20px;
}
.el-dropdown + .el-dropdown {
margin-left: 15px;
}
.el-icon-arrow-down {
font-size: 12px;
}
</style>

34
vueJs/src/views/admin/users/components/UserProfile.vue

@ -4,8 +4,11 @@
label-width="80px" label-width="80px"
:model="userProfile" :model="userProfile"
> >
<el-tabs> <el-tabs v-model="activedTabPane">
<el-tab-pane :label="$t('userProfile.basic')"> <el-tab-pane
:label="$t('userProfile.basic')"
name="basic"
>
<el-form-item <el-form-item
prop="userName" prop="userName"
:label="$t('users.userName')" :label="$t('users.userName')"
@ -52,7 +55,10 @@
/> />
</el-form-item> </el-form-item>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="$t('userProfile.security')"> <el-tab-pane
:label="$t('userProfile.security')"
name="security"
>
<el-form-item <el-form-item
v-if="!hasEditUser" v-if="!hasEditUser"
prop="password" prop="password"
@ -91,7 +97,10 @@
<el-switch v-model="userProfile.lockoutEnabled" /> <el-switch v-model="userProfile.lockoutEnabled" />
</el-form-item> </el-form-item>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="$t('userProfile.roles')"> <el-tab-pane
:label="$t('userProfile.roles')"
name="roles"
>
<el-transfer <el-transfer
v-model="userRoles" v-model="userRoles"
:titles="[$t('userProfile.roleList'),$t('userProfile.hasRoles')]" :titles="[$t('userProfile.roleList'),$t('userProfile.hasRoles')]"
@ -103,7 +112,7 @@
:label="$t('userProfile.permission')" :label="$t('userProfile.permission')"
> >
<PermissionTree <PermissionTree
v-if="allowedChangePermissions()" ref="permissionTree"
:expanded="false" :expanded="false"
:readonly="!checkPermission(['AbpIdentity.Users.ManagePermissions'])" :readonly="!checkPermission(['AbpIdentity.Users.ManagePermissions'])"
:permission="userPermission" :permission="userPermission"
@ -171,8 +180,11 @@ export default class extends Vue {
/** 变更用户权限数据 */ /** 变更用户权限数据 */
private editUserPermissions: IPermission[] private editUserPermissions: IPermission[]
private activedTabPane: string
constructor() { constructor() {
super() super()
this.activedTabPane = 'basic'
this.userPassword = '' this.userPassword = ''
this.hasEditUser = false this.hasEditUser = false
this.userRolesChanged = false this.userRolesChanged = false
@ -312,12 +324,20 @@ export default class extends Vue {
} }
private onCancel() { private onCancel() {
this.resetForm()
this.$emit('onClose') this.$emit('onClose')
} }
private resetForm(formName: string) { private resetForm() {
const userProfileForm = this.$refs[formName] as any this.activedTabPane = 'basic'
this.userRoles = new Array<string>()
const userProfileForm = this.$refs.profile as any
userProfileForm.resetFields() userProfileForm.resetFields()
if (this.hasLoadPermission) {
const userPermission = this.$refs.permissionTree as PermissionTree
userPermission.resetPermissions()
this.hasLoadPermission = false
}
} }
private createAddUserDto() { private createAddUserDto() {

1
vueJs/src/views/admin/users/index.vue

@ -107,6 +107,7 @@
:label="$t('users.operaActions')" :label="$t('users.operaActions')"
align="center" align="center"
width="250px" width="250px"
min-width="250px"
fixed="right" fixed="right"
> >
<template slot-scope="{row}"> <template slot-scope="{row}">

Loading…
Cancel
Save