Browse Source

添加id4 ui

pull/10/head
王军 5 years ago
parent
commit
3213002c4f
  1. 41
      aspnet-core/frameworks/Extensions/src/CompanyName.ProjectName.Extensions/Customs/Dtos/FromSelector.cs
  2. 6
      aspnet-core/services/src/CompanyName.ProjectName.Application.Contracts/IdentityServers/ApiResources/Dtos/ApiResourceOutput.cs
  3. 15
      aspnet-core/services/src/CompanyName.ProjectName.Application.Contracts/IdentityServers/ApiResources/Dtos/CreateApiResourceInput.cs
  4. 11
      aspnet-core/services/src/CompanyName.ProjectName.Application.Contracts/IdentityServers/ApiResources/Dtos/UpdateApiResourceInput.cs
  5. 7
      aspnet-core/services/src/CompanyName.ProjectName.Application.Contracts/IdentityServers/ApiScopes/IApiScopeAppService.cs
  6. 11
      aspnet-core/services/src/CompanyName.ProjectName.Application/IdentityServers/ApiResources/ApiResourceAppService.cs
  7. 11
      aspnet-core/services/src/CompanyName.ProjectName.Application/IdentityServers/ApiScopes/ApiScopeAppService.cs
  8. 66
      aspnet-core/services/src/CompanyName.ProjectName.Domain/IdentityServer/IdenityServerApiResourceManager.cs
  9. 9
      aspnet-core/services/src/CompanyName.ProjectName.Domain/IdentityServer/IdenityServerApiScopeManager.cs
  10. 35
      aspnet-core/services/src/CompanyName.ProjectName.Domain/IdentityServer/IdenityServerClientManager.cs
  11. 2
      aspnet-core/services/src/CompanyName.ProjectName.Domain/IdentityServer/IdentityResourceManager.cs
  12. 5
      aspnet-core/services/src/CompanyName.ProjectName.HttpApi.Host/Extensions/Filters/CustomHangfireAuthorizeFilter.cs
  13. 11272
      aspnet-core/services/src/CompanyName.ProjectName.HttpApi.Host/Logs/logs.txt
  14. 41
      aspnet-core/services/src/CompanyName.ProjectName.HttpApi.Host/ProjectNameHttpApiHostModule.cs
  15. 11
      aspnet-core/services/src/CompanyName.ProjectName.HttpApi/Controllers/IdentityServers/ApiScopeController.cs
  16. 19
      vben271/.editorconfig
  17. 8
      vben271/.env
  18. 31
      vben271/.env.development
  19. 35
      vben271/.env.production
  20. 36
      vben271/.env.test
  21. 15
      vben271/.eslintignore
  22. 78
      vben271/.eslintrc.js
  23. 29
      vben271/.gitignore
  24. 9
      vben271/.prettierignore
  25. 3
      vben271/.stylelintignore
  26. 48
      vben271/.yarnclean
  27. 17651
      vben271/package-lock.json
  28. 2
      vben271/package.json
  29. 4
      vben271/src/router/index.ts
  30. 15
      vben271/src/router/routes/modules/admin.ts
  31. 274
      vben271/src/services/ServiceProxies.ts
  32. 10
      vben271/src/views/admin/roles/CreateAbpRole.vue
  33. 44
      vben271/src/views/admin/users/EditAbpUser.vue
  34. 96
      vben271/src/views/identityServers/apiResources/ApiResources.ts
  35. 43
      vben271/src/views/identityServers/apiResources/ApiResources.vue
  36. 10
      vben271/src/views/identityServers/apiResources/CreateApiResource.vue
  37. 114
      vben271/src/views/identityServers/apiResources/EditApiResources.vue
  38. 24
      vben271/src/views/identityServers/apiScopes/ApiScopes.ts
  39. 25
      vben271/src/views/identityServers/clients/Clients.ts
  40. 110
      vben271/src/views/identityServers/clients/EditClientBasic.vue
  41. 71
      vben271/src/views/identityServers/identityResources/EditIdentityResources.vue
  42. 33
      vben271/src/views/identityServers/identityResources/IdentityResources.ts
  43. 11836
      vben271/yarn.lock

41
aspnet-core/frameworks/Extensions/src/CompanyName.ProjectName.Extensions/Customs/Dtos/FromSelector.cs

@ -0,0 +1,41 @@
namespace CompanyName.ProjectName.Extensions.Customs.Dtos
{
public abstract class FromSelectorBase
{
protected FromSelectorBase(int value, string label)
{
Value = value;
Label = label;
}
public int Value { get; protected set; }
public string Label { get; protected set; }
}
public abstract class FromSelectorBase<TValue, TLabel>
{
protected FromSelectorBase(TValue value, TLabel label)
{
Value = value;
Label = label;
}
public TValue Value { get; protected set; }
public TLabel Label { get; protected set; }
}
public class FromSelector : FromSelectorBase
{
public FromSelector(int value, string label) : base(value, label)
{
}
}
public class FromSelector<TValue, TLabel> : FromSelectorBase<TValue, TLabel>
{
public FromSelector(TValue value, TLabel label) : base(value, label)
{
}
}
}

6
aspnet-core/services/src/CompanyName.ProjectName.Application.Contracts/IdentityServers/ApiResources/Dtos/ApiResourceOutput.cs

@ -1,8 +1,10 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using Volo.Abp.Application.Dtos;
namespace CompanyName.ProjectName.IdentityServers.Dtos
{
public class ApiResourceOutput
public class ApiResourceOutput : EntityDto<Guid>
{
public string Name { get; set; }

15
aspnet-core/services/src/CompanyName.ProjectName.Application.Contracts/IdentityServers/ApiResources/Dtos/CreateApiResourceInput.cs

@ -16,20 +16,7 @@ namespace CompanyName.ProjectName.IdentityServers.Dtos
public bool ShowInDiscoveryDocument { get; set; } = true;
public List<ApiResourceSecretOutput> Secrets { get; set; }
public string Secret { get; set; }
public List<ApiResourceScopeOutput> Scopes { get; set; }
public List<ApiResourceClaimOutput> UserClaims { get; set; }
public List<ApiResourcePropertyOutput> Properties { get; set; }
public CreateApiResourceInput()
{
Secrets = new List<ApiResourceSecretOutput>();
Scopes = new List<ApiResourceScopeOutput>();
UserClaims = new List<ApiResourceClaimOutput>();
Properties = new List<ApiResourcePropertyOutput>();
}
}
}

11
aspnet-core/services/src/CompanyName.ProjectName.Application.Contracts/IdentityServers/ApiResources/Dtos/UpdateApiResourceInput.cs

@ -16,20 +16,15 @@ namespace CompanyName.ProjectName.IdentityServers.Dtos
public bool ShowInDiscoveryDocument { get; set; } = true;
public List<ApiResourceSecretOutput> Secrets { get; set; }
public string Secret { get; set; }
public List<ApiResourceScopeOutput> Scopes { get; set; }
public List<string> ApiScopes { get; set; }
public List<ApiResourceClaimOutput> UserClaims { get; set; }
public List<ApiResourcePropertyOutput> Properties { get; set; }
public UpdateApiResourceInput()
{
Secrets = new List<ApiResourceSecretOutput>();
Scopes = new List<ApiResourceScopeOutput>();
UserClaims = new List<ApiResourceClaimOutput>();
Properties = new List<ApiResourcePropertyOutput>();
ApiScopes = new List<string>();
}
}
}

7
aspnet-core/services/src/CompanyName.ProjectName.Application.Contracts/IdentityServers/ApiScopes/IApiScopeAppService.cs

@ -1,4 +1,7 @@
using System.Threading.Tasks;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using CompanyName.ProjectName.Extensions.Customs.Dtos;
using CompanyName.ProjectName.IdentityServers.ApiScopes.Dtos;
using CompanyName.ProjectName.Publics.Dtos;
using Volo.Abp.Application.Dtos;
@ -15,5 +18,7 @@ namespace CompanyName.ProjectName.IdentityServers.ApiScopes
Task UpdateAsync(UpdateCreateApiScopeInput input);
Task DeleteAsync(IdInput input);
Task<List<FromSelector<string, string>>> FindAllAsync();
}
}

11
aspnet-core/services/src/CompanyName.ProjectName.Application/IdentityServers/ApiResources/ApiResourceAppService.cs

@ -53,10 +53,7 @@ namespace CompanyName.ProjectName.IdentityServers.ApiResources
input.Enabled,
input.AllowedAccessTokenSigningAlgorithms,
input.ShowInDiscoveryDocument,
input.Secrets,
input.Scopes,
input.UserClaims,
input.Properties
input.Secret
);
}
@ -82,10 +79,8 @@ namespace CompanyName.ProjectName.IdentityServers.ApiResources
input.Enabled,
input.AllowedAccessTokenSigningAlgorithms,
input.ShowInDiscoveryDocument,
input.Secrets,
input.Scopes,
input.UserClaims,
input.Properties
input.Secret,
input.ApiScopes
);
}
}

11
aspnet-core/services/src/CompanyName.ProjectName.Application/IdentityServers/ApiScopes/ApiScopeAppService.cs

@ -1,5 +1,8 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CompanyName.ProjectName.Extensions.Customs.Dtos;
using CompanyName.ProjectName.IdentityServer;
using CompanyName.ProjectName.IdentityServers.ApiScopes.Dtos;
using CompanyName.ProjectName.Publics.Dtos;
@ -45,5 +48,11 @@ namespace CompanyName.ProjectName.IdentityServers.ApiScopes
{
return _idenityServerApiScopeManager.DeleteAsync(input.Id);
}
public async Task<List<FromSelector<string, string>>> FindAllAsync()
{
var result = await _idenityServerApiScopeManager.FindAllAsync();
return result.Select(e => new FromSelector<string, string>(e.Name, e.Name)).ToList();
}
}
}

66
aspnet-core/services/src/CompanyName.ProjectName.Domain/IdentityServer/IdenityServerApiResourceManager.cs

@ -27,7 +27,7 @@ namespace CompanyName.ProjectName.IdentityServer
bool includeDetails = false,
CancellationToken cancellationToken = default)
{
return _apiResourceRepository.GetListAsync("CreationTime", skipCount, maxResultCount, filter,
return _apiResourceRepository.GetListAsync("CreationTime desc", skipCount, maxResultCount, filter,
includeDetails,
cancellationToken);
}
@ -57,15 +57,16 @@ namespace CompanyName.ProjectName.IdentityServer
bool enabled,
string allowedAccessTokenSigningAlgorithms,
bool showInDiscoveryDocument,
List<ApiResourceSecretOutput> secrets = null,
List<ApiResourceScopeOutput> scopes = null,
List<ApiResourceClaimOutput> claims = null,
List<ApiResourcePropertyOutput> properties = null,
string secret,
CancellationToken cancellationToken = default)
{
var apiResource =
await _apiResourceRepository.FindByNameAsync(name.Trim(), false, cancellationToken);
if (null != apiResource) throw new UserFriendlyException(message: "ApiResource已存在");
if (null != apiResource)
{
throw new UserFriendlyException(message: "ApiResource已存在");
}
apiResource = new ApiResource(id, name, displayName, description)
{
AllowedAccessTokenSigningAlgorithms = allowedAccessTokenSigningAlgorithms,
@ -73,16 +74,13 @@ namespace CompanyName.ProjectName.IdentityServer
Enabled = enabled
};
secrets?.Distinct().ToList().ForEach(item =>
{
apiResource.AddSecret(item.Value.ToSha256(), item.Expiration, item.Type, item.Description);
});
scopes?.Distinct().ToList().ForEach(item => { apiResource.AddScope(item.Scope); });
claims?.Distinct().ToList().ForEach(item => { apiResource.AddUserClaim(item.Type); });
apiResource.AddSecret(secret.ToSha256());
properties?.Distinct().ToList().ForEach(item => { apiResource.AddProperty(item.Key, item.Value); });
// scopes?.Distinct().ToList().ForEach(item => { apiResource.AddScope(item.Scope); });
//
// claims?.Distinct().ToList().ForEach(item => { apiResource.AddUserClaim(item.Type); });
//
// properties?.Distinct().ToList().ForEach(item => { apiResource.AddProperty(item.Key, item.Value); });
return await _apiResourceRepository.InsertAsync(apiResource, cancellationToken: cancellationToken);
}
@ -102,41 +100,37 @@ namespace CompanyName.ProjectName.IdentityServer
bool enabled,
string allowedAccessTokenSigningAlgorithms,
bool showInDiscoveryDocument,
List<ApiResourceSecretOutput> secrets = null,
List<ApiResourceScopeOutput> scopes = null,
List<ApiResourceClaimOutput> claims = null,
List<ApiResourcePropertyOutput> properties = null,
string secret ,
List<string> scopes ,
CancellationToken cancellationToken = default
)
{
var apiResource =
await _apiResourceRepository.FindByNameAsync(name.Trim(), false, cancellationToken);
if (null == apiResource) throw new UserFriendlyException(message: "ApiResource不存在");
await _apiResourceRepository.FindByNameAsync(name.Trim(), true, cancellationToken);
if (null == apiResource)
{
throw new UserFriendlyException(message: "ApiResource不存在");
}
apiResource.DisplayName = displayName;
apiResource.Description = description;
apiResource.Enabled = enabled;
apiResource.AllowedAccessTokenSigningAlgorithms = allowedAccessTokenSigningAlgorithms;
apiResource.ShowInDiscoveryDocument = showInDiscoveryDocument;
secrets?.Distinct().ToList().ForEach(item =>
if (secret.IsNotNullOrWhiteSpace())
{
var secret = apiResource.Secrets.FirstOrDefault(e => e.Value == item.Value.ToSha256() && e.Type==item.Type);
if (secret != null)
{
secret.Expiration = item.Expiration;
secret.Description = item.Description;
}
else
if (apiResource.Secrets.Any(e=>e.Value!=secret))
{
apiResource.AddSecret(item.Value.ToSha256(), item.Expiration, item.Type, item.Description);
apiResource.Secrets.Clear();
apiResource.AddSecret(secret.ToSha256());
}
}
});
scopes?.Distinct().ToList().ForEach(item => { apiResource.AddScope(item.Scope); });
claims?.Distinct().ToList().ForEach(item => { apiResource.AddUserClaim(item.Type); });
apiResource.Scopes.Clear();
scopes?.Distinct().ToList().ForEach(item => { apiResource.AddScope(item); });
properties?.Distinct().ToList().ForEach(item => { apiResource.AddProperty(item.Key, item.Value); });
return await _apiResourceRepository.UpdateAsync(apiResource, cancellationToken: cancellationToken);
}
}

9
aspnet-core/services/src/CompanyName.ProjectName.Domain/IdentityServer/IdenityServerApiScopeManager.cs

@ -25,7 +25,7 @@ namespace CompanyName.ProjectName.IdentityServer
CancellationToken cancellationToken = default)
{
return _apiScopeRepository.GetListAsync(
"CreationTime",
"CreationTime desc",
skipCount,
maxResultCount,
filter,
@ -76,9 +76,14 @@ namespace CompanyName.ProjectName.IdentityServer
}
public Task DeleteAsync(Guid id, bool autoSave = false,
CancellationToken cancellationToken = new CancellationToken())
CancellationToken cancellationToken = default)
{
return _apiScopeRepository.DeleteAsync(id, autoSave, cancellationToken);
}
public async Task<List<ApiScope>> FindAllAsync(CancellationToken cancellationToken = default)
{
return await _apiScopeRepository.GetListAsync(e => e.Enabled == true, false, cancellationToken);
}
}
}

35
aspnet-core/services/src/CompanyName.ProjectName.Domain/IdentityServer/IdenityServerClientManager.cs

@ -28,7 +28,7 @@ namespace CompanyName.ProjectName.IdentityServer
bool includeDetails = false,
CancellationToken cancellationToken = default)
{
return _clientRepository.GetListAsync("CreationTime", skipCount, maxResultCount, filter, includeDetails,
return _clientRepository.GetListAsync("CreationTime desc", skipCount, maxResultCount, filter, includeDetails,
cancellationToken);
}
@ -96,13 +96,12 @@ namespace CompanyName.ProjectName.IdentityServer
int slidingRefreshTokenLifetime,
string secret,
string secretType
)
{
var client = await _clientRepository.FindByClientIdAsync(clientId);
if (client != null)
if (client == null)
{
throw new UserFriendlyException(message: "当前ClientId已存在");
throw new UserFriendlyException(message: $"{clientId}不存在");
}
client.ClientName = clientName;
@ -130,7 +129,7 @@ namespace CompanyName.ProjectName.IdentityServer
client.SlidingRefreshTokenLifetime = slidingRefreshTokenLifetime;
client.RefreshTokenExpiration = refreshTokenExpiration;
client.DeviceCodeLifetime = deviceCodeLifetime;
client.ProtocolType = protocolType;
//client.ProtocolType = protocolType;
client.AlwaysIncludeUserClaimsInIdToken = alwaysIncludeUserClaimsInIdToken;
client.AllowPlainTextPkce = allowPlainTextPkce;
client.AllowOfflineAccess = allowOfflineAccess;
@ -144,8 +143,16 @@ namespace CompanyName.ProjectName.IdentityServer
client.UserSsoLifetime = userSsoLifetime;
client.UserCodeType = userCodeType;
client.EnableLocalLogin = enableLocalLogin;
client.ClientSecrets.Clear();
client.AddSecret(secret.ToSha256(), null, secretType, String.Empty);
if (secret.IsNotNullOrWhiteSpace())
{
if (client.ClientSecrets.Any(e => e.Value != secret))
{
client.ClientSecrets.Clear();
client.AddSecret(secret.ToSha256(), null, secretType, String.Empty);
}
}
return await _clientRepository.UpdateAsync(client);
}
@ -170,7 +177,7 @@ namespace CompanyName.ProjectName.IdentityServer
{
uri = uri.Trim();
var client = await _clientRepository.FindByClientIdAsync(clientId);
if (client == null) throw new UserFriendlyException(message: "Client不存在");
if (client == null) throw new UserFriendlyException(message: $"{clientId}不存在");
if (client.RedirectUris.Any(e => e.RedirectUri != uri.Trim()))
{
client.AddRedirectUri(uri);
@ -187,7 +194,7 @@ namespace CompanyName.ProjectName.IdentityServer
{
uri = uri.Trim();
var client = await _clientRepository.FindByClientIdAsync(clientId);
if (client == null) throw new UserFriendlyException(message: "Client不存在");
if (client == null) throw new UserFriendlyException(message: $"{clientId}不存在");
if (client.RedirectUris.Any(e => e.RedirectUri == uri.Trim()))
{
client.RemoveRedirectUri(uri);
@ -204,7 +211,7 @@ namespace CompanyName.ProjectName.IdentityServer
{
uri = uri.Trim();
var client = await _clientRepository.FindByClientIdAsync(clientId);
if (client == null) throw new UserFriendlyException(message: "Client不存在");
if (client == null) throw new UserFriendlyException(message: $"{clientId}不存在");
if (client.PostLogoutRedirectUris.Any(e => e.PostLogoutRedirectUri != uri))
{
client.AddPostLogoutRedirectUri(uri);
@ -221,7 +228,7 @@ namespace CompanyName.ProjectName.IdentityServer
{
uri = uri.Trim();
var client = await _clientRepository.FindByClientIdAsync(clientId);
if (client == null) throw new UserFriendlyException(message: "Client不存在");
if (client == null) throw new UserFriendlyException(message: $"{clientId}不存在");
if (client.PostLogoutRedirectUris.Any(e => e.PostLogoutRedirectUri == uri))
{
client.RemovePostLogoutRedirectUri(uri);
@ -238,7 +245,7 @@ namespace CompanyName.ProjectName.IdentityServer
{
origin = origin.Trim();
var client = await _clientRepository.FindByClientIdAsync(clientId);
if (client == null) throw new UserFriendlyException(message: "Client不存在");
if (client == null) throw new UserFriendlyException(message: $"{clientId}不存在");
if (client.AllowedCorsOrigins.Any(e => e.Origin != origin))
{
client.AddCorsOrigin(origin);
@ -255,7 +262,7 @@ namespace CompanyName.ProjectName.IdentityServer
{
origin = origin.Trim();
var client = await _clientRepository.FindByClientIdAsync(clientId);
if (client == null) throw new UserFriendlyException(message: "Client不存在");
if (client == null) throw new UserFriendlyException(message: $"{clientId}不存在");
if (client.AllowedCorsOrigins.Any(e => e.Origin == origin))
{
client.RemoveCorsOrigin(origin);
@ -268,7 +275,7 @@ namespace CompanyName.ProjectName.IdentityServer
public async Task<Client> EnabledAsync(string clientId, bool enabled)
{
var client = await _clientRepository.FindByClientIdAsync(clientId);
if (client == null) throw new UserFriendlyException(message: "Client不存在");
if (client == null) throw new UserFriendlyException(message: $"{clientId}不存在");
client.Enabled = enabled;
return await _clientRepository.UpdateAsync(client);
}

2
aspnet-core/services/src/CompanyName.ProjectName.Domain/IdentityServer/IdentityResourceManager.cs

@ -25,7 +25,7 @@ namespace CompanyName.ProjectName.IdentityServer
CancellationToken cancellationToken = default)
{
return _identityResourceRepository.GetListAsync(
"CreationTime",
"CreationTime desc",
skipCount,
maxResultCount,
filter,

5
aspnet-core/services/src/CompanyName.ProjectName.HttpApi.Host/Extensions/Filters/CustomHangfireAuthorizeFilter.cs

@ -8,9 +8,8 @@ namespace CompanyNameProjectName.Extensions.Filters
{
public bool Authorize(DashboardContext context)
{
//var currentUser = context.GetHttpContext().RequestServices.GetRequiredService<ICurrentUser>();
//return currentUser.IsAuthenticated;
return true;
var _currentUser = context.GetHttpContext().RequestServices.GetRequiredService<ICurrentUser>();
return _currentUser.IsAuthenticated;
}
}
}

11272
aspnet-core/services/src/CompanyName.ProjectName.HttpApi.Host/Logs/logs.txt

File diff suppressed because it is too large

41
aspnet-core/services/src/CompanyName.ProjectName.HttpApi.Host/ProjectNameHttpApiHostModule.cs

@ -40,6 +40,7 @@ using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.Swashbuckle;
using Volo.Abp.VirtualFileSystem;
using System.Threading.Tasks;
namespace CompanyName.ProjectName
{
@ -154,6 +155,7 @@ namespace CompanyName.ProjectName
});
}
/// <summary>
/// 配置JWT
/// </summary>
@ -181,6 +183,44 @@ namespace CompanyName.ProjectName
IssuerSigningKey =
new SymmetricSecurityKey(Encoding.ASCII.GetBytes(configuration["Jwt:SecurityKey"]))
};
options.Events = new JwtBearerEvents
{
OnMessageReceived = currentContext =>
{
var accessToken = currentContext.Request.Query["access_token"];
// 如果请求来自signalr
var path = currentContext.HttpContext.Request.Path;
if (path.StartsWithSegments("/signalr"))
{
currentContext.Token = accessToken;
}
// 如果请求来自hangfire
if (!path.ToString().StartsWith("/hangfire"))
{
return Task.CompletedTask;
}
currentContext.HttpContext.Response.Headers.Remove("X-Frame-Options");
if (!string.IsNullOrEmpty(accessToken))
{
currentContext.Token = accessToken;
currentContext.HttpContext.Response.Cookies
.Append("HangfireCookie", accessToken);
}
else
{
var cookies = currentContext.Request.Cookies;
if (cookies.ContainsKey("HangfireCookie"))
{
currentContext.Token = cookies["HangfireCookie"];
}
}
return Task.CompletedTask;
}
};
});
}
@ -340,6 +380,7 @@ namespace CompanyName.ProjectName
private void ConfigureCors(ServiceConfigurationContext context, IConfiguration configuration)
{
context.Services.AddAntiforgery(o => o.SuppressXFrameOptionsHeader = true);
context.Services.AddCors(options =>
{
options.AddPolicy(DefaultCorsPolicyName, builder =>

11
aspnet-core/services/src/CompanyName.ProjectName.HttpApi/Controllers/IdentityServers/ApiScopeController.cs

@ -1,4 +1,7 @@
using System.Threading.Tasks;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using CompanyName.ProjectName.Extensions.Customs.Dtos;
using CompanyName.ProjectName.IdentityServers.ApiScopes;
using CompanyName.ProjectName.IdentityServers.ApiScopes.Dtos;
using CompanyName.ProjectName.Publics.Dtos;
@ -45,5 +48,11 @@ namespace CompanyName.ProjectName.Controllers.IdentityServers
{
return _apiScopeAppService.DeleteAsync(input);
}
[HttpPost("all")]
[SwaggerOperation(summary: "获取所有ApiScope", Tags = new[] {"ApiScope"})]
public Task<List<FromSelector<string, string>>> FindAllAsync()
{
return _apiScopeAppService.FindAllAsync();
}
}
}

19
vben271/.editorconfig

@ -0,0 +1,19 @@
root = true
[*]
charset=utf-8
end_of_line=lf
insert_final_newline=true
indent_style=space
indent_size=2
max_line_length = 100
[*.{yml,yaml,json}]
indent_style = space
indent_size = 2
[*.md]
trim_trailing_whitespace = false
[Makefile]
indent_style = tab

8
vben271/.env

@ -0,0 +1,8 @@
# port
VITE_PORT = 4200
# spa-title
VITE_GLOB_APP_TITLE = Abp Vnext
# spa shortname
VITE_GLOB_APP_SHORT_NAME = Abp Vnext

31
vben271/.env.development

@ -0,0 +1,31 @@
# Whether to open mock
VITE_USE_MOCK = true
# public path
VITE_PUBLIC_PATH = /
# Cross-domain proxy, you can configure multiple
# Please note that no line breaks
VITE_PROXY = [["/basic-api","http://localhost:3000"],["/upload","http://localhost:3300/upload"]]
# VITE_PROXY=[["/api","https://vvbin.cn/test"]]
# Delete console
VITE_DROP_CONSOLE = false
# Basic interface address SPA
VITE_GLOB_API_URL=/basic-api
# File upload address, optional
VITE_GLOB_UPLOAD_URL=/upload
# Interface prefix
VITE_GLOB_API_URL_PREFIX=
VITE_BUILD_COMPRESS = 'none'
# 认证授权服务器地址
VITE_AUTH_URL='http://sts.xx.cn'
# 接口地址
VITE_API_URL= http://localhost:44315

35
vben271/.env.production

@ -0,0 +1,35 @@
# Whether to open mock
VITE_USE_MOCK = true
# public path
VITE_PUBLIC_PATH = /
# Delete console
VITE_DROP_CONSOLE = true
# Whether to enable gzip or brotli compression
# Optional: gzip | brotli | none
# If you need multiple forms, you can use `,` to separate
VITE_BUILD_COMPRESS = 'none'
# Whether to delete origin files when using compress, default false
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false
# Basic interface address SPA
VITE_GLOB_API_URL=/basic-api
# File upload address, optional
# It can be forwarded by nginx or write the actual address directly
VITE_GLOB_UPLOAD_URL=/upload
# Interface prefix
VITE_GLOB_API_URL_PREFIX=
# Whether to enable image compression
VITE_USE_IMAGEMIN= true
# use pwa
VITE_USE_PWA = false
# Is it compatible with older browsers
VITE_LEGACY = false

36
vben271/.env.test

@ -0,0 +1,36 @@
NODE_ENV=production
# Whether to open mock
VITE_USE_MOCK = true
# public path
VITE_PUBLIC_PATH = /
# Delete console
VITE_DROP_CONSOLE = true
# Whether to enable gzip or brotli compression
# Optional: gzip | brotli | none
# If you need multiple forms, you can use `,` to separate
VITE_BUILD_COMPRESS = 'none'
# Whether to delete origin files when using compress, default false
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false
# Basic interface address SPA
VITE_GLOB_API_URL=/basic-api
# File upload address, optional
# It can be forwarded by nginx or write the actual address directly
VITE_GLOB_UPLOAD_URL=/upload
# Interface prefix
VITE_GLOB_API_URL_PREFIX=
# Whether to enable image compression
VITE_USE_IMAGEMIN= true
# use pwa
VITE_USE_PWA = false
# Is it compatible with older browsers
VITE_LEGACY = false

15
vben271/.eslintignore

@ -0,0 +1,15 @@
*.sh
node_modules
*.md
*.woff
*.ttf
.vscode
.idea
dist
/public
/docs
.husky
.local
/bin
Dockerfile

78
vben271/.eslintrc.js

@ -0,0 +1,78 @@
// @ts-check
const { defineConfig } = require('eslint-define-config');
module.exports = defineConfig({
root: true,
env: {
browser: true,
node: true,
es6: true,
},
parser: 'vue-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser',
ecmaVersion: 2020,
sourceType: 'module',
jsxPragma: 'React',
ecmaFeatures: {
jsx: true,
},
},
extends: [
'plugin:vue/vue3-recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:prettier/recommended',
'plugin:jest/recommended',
],
rules: {
'vue/script-setup-uses-vars': 'error',
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-empty-function': 'off',
'vue/custom-event-name-casing': 'off',
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'space-before-function-paren': 'off',
'vue/attributes-order': 'off',
'vue/one-component-per-file': 'off',
'vue/html-closing-bracket-newline': 'off',
'vue/max-attributes-per-line': 'off',
'vue/multiline-html-element-content-newline': 'off',
'vue/singleline-html-element-content-newline': 'off',
'vue/attribute-hyphenation': 'off',
'vue/require-default-prop': 'off',
'vue/html-self-closing': [
'error',
{
html: {
void: 'always',
normal: 'never',
component: 'always',
},
svg: 'always',
math: 'always',
},
],
},
});

29
vben271/.gitignore

@ -0,0 +1,29 @@
node_modules
.DS_Store
dist
.npmrc
.cache
tests/server/static
tests/server/static/upload
.local
# local env files
.env.local
.env.*.local
.eslintcache
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
# .vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

9
vben271/.prettierignore

@ -0,0 +1,9 @@
/dist/*
.local
.output.js
/node_modules/**
**/*.svg
**/*.sh
/public/*

3
vben271/.stylelintignore

@ -0,0 +1,3 @@
/dist/*
/public/*
public/*

48
vben271/.yarnclean

@ -0,0 +1,48 @@
# test directories
__tests__
test
tests
powered-test
# asset directories
docs
doc
website
images
assets
# examples
example
examples
# code coverage directories
coverage
.nyc_output
# build scripts
Makefile
Gulpfile.js
Gruntfile.js
# configs
appveyor.yml
circle.yml
codeship-services.yml
codeship-steps.yml
wercker.yml
.tern-project
.gitattributes
.editorconfig
.*ignore
.eslintrc
.jshintrc
.flowconfig
.documentup.json
.yarn-metadata.json
.travis.yml
# misc
*.md
!istanbul-reports/lib/html/assets
!istanbul-api/node_modules/istanbul-reports/lib/html/assets

17651
vben271/package-lock.json

File diff suppressed because it is too large

2
vben271/package.json

@ -24,14 +24,12 @@
"lint:eslint": "eslint --cache --max-warnings 0 \"{src,mock}/**/*.{vue,ts,tsx}\" --fix",
"lint:prettier": "prettier --write \"src/**/*.{js,json,tsx,css,less,scss,vue,html,md}\"",
"lint:stylelint": "stylelint --cache --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/",
"lint:lint-staged": "lint-staged -c ./.husky/lintstagedrc.js",
"lint:pretty": "pretty-quick --staged",
"test:unit": "jest",
"test:unit-coverage": "jest --coverage",
"test:gzip": "http-server dist --cors --gzip -c-1",
"test:br": "http-server dist --cors --brotli -c-1",
"reinstall": "rimraf yarn.lock && rimraf package.lock.json && rimraf node_modules && npm run bootstrap",
"prepare": "husky install",
"gen:icon": "esno ./build/generate/icon/index.ts"
},
"dependencies": {

4
vben271/src/router/index.ts

@ -1,4 +1,4 @@
import type { RouteRecordRaw } from 'vue-router';
import { createWebHistory, RouteRecordRaw } from 'vue-router';
import type { App } from 'vue';
import { createRouter, createWebHashHistory } from 'vue-router';
@ -15,7 +15,7 @@ getRouteNames(basicRoutes);
// app router
export const router = createRouter({
history: createWebHashHistory(import.meta.env.VITE_PUBLIC_PATH),
history: createWebHistory(import.meta.env.VITE_PUBLIC_PATH),
routes: basicRoutes as unknown as RouteRecordRaw[],
strict: true,
scrollBehavior: () => ({ left: 0, top: 0 }),

15
vben271/src/router/routes/modules/admin.ts

@ -1,6 +1,10 @@
import type { AppRouteModule } from '/@/router/types';
import { LAYOUT } from '/@/router/constant';
import { t } from '/@/hooks/web/useI18n';
const IFrame = () => import('/@/views/sys/iframe/FrameBlank.vue');
import { useUserStoreWithOut } from '/@/store/modules/user';
const userStore = useUserStoreWithOut();
const token = userStore.getToken;
const admin: AppRouteModule = {
path: '/admin',
@ -33,6 +37,17 @@ const admin: AppRouteModule = {
icon: 'ant-design:lock-outlined',
},
},
{
path: 'hangfire',
name: '后台任务',
component: IFrame,
meta: {
frameSrc: import.meta.env.VITE_API_URL + '/hangfire?access_token=' + token,
title: '后台任务',
//policy: 'AbpIdentity.Hangfire.Dashboard',
icon: 'ant-design:clock-circle-outlined',
},
},
],
};

274
vben271/src/services/ServiceProxies.ts

@ -2,7 +2,7 @@
/* eslint-disable */
//----------------------
// <auto-generated>
// Generated using the NSwag toolchain v13.11.3.0 (NJsonSchema v10.4.4.0 (Newtonsoft.Json v12.0.0.0)) (http://NSwag.org)
// Generated using the NSwag toolchain v13.13.2.0 (NJsonSchema v10.5.2.0 (Newtonsoft.Json v12.0.0.0)) (http://NSwag.org)
// </auto-generated>
//----------------------
// ReSharper disable InconsistentNaming
@ -1169,6 +1169,102 @@ export class ApiScopeServiceProxy extends ServiceProxyBase {
}
return Promise.resolve<void>(<any>null);
}
/**
* ApiScope
* @return Success
*/
all( cancelToken?: CancelToken | undefined): Promise<StringStringFromSelector[]> {
let url_ = this.baseUrl + "/IdentityServer/ApiScope/all";
url_ = url_.replace(/[?&]$/, "");
let options_ = <AxiosRequestConfig>{
method: "POST",
url: url_,
headers: {
"Accept": "text/plain"
},
cancelToken
};
return this.transformOptions(options_).then(transformedOptions_ => {
return this.instance.request(transformedOptions_);
}).catch((_error: any) => {
if (isAxiosError(_error) && _error.response) {
return _error.response;
} else {
throw _error;
}
}).then((_response: AxiosResponse) => {
return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processAll(_response));
});
}
protected processAll(response: AxiosResponse): Promise<StringStringFromSelector[]> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (let k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
if (Array.isArray(resultData200)) {
result200 = [] as any;
for (let item of resultData200)
result200!.push(StringStringFromSelector.fromJS(item));
}
else {
result200 = <any>null;
}
return result200;
} else if (status === 403) {
const _responseText = response.data;
let result403: any = null;
let resultData403 = _responseText;
result403 = RemoteServiceErrorResponse.fromJS(resultData403);
return throwException("Forbidden", status, _responseText, _headers, result403);
} else if (status === 401) {
const _responseText = response.data;
let result401: any = null;
let resultData401 = _responseText;
result401 = RemoteServiceErrorResponse.fromJS(resultData401);
return throwException("Unauthorized", status, _responseText, _headers, result401);
} else if (status === 400) {
const _responseText = response.data;
let result400: any = null;
let resultData400 = _responseText;
result400 = RemoteServiceErrorResponse.fromJS(resultData400);
return throwException("Bad Request", status, _responseText, _headers, result400);
} else if (status === 404) {
const _responseText = response.data;
let result404: any = null;
let resultData404 = _responseText;
result404 = RemoteServiceErrorResponse.fromJS(resultData404);
return throwException("Not Found", status, _responseText, _headers, result404);
} else if (status === 501) {
const _responseText = response.data;
let result501: any = null;
let resultData501 = _responseText;
result501 = RemoteServiceErrorResponse.fromJS(resultData501);
return throwException("Server Error", status, _responseText, _headers, result501);
} else if (status === 500) {
const _responseText = response.data;
let result500: any = null;
let resultData500 = _responseText;
result500 = RemoteServiceErrorResponse.fromJS(resultData500);
return throwException("Server Error", status, _responseText, _headers, result500);
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<StringStringFromSelector[]>(<any>null);
}
}
export class AuditLogsServiceProxy extends ServiceProxyBase {
@ -4787,6 +4883,7 @@ export class ActionApiDescriptionModel implements IActionApiDescriptionModel {
parametersOnMethod!: MethodParameterApiDescriptionModel[] | undefined;
parameters!: ParameterApiDescriptionModel[] | undefined;
returnValue!: ReturnValueApiDescriptionModel;
allowAnonymous!: boolean | undefined;
constructor(data?: IActionApiDescriptionModel) {
if (data) {
@ -4819,6 +4916,7 @@ export class ActionApiDescriptionModel implements IActionApiDescriptionModel {
this.parameters!.push(ParameterApiDescriptionModel.fromJS(item));
}
this.returnValue = _data["returnValue"] ? ReturnValueApiDescriptionModel.fromJS(_data["returnValue"]) : <any>undefined;
this.allowAnonymous = _data["allowAnonymous"];
}
}
@ -4851,6 +4949,7 @@ export class ActionApiDescriptionModel implements IActionApiDescriptionModel {
data["parameters"].push(item.toJSON());
}
data["returnValue"] = this.returnValue ? this.returnValue.toJSON() : <any>undefined;
data["allowAnonymous"] = this.allowAnonymous;
return data;
}
}
@ -4864,6 +4963,7 @@ export interface IActionApiDescriptionModel {
parametersOnMethod: MethodParameterApiDescriptionModel[] | undefined;
parameters: ParameterApiDescriptionModel[] | undefined;
returnValue: ReturnValueApiDescriptionModel;
allowAnonymous: boolean | undefined;
}
export class AddCorsInput implements IAddCorsInput {
@ -4987,6 +5087,7 @@ export interface IApiResourceClaimOutput {
}
export class ApiResourceOutput implements IApiResourceOutput {
id!: string;
name!: string | undefined;
displayName!: string | undefined;
description!: string | undefined;
@ -5009,6 +5110,7 @@ export class ApiResourceOutput implements IApiResourceOutput {
init(_data?: any) {
if (_data) {
this.id = _data["id"];
this.name = _data["name"];
this.displayName = _data["displayName"];
this.description = _data["description"];
@ -5047,6 +5149,7 @@ export class ApiResourceOutput implements IApiResourceOutput {
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["id"] = this.id;
data["name"] = this.name;
data["displayName"] = this.displayName;
data["description"] = this.description;
@ -5078,6 +5181,7 @@ export class ApiResourceOutput implements IApiResourceOutput {
}
export interface IApiResourceOutput {
id: string;
name: string | undefined;
displayName: string | undefined;
description: string | undefined;
@ -6233,10 +6337,7 @@ export class CreateApiResourceInput implements ICreateApiResourceInput {
enabled!: boolean;
allowedAccessTokenSigningAlgorithms!: string | undefined;
showInDiscoveryDocument!: boolean;
secrets!: ApiResourceSecretOutput[] | undefined;
scopes!: ApiResourceScopeOutput[] | undefined;
userClaims!: ApiResourceClaimOutput[] | undefined;
properties!: ApiResourcePropertyOutput[] | undefined;
secret!: string | undefined;
constructor(data?: ICreateApiResourceInput) {
if (data) {
@ -6255,26 +6356,7 @@ export class CreateApiResourceInput implements ICreateApiResourceInput {
this.enabled = _data["enabled"];
this.allowedAccessTokenSigningAlgorithms = _data["allowedAccessTokenSigningAlgorithms"];
this.showInDiscoveryDocument = _data["showInDiscoveryDocument"];
if (Array.isArray(_data["secrets"])) {
this.secrets = [] as any;
for (let item of _data["secrets"])
this.secrets!.push(ApiResourceSecretOutput.fromJS(item));
}
if (Array.isArray(_data["scopes"])) {
this.scopes = [] as any;
for (let item of _data["scopes"])
this.scopes!.push(ApiResourceScopeOutput.fromJS(item));
}
if (Array.isArray(_data["userClaims"])) {
this.userClaims = [] as any;
for (let item of _data["userClaims"])
this.userClaims!.push(ApiResourceClaimOutput.fromJS(item));
}
if (Array.isArray(_data["properties"])) {
this.properties = [] as any;
for (let item of _data["properties"])
this.properties!.push(ApiResourcePropertyOutput.fromJS(item));
}
this.secret = _data["secret"];
}
}
@ -6293,26 +6375,7 @@ export class CreateApiResourceInput implements ICreateApiResourceInput {
data["enabled"] = this.enabled;
data["allowedAccessTokenSigningAlgorithms"] = this.allowedAccessTokenSigningAlgorithms;
data["showInDiscoveryDocument"] = this.showInDiscoveryDocument;
if (Array.isArray(this.secrets)) {
data["secrets"] = [];
for (let item of this.secrets)
data["secrets"].push(item.toJSON());
}
if (Array.isArray(this.scopes)) {
data["scopes"] = [];
for (let item of this.scopes)
data["scopes"].push(item.toJSON());
}
if (Array.isArray(this.userClaims)) {
data["userClaims"] = [];
for (let item of this.userClaims)
data["userClaims"].push(item.toJSON());
}
if (Array.isArray(this.properties)) {
data["properties"] = [];
for (let item of this.properties)
data["properties"].push(item.toJSON());
}
data["secret"] = this.secret;
return data;
}
}
@ -6324,10 +6387,7 @@ export interface ICreateApiResourceInput {
enabled: boolean;
allowedAccessTokenSigningAlgorithms: string | undefined;
showInDiscoveryDocument: boolean;
secrets: ApiResourceSecretOutput[] | undefined;
scopes: ApiResourceScopeOutput[] | undefined;
userClaims: ApiResourceClaimOutput[] | undefined;
properties: ApiResourcePropertyOutput[] | undefined;
secret: string | undefined;
}
export class CreateApiScopeInput implements ICreateApiScopeInput {
@ -6706,6 +6766,8 @@ export class CurrentUserDto implements ICurrentUserDto {
isAuthenticated!: boolean;
id!: string | undefined;
tenantId!: string | undefined;
impersonatorUserId!: string | undefined;
impersonatorTenantId!: string | undefined;
userName!: string | undefined;
name!: string | undefined;
surName!: string | undefined;
@ -6729,6 +6791,8 @@ export class CurrentUserDto implements ICurrentUserDto {
this.isAuthenticated = _data["isAuthenticated"];
this.id = _data["id"];
this.tenantId = _data["tenantId"];
this.impersonatorUserId = _data["impersonatorUserId"];
this.impersonatorTenantId = _data["impersonatorTenantId"];
this.userName = _data["userName"];
this.name = _data["name"];
this.surName = _data["surName"];
@ -6756,6 +6820,8 @@ export class CurrentUserDto implements ICurrentUserDto {
data["isAuthenticated"] = this.isAuthenticated;
data["id"] = this.id;
data["tenantId"] = this.tenantId;
data["impersonatorUserId"] = this.impersonatorUserId;
data["impersonatorTenantId"] = this.impersonatorTenantId;
data["userName"] = this.userName;
data["name"] = this.name;
data["surName"] = this.surName;
@ -6776,6 +6842,8 @@ export interface ICurrentUserDto {
isAuthenticated: boolean;
id: string | undefined;
tenantId: string | undefined;
impersonatorUserId: string | undefined;
impersonatorTenantId: string | undefined;
userName: string | undefined;
name: string | undefined;
surName: string | undefined;
@ -7726,6 +7794,7 @@ export class FindTenantResultDto implements IFindTenantResultDto {
success!: boolean;
tenantId!: string | undefined;
name!: string | undefined;
isActive!: boolean;
constructor(data?: IFindTenantResultDto) {
if (data) {
@ -7741,6 +7810,7 @@ export class FindTenantResultDto implements IFindTenantResultDto {
this.success = _data["success"];
this.tenantId = _data["tenantId"];
this.name = _data["name"];
this.isActive = _data["isActive"];
}
}
@ -7756,6 +7826,7 @@ export class FindTenantResultDto implements IFindTenantResultDto {
data["success"] = this.success;
data["tenantId"] = this.tenantId;
data["name"] = this.name;
data["isActive"] = this.isActive;
return data;
}
}
@ -7764,6 +7835,7 @@ export interface IFindTenantResultDto {
success: boolean;
tenantId: string | undefined;
name: string | undefined;
isActive: boolean;
}
export class GetAuditLogPageListOutput implements IGetAuditLogPageListOutput {
@ -10586,6 +10658,7 @@ export interface IPagingIdentityResourceListInput {
}
export class PagingIdentityResourceListOutput implements IPagingIdentityResourceListOutput {
id!: string;
name!: string | undefined;
displayName!: string | undefined;
description!: string | undefined;
@ -10605,6 +10678,7 @@ export class PagingIdentityResourceListOutput implements IPagingIdentityResource
init(_data?: any) {
if (_data) {
this.id = _data["id"];
this.name = _data["name"];
this.displayName = _data["displayName"];
this.description = _data["description"];
@ -10624,6 +10698,7 @@ export class PagingIdentityResourceListOutput implements IPagingIdentityResource
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["id"] = this.id;
data["name"] = this.name;
data["displayName"] = this.displayName;
data["description"] = this.description;
@ -10636,6 +10711,7 @@ export class PagingIdentityResourceListOutput implements IPagingIdentityResource
}
export interface IPagingIdentityResourceListOutput {
id: string;
name: string | undefined;
displayName: string | undefined;
description: string | undefined;
@ -11793,6 +11869,46 @@ export interface ISetDataDictinaryDetailInput {
isEnabled: boolean;
}
export class StringStringFromSelector implements IStringStringFromSelector {
readonly value!: string | undefined;
readonly label!: string | undefined;
constructor(data?: IStringStringFromSelector) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(_data?: any) {
if (_data) {
(<any>this).value = _data["value"];
(<any>this).label = _data["label"];
}
}
static fromJS(data: any): StringStringFromSelector {
data = typeof data === 'object' ? data : {};
let result = new StringStringFromSelector();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["value"] = this.value;
data["label"] = this.label;
return data;
}
}
export interface IStringStringFromSelector {
value: string | undefined;
label: string | undefined;
}
export class TenantCreateDto implements ITenantCreateDto {
readonly extraProperties!: { [key: string]: any; } | undefined;
name!: string;
@ -12376,10 +12492,8 @@ export class UpdateApiResourceInput implements IUpdateApiResourceInput {
enabled!: boolean;
allowedAccessTokenSigningAlgorithms!: string | undefined;
showInDiscoveryDocument!: boolean;
secrets!: ApiResourceSecretOutput[] | undefined;
scopes!: ApiResourceScopeOutput[] | undefined;
userClaims!: ApiResourceClaimOutput[] | undefined;
properties!: ApiResourcePropertyOutput[] | undefined;
secret!: string | undefined;
apiScopes!: string[] | undefined;
constructor(data?: IUpdateApiResourceInput) {
if (data) {
@ -12398,25 +12512,11 @@ export class UpdateApiResourceInput implements IUpdateApiResourceInput {
this.enabled = _data["enabled"];
this.allowedAccessTokenSigningAlgorithms = _data["allowedAccessTokenSigningAlgorithms"];
this.showInDiscoveryDocument = _data["showInDiscoveryDocument"];
if (Array.isArray(_data["secrets"])) {
this.secrets = [] as any;
for (let item of _data["secrets"])
this.secrets!.push(ApiResourceSecretOutput.fromJS(item));
}
if (Array.isArray(_data["scopes"])) {
this.scopes = [] as any;
for (let item of _data["scopes"])
this.scopes!.push(ApiResourceScopeOutput.fromJS(item));
}
if (Array.isArray(_data["userClaims"])) {
this.userClaims = [] as any;
for (let item of _data["userClaims"])
this.userClaims!.push(ApiResourceClaimOutput.fromJS(item));
}
if (Array.isArray(_data["properties"])) {
this.properties = [] as any;
for (let item of _data["properties"])
this.properties!.push(ApiResourcePropertyOutput.fromJS(item));
this.secret = _data["secret"];
if (Array.isArray(_data["apiScopes"])) {
this.apiScopes = [] as any;
for (let item of _data["apiScopes"])
this.apiScopes!.push(item);
}
}
}
@ -12436,25 +12536,11 @@ export class UpdateApiResourceInput implements IUpdateApiResourceInput {
data["enabled"] = this.enabled;
data["allowedAccessTokenSigningAlgorithms"] = this.allowedAccessTokenSigningAlgorithms;
data["showInDiscoveryDocument"] = this.showInDiscoveryDocument;
if (Array.isArray(this.secrets)) {
data["secrets"] = [];
for (let item of this.secrets)
data["secrets"].push(item.toJSON());
}
if (Array.isArray(this.scopes)) {
data["scopes"] = [];
for (let item of this.scopes)
data["scopes"].push(item.toJSON());
}
if (Array.isArray(this.userClaims)) {
data["userClaims"] = [];
for (let item of this.userClaims)
data["userClaims"].push(item.toJSON());
}
if (Array.isArray(this.properties)) {
data["properties"] = [];
for (let item of this.properties)
data["properties"].push(item.toJSON());
data["secret"] = this.secret;
if (Array.isArray(this.apiScopes)) {
data["apiScopes"] = [];
for (let item of this.apiScopes)
data["apiScopes"].push(item);
}
return data;
}
@ -12467,10 +12553,8 @@ export interface IUpdateApiResourceInput {
enabled: boolean;
allowedAccessTokenSigningAlgorithms: string | undefined;
showInDiscoveryDocument: boolean;
secrets: ApiResourceSecretOutput[] | undefined;
scopes: ApiResourceScopeOutput[] | undefined;
userClaims: ApiResourceClaimOutput[] | undefined;
properties: ApiResourcePropertyOutput[] | undefined;
secret: string | undefined;
apiScopes: string[] | undefined;
}
export class UpdateCreateApiScopeInput implements IUpdateCreateApiScopeInput {

10
vben271/src/views/admin/roles/CreateAbpRole.vue

@ -1,11 +1,17 @@
<template>
<BasicModal :title="t('routes.admin.roleManagement_create_role')" :canFullscreen="false" @ok="submit" @cancel="cancel" @register="registerModal">
<BasicModal
:title="t('routes.admin.roleManagement_create_role')"
:canFullscreen="false"
@ok="submit"
@cancel="cancel"
@register="registerModal"
>
<BasicForm @register="registerUserForm" />
</BasicModal>
</template>
<script lang="ts">
import { defineComponent, useContext, defineEmit } from 'vue';
import { defineComponent } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form/index';
import { createFormSchema, createRoleAsync } from './AbpRole';

44
vben271/src/views/admin/users/EditAbpUser.vue

@ -26,7 +26,13 @@
<a-checkbox-group v-model:value="defaultRolesRef">
<a-row justify="center">
<a-col :span="24">
<a-checkbox style="width: 150px" v-for="(item, index) in rolesRef" :key="index" :value="item.name">{{ item.name }}</a-checkbox>
<a-checkbox
style="width: 150px"
v-for="(item, index) in rolesRef"
:key="index"
:value="item.name"
>{{ item.name }}</a-checkbox
>
</a-col>
</a-row>
</a-checkbox-group>
@ -37,12 +43,22 @@
</template>
<script lang="ts">
import { defineComponent, ref, useContext, defineEmit } from 'vue';
import { defineComponent, ref } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form/index';
import { Tabs } from 'ant-design-vue';
import { editFormSchema, getAllRoleAsync, updateUserAsync, getRolesByUserIdAsync } from './AbpUser';
import { IdentityRoleDto, IdentityUserDto, UpdateUserInput, IdentityUserUpdateDto } from '/@/services/ServiceProxies';
import {
editFormSchema,
getAllRoleAsync,
updateUserAsync,
getRolesByUserIdAsync,
} from './AbpUser';
import {
IdentityRoleDto,
IdentityUserDto,
UpdateUserInput,
IdentityUserUpdateDto,
} from '/@/services/ServiceProxies';
import { message } from 'ant-design-vue';
export default defineComponent({
name: 'EditAbpUser',
@ -54,15 +70,13 @@
},
emits: ['reload'],
setup(_, { emit }) {
//
// defineEmit(['reload']);
// const ctx = useContext();
const [registerUserForm, { getFieldsValue, validate, setFieldsValue, resetFields }] = useForm({
labelWidth: 120,
const [registerUserForm, { getFieldsValue, validate, setFieldsValue, resetFields }] = useForm(
{
labelWidth: 120,
schemas: editFormSchema,
showActionButtonGroup: false,
});
}
);
let currentUserInfo = new IdentityUserDto();
const [registerModal, { changeOkLoading, closeModal }] = useModalInner((data) => {
currentUserInfo = data.record;
@ -126,7 +140,13 @@
updateUserInput.userId = currentUserInfo.id;
updateUserInput.userInfo = userInfo;
await updateUserAsync({ request: updateUserInput, changeOkLoading, validate, closeModal, resetFields });
await updateUserAsync({
request: updateUserInput,
changeOkLoading,
validate,
closeModal,
resetFields,
});
emit('reload');
} catch (error) {
changeOkLoading(false);

96
vben271/src/views/identityServers/apiResources/ApiResources.ts

@ -1,6 +1,14 @@
import { FormSchema } from '/@/components/Table';
import { BasicColumn } from '/@/components/Table';
import { ApiResourceServiceProxy, PagingApiRseourceListInput, IdInput } from '/@/services/ServiceProxies';
import { message } from 'ant-design-vue';
import { useI18n } from '/@/hooks/web/useI18n';
const { t } = useI18n();
import {
ApiResourceServiceProxy,
PagingApiRseourceListInput,
IdInput,
ApiScopeServiceProxy,
} from '/@/services/ServiceProxies';
export const searchFormSchema: FormSchema[] = [
{
@ -82,13 +90,77 @@ export const createFormSchema: FormSchema[] = [
component: 'Switch',
colProps: { span: 20 },
},
// {
// field: 'allowedAccessTokenSigningAlgorithms',
// label: 'allowedAccessTokenSigningAlgorithms',
// component: 'Input',
// colProps: { span: 20 },
// },
];
export const editFormSchema: FormSchema[] = [
{
field: 'allowedAccessTokenSigningAlgorithms',
label: 'allowedAccessTokenSigningAlgorithms',
field: 'name',
label: 'name',
component: 'Input',
required: true,
labelWidth: 200,
colProps: { span: 20 },
},
{
field: 'displayName',
label: 'displayName',
component: 'Input',
required: true,
labelWidth: 200,
colProps: { span: 20 },
},
{
field: 'secret',
label: 'secret',
component: 'InputPassword',
required: true,
labelWidth: 200,
colProps: { span: 20 },
},
{
field: 'description',
label: 'description',
component: 'Input',
labelWidth: 200,
colProps: { span: 20 },
},
{
field: 'enabled',
label: 'enabled',
component: 'Switch',
labelWidth: 200,
colProps: { span: 20 },
},
{
field: 'showInDiscoveryDocument',
label: 'showInDiscoveryDocument',
labelWidth: 200,
component: 'Switch',
colProps: { span: 20 },
},
// {
// field: 'allowedAccessTokenSigningAlgorithms',
// label: 'allowedAccessTokenSigningAlgorithms',
// component: 'Input',
// colProps: { span: 20 },
// },
];
export const editApiScopeSchema: FormSchema[] = [
{
field: 'apiScopes',
label: '',
labelWidth: 100,
component: 'CheckboxGroup',
},
];
/**
*
* @param params
@ -119,3 +191,21 @@ export async function createApiResourceAsync({ request, changeOkLoading, validat
changeOkLoading(false);
closeModal();
}
export async function getAllApiScopeAsync() {
const _apiScopeServiceProxy = new ApiScopeServiceProxy();
return await _apiScopeServiceProxy.all();
}
export async function updateApiResourceAsync({ request, changeOkLoading, closeModal }) {
try {
changeOkLoading(true);
const _apiResourceServiceProxy = new ApiResourceServiceProxy();
await _apiResourceServiceProxy.update(request);
message.success(t('common.operationSuccess'));
closeModal();
} catch (error) {
} finally {
changeOkLoading(false);
}
}

43
vben271/src/views/identityServers/apiResources/ApiResources.vue

@ -17,26 +17,39 @@
</Tag>
</template>
<template #action="{ record }">
<!-- <a-button type="link" size="small" @click="handleEdit(record)">
<a-button type="link" size="small" @click="handleEdit(record)">
{{ t('common.editText') }}
</a-button> -->
</a-button>
<a-button type="link" size="small" @click="handleDelete(record)">
{{ t('common.delText') }}
</a-button>
</template>
</BasicTable>
<CreateApiResource @register="registerCreateApiResourceModal" @reload="reload" :bodyStyle="{ 'padding-top': '0' }"
<CreateApiResource
@register="registerCreateApiResourceModal"
@reload="reload"
:bodyStyle="{ 'padding-top': '0' }" />
<EditApiResources
@register="registerEditApiResourceModal"
@reload="reload"
:bodyStyle="{ 'padding-top': '0' }"
/></div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { tableColumns, searchFormSchema, getTableListAsync, deleteApiResourceAsync } from './ApiResources';
import {
tableColumns,
searchFormSchema,
getTableListAsync,
deleteApiResourceAsync,
} from './ApiResources';
import { useI18n } from '/@/hooks/web/useI18n';
import { Tag } from 'ant-design-vue';
import CreateApiResource from './CreateApiResource.vue';
import EditApiResources from './EditApiResources.vue';
import { useMessage } from '/@/hooks/web/useMessage';
import { useModal } from '/@/components/Modal';
export default defineComponent({
@ -46,6 +59,7 @@
TableAction,
Tag,
CreateApiResource,
EditApiResources,
},
setup() {
const { t } = useI18n();
@ -73,8 +87,11 @@
fixed: 'right',
},
});
const [registerCreateApiResourceModal, { openModal: openCreateApiResourceModal }] = useModal();
const [registerCreateApiResourceModal, { openModal: openCreateApiResourceModal }] =
useModal();
const [registerEditApiResourceModal, { openModal: openEditApiResourceModal }] = useModal();
const handleDelete = async (record: Recordable) => {
debugger;
let msg = '是否确认删除';
createConfirm({
iconType: 'warning',
@ -85,7 +102,21 @@
},
});
};
return { reload, t, registerTable, handleDelete, registerCreateApiResourceModal, openCreateApiResourceModal };
const handleEdit = (record: Recordable) => {
openEditApiResourceModal(true, {
record: record,
});
};
return {
reload,
t,
registerTable,
handleDelete,
handleEdit,
registerCreateApiResourceModal,
openCreateApiResourceModal,
registerEditApiResourceModal,
};
},
});
</script>

10
vben271/src/views/identityServers/apiResources/CreateApiResource.vue

@ -1,11 +1,17 @@
<template>
<BasicModal title="创建ApiResource" :canFullscreen="false" @ok="submit" @cancel="cancel" @register="registerModal">
<BasicModal
title="创建ApiResource"
:canFullscreen="false"
@ok="submit"
@cancel="cancel"
@register="registerModal"
>
<BasicForm @register="registerApiResourceForm" />
</BasicModal>
</template>
<script lang="ts">
import { defineComponent, useContext, defineEmit } from 'vue';
import { defineComponent } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form/index';
import { createFormSchema, createApiResourceAsync } from './ApiResources';

114
vben271/src/views/identityServers/apiResources/EditApiResources.vue

@ -0,0 +1,114 @@
<template>
<BasicModal
title="编辑ApiResources"
:width="700"
:canFullscreen="false"
@ok="submit"
@register="registerModal"
:bodyStyle="{ 'padding-top': '0' }"
:destroyOnClose="true"
>
<div>
<Tabs>
<TabPane tab="基本信息" key="1">
<BasicForm @register="registerBasicInfoForm" />
</TabPane>
<TabPane tab="ApiScopes" key="2" forceRender>
<BasicForm @register="registerApiScopeForm" />
</TabPane>
</Tabs>
</div>
</BasicModal>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form/index';
import { Tabs } from 'ant-design-vue';
import {
editFormSchema,
editApiScopeSchema,
getAllApiScopeAsync,
updateApiResourceAsync,
} from './ApiResources';
export default defineComponent({
name: 'EditApiResources',
components: {
BasicModal,
BasicForm,
Tabs,
TabPane: Tabs.TabPane,
},
emits: ['reload'],
setup(_, { emit }) {
const [
registerBasicInfoForm,
{
getFieldsValue: getFieldsBasicInfoValue,
validate: basicInfoValidate,
setFieldsValue: setBasicInfoFieldsValue,
},
] = useForm({
labelWidth: 120,
schemas: editFormSchema,
showActionButtonGroup: false,
});
const [
registerApiScopeForm,
{
getFieldsValue: getFieldsApiScopeValue,
validate: apiScopeValidate,
updateSchema: updateApiScopeSchema,
},
] = useForm({
labelWidth: 120,
schemas: editApiScopeSchema,
showActionButtonGroup: false,
});
const [registerModal, { changeOkLoading, closeModal }] = useModalInner(async (data) => {
setBasicInfoFieldsValue({
name: data.record.name,
displayName: data.record.displayName,
secret: data.record.secrets.length > 0 ? data.record.secrets[0].value : '',
description: data.record.description,
enabled: data.record.enabled,
showInDiscoveryDocument: data.record.showInDiscoveryDocument,
});
let apiScopes = await getAllApiScopeAsync();
const defaultApiScopes = data.record.scopes.map((e) => e.scope);
console.log(defaultApiScopes);
updateApiScopeSchema([
{
field: 'apiScopes',
defaultValue: defaultApiScopes,
componentProps: { options: apiScopes },
},
]);
});
const submit = async () => {
await basicInfoValidate();
await apiScopeValidate();
var basicInfo = getFieldsBasicInfoValue();
var apiScope = getFieldsApiScopeValue();
var request = Object.assign(basicInfo, apiScope);
await updateApiResourceAsync({ request, changeOkLoading, closeModal });
emit('reload');
};
return {
registerModal,
registerBasicInfoForm,
registerApiScopeForm,
submit,
};
},
});
</script>
<style lang="less" scoped>
.ant-checkbox-wrapper + .ant-checkbox-wrapper {
margin-left: 0px;
}
</style>

24
vben271/src/views/identityServers/apiScopes/ApiScopes.ts

@ -67,7 +67,6 @@ export const createFormSchema: FormSchema[] = [
field: 'enabled',
label: 'enabled',
component: 'Switch',
required: true,
labelWidth: 200,
colProps: { span: 20 },
},
@ -124,7 +123,6 @@ export const editFormSchema: FormSchema[] = [
field: 'enabled',
label: 'enabled',
component: 'Switch',
required: true,
labelWidth: 200,
colProps: { span: 20 },
},
@ -186,15 +184,17 @@ export async function deleteApiScopeAsync({ id, reload }) {
await _apiScopeServiceProxy.delete(request);
reload();
}
/**
*
* @param param0
*/
export async function editApiScopeAsync({ request, changeOkLoading, validate, closeModal }) {
await validate();
changeOkLoading(true);
const _apiScopeServiceProxy = new ApiScopeServiceProxy();
await _apiScopeServiceProxy.update(request);
changeOkLoading(false);
closeModal();
try {
await validate();
changeOkLoading(true);
const _apiScopeServiceProxy = new ApiScopeServiceProxy();
await _apiScopeServiceProxy.update(request);
changeOkLoading(false);
closeModal();
} catch (error) {
} finally {
changeOkLoading(false);
}
}

25
vben271/src/views/identityServers/clients/Clients.ts

@ -1,6 +1,14 @@
import { FormSchema } from '/@/components/Table';
import { BasicColumn } from '/@/components/Table';
import { ClientServiceProxy, EnabledInput, IdInput, PagingClientListInput } from '/@/services/ServiceProxies';
import { message } from 'ant-design-vue';
import { useI18n } from '/@/hooks/web/useI18n';
const { t } = useI18n();
import {
ClientServiceProxy,
EnabledInput,
IdInput,
PagingClientListInput,
} from '/@/services/ServiceProxies';
export const searchFormSchema: FormSchema[] = [
{
@ -301,6 +309,19 @@ export async function createClientAsync({ request, changeOkLoading, validate, cl
closeModal();
}
export async function updateClientAsync({ request, changeOkLoading, closeModal }) {
try {
changeOkLoading(true);
const _clientServiceProxy = new ClientServiceProxy();
await _clientServiceProxy.updateBasic(request);
message.success(t('common.operationSuccess'));
closeModal();
} catch (error) {
} finally {
changeOkLoading(false);
}
}
/**
*
* @param param0
@ -313,7 +334,7 @@ export async function deleteClientAsync({ id, reload }) {
reload();
}
/**
*
*
* @param param0
*/
export async function enabledClientAsync({ clientId, enabled, reload }) {

110
vben271/src/views/identityServers/clients/EditClientBasic.vue

@ -4,25 +4,22 @@
:width="700"
:canFullscreen="false"
@ok="submit"
@cancel="cancel"
@register="registerModal"
@visible-change="visibleChange"
:bodyStyle="{ 'padding-top': '0' }"
:destroyOnClose="true"
:maskClosable="false"
>
<div>
<Tabs>
<TabPane tab="基本信息" key="1">
<BasicForm @register="registerDetailForm" />
</TabPane>
<TabPane tab="Options" key="2">
<TabPane tab="Options" key="2" forceRender>
<BasicForm @register="registerOptionForm" />
</TabPane>
<TabPane tab="Tokens" key="3">
<TabPane tab="Tokens" key="3" forceRender>
<BasicForm @register="registerTokenForm" />
</TabPane>
<TabPane tab="Secret" key="4">
<TabPane tab="Secret" key="4" forceRender>
<BasicForm @register="registerSecretForm" />
</TabPane>
</Tabs>
@ -31,11 +28,17 @@
</template>
<script lang="ts">
import { defineComponent, defineEmit } from 'vue';
import { defineComponent } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form/index';
import { Tabs } from 'ant-design-vue';
import { editBasicDetailSchema, editBasicOptionSchema, editBasicTokenSchema, editBasicSecretSchema } from './Clients';
import {
editBasicDetailSchema,
editBasicOptionSchema,
editBasicTokenSchema,
editBasicSecretSchema,
updateClientAsync,
} from './Clients';
export default defineComponent({
name: 'EditAbpUser',
@ -45,32 +48,59 @@
Tabs,
TabPane: Tabs.TabPane,
},
setup() {
emits: ['reload'],
setup(_, { emit }) {
//
// defineEmit(['reload']);
const [registerDetailForm, { getFieldsValue: getFieldsDetailValue, validate: detailValidate, setFieldsValue: setDetailFieldsValue }] = useForm({
const [
registerDetailForm,
{
getFieldsValue: getFieldsDetailValue,
validate: detailValidate,
setFieldsValue: setDetailFieldsValue,
},
] = useForm({
labelWidth: 120,
schemas: editBasicDetailSchema,
showActionButtonGroup: false,
});
const [registerOptionForm, { getFieldsValue: getFieldsOptionValue, validate: optionValidate, setFieldsValue: setOptionFieldsValue }] = useForm({
const [
registerOptionForm,
{
getFieldsValue: getFieldsOptionValue,
validate: optionValidate,
setFieldsValue: setOptionFieldsValue,
},
] = useForm({
labelWidth: 120,
schemas: editBasicOptionSchema,
showActionButtonGroup: false,
});
const [registerTokenForm, { getFieldsValue: getFieldsTokenValue, validate: tokenValidate, setFieldsValue: setTokenFieldsValue }] = useForm({
const [
registerTokenForm,
{
getFieldsValue: getFieldsTokenValue,
validate: tokenValidate,
setFieldsValue: setTokenFieldsValue,
},
] = useForm({
labelWidth: 120,
schemas: editBasicTokenSchema,
showActionButtonGroup: false,
});
const [registerSecretForm, { getFieldsValue: getFieldsSecretnValue, validate: secretValidate, setFieldsValue: setSecretFieldsValue }] = useForm(
const [
registerSecretForm,
{
labelWidth: 120,
schemas: editBasicSecretSchema,
showActionButtonGroup: false,
}
);
getFieldsValue: getFieldsSecretValue,
validate: secretValidate,
setFieldsValue: setSecretFieldsValue,
},
] = useForm({
labelWidth: 120,
schemas: editBasicSecretSchema,
showActionButtonGroup: false,
});
let currentClient: any;
const [registerModal, { changeOkLoading, closeModal }] = useModalInner((data) => {
currentClient = data.record;
@ -116,26 +146,32 @@
}
});
const visibleChange = async (visible: boolean) => {
if (visible) {
detailValidate();
optionValidate();
tokenValidate();
secretValidate();
getFieldsTokenValue();
getFieldsSecretnValue();
getFieldsOptionValue();
getFieldsDetailValue();
changeOkLoading(true);
} else {
}
};
// const visibleChange = async (visible: boolean) => {
// if (visible) {
// detailValidate();
// optionValidate();
// tokenValidate();
// secretValidate();
// getFieldsTokenValue();
// getFieldsSecretValue();
// getFieldsOptionValue();
// getFieldsDetailValue();
// }
// };
const submit = async () => {};
const cancel = () => {
closeModal();
const submit = async () => {
await detailValidate();
await optionValidate();
await tokenValidate();
await secretValidate();
var detailRequest = getFieldsDetailValue();
var optionRequest = getFieldsOptionValue();
var tokenRequest = getFieldsTokenValue();
var secretRequest = getFieldsSecretValue();
var request = Object.assign(detailRequest, optionRequest, tokenRequest, secretRequest);
await updateClientAsync({ request, changeOkLoading, closeModal });
emit('reload');
};
return {
registerModal,
registerDetailForm,
@ -143,8 +179,6 @@
registerTokenForm,
registerSecretForm,
submit,
visibleChange,
cancel,
};
},
});

71
vben271/src/views/identityServers/identityResources/EditIdentityResources.vue

@ -1,11 +1,76 @@
<template> </template>
<template>
<BasicModal
title="创建IdentityResource"
:canFullscreen="false"
@ok="submit"
@cancel="cancel"
@register="registerModal"
>
<BasicForm @register="registerIdentityResourcesForm" />
</BasicModal>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form/index';
import { editFormSchema, editIdentityResourceAsync } from './IdentityResources';
import { useI18n } from '/@/hooks/web/useI18n';
export default defineComponent({
name: 'EditIdentityResources',
setup() {
return {};
components: {
BasicModal,
BasicForm,
},
emits: ['reload'],
setup(_, { emit }) {
const { t } = useI18n();
const [
registerIdentityResourcesForm,
{ getFieldsValue, validate, resetFields, setFieldsValue },
] = useForm({
labelWidth: 120,
schemas: editFormSchema,
showActionButtonGroup: false,
});
const [registerModal, { changeOkLoading, closeModal }] = useModalInner((data) => {
setFieldsValue({
name: data.record.name,
enabled: data.record.enabled,
displayName: data.record.displayName,
description: data.record.description,
required: data.record.required,
emphasize: data.record.emphasize,
showInDiscoveryDocument: data.record.showInDiscoveryDocument,
});
});
//
const submit = async () => {
try {
const request = getFieldsValue();
await validate();
await editIdentityResourceAsync({ request, changeOkLoading, closeModal });
resetFields();
emit('reload');
} catch (error) {
changeOkLoading(false);
}
};
const cancel = () => {
resetFields();
closeModal();
};
return {
t,
registerModal,
registerIdentityResourcesForm,
submit,
cancel,
};
},
});
</script>

33
vben271/src/views/identityServers/identityResources/IdentityResources.ts

@ -1,7 +1,13 @@
import { FormSchema } from '/@/components/Table';
import { BasicColumn } from '/@/components/Table';
import { IdentityResourceServiceProxy, PagingIdentityResourceListInput, IdInput } from '/@/services/ServiceProxies';
import {
IdentityResourceServiceProxy,
PagingIdentityResourceListInput,
IdInput,
} from '/@/services/ServiceProxies';
import { message } from 'ant-design-vue';
import { useI18n } from '/@/hooks/web/useI18n';
const { t } = useI18n();
export const searchFormSchema: FormSchema[] = [
{
field: 'filter',
@ -98,6 +104,7 @@ export const createFormSchema: FormSchema[] = [
colProps: { span: 20 },
},
];
export const editFormSchema: FormSchema[] = [
{
field: 'name',
@ -154,6 +161,7 @@ export const editFormSchema: FormSchema[] = [
colProps: { span: 20 },
},
];
/**
*
* @param params
@ -163,7 +171,12 @@ export async function getTableListAsync(params: PagingIdentityResourceListInput)
const _identityResourceServiceProxy = new IdentityResourceServiceProxy();
return _identityResourceServiceProxy.page(params);
}
export async function createIdentityResourcesAsync({ request, changeOkLoading, validate, closeModal }) {
export async function createIdentityResourcesAsync({
request,
changeOkLoading,
validate,
closeModal,
}) {
changeOkLoading(true);
await validate();
const _identityResourceServiceProxy = new IdentityResourceServiceProxy();
@ -182,3 +195,17 @@ export async function deleteIdentityResourcesAsync({ id, reload }) {
await _identityResourceServiceProxy.delete(request);
reload();
}
export async function editIdentityResourceAsync({ request, changeOkLoading, closeModal }) {
try {
changeOkLoading(true);
const _identityResourceServiceProxy = new IdentityResourceServiceProxy();
await _identityResourceServiceProxy.update(request);
changeOkLoading(false);
message.success(t('common.operationSuccess'));
closeModal();
} catch (error) {
} finally {
changeOkLoading(false);
}
}

11836
vben271/yarn.lock

File diff suppressed because it is too large
Loading…
Cancel
Save