Browse Source

fix: fixed some bugs

pull/355/head
cKey 4 years ago
parent
commit
4cc6edbcf1
  1. 4
      aspnet-core/modules/auditing/LINGYUN.Abp.AuditLogging.Elasticsearch/LINGYUN/Abp/AuditLogging/Elasticsearch/ElasticsearchAuditLogManager.cs
  2. 4
      aspnet-core/modules/auditing/LINGYUN.Abp.AuditLogging.Elasticsearch/LINGYUN/Abp/AuditLogging/Elasticsearch/ElasticsearchSecurityLogManager.cs
  3. 2
      aspnet-core/modules/elasticsearch/LINGYUN.Abp.Elasticsearch/LINGYUN/Abp/Elasticsearch/AbpElasticsearchOptions.cs
  4. 9
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IMenuRepository.cs
  5. 10
      aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs
  6. 1
      aspnet-core/services/account/AuthServer.Host/Dockerfile
  7. 4
      aspnet-core/services/admin/LINGYUN.Abp.BackendAdmin.HttpApi.Host/BackendAdminHostModule.cs
  8. 2
      aspnet-core/services/admin/LINGYUN.Abp.BackendAdmin.HttpApi.Host/LINGYUN.Abp.BackendAdmin.HttpApi.Host.csproj
  9. 1
      aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/Dockerfile
  10. 1
      aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/Dockerfile
  11. 139
      aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/Volo/Abp/Authorization/Permissions/PermissionChecker.cs
  12. 1
      aspnet-core/services/identity-server/LINGYUN.Abp.IdentityServer4.HttpApi.Host/Dockerfile
  13. 1
      aspnet-core/services/localization/LINGYUN.Abp.LocalizationManagement.HttpApi.Host/Dockerfile
  14. 1
      aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Dockerfile
  15. 4
      aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Dockerfile
  16. 7
      docker-compose.override.yml

4
aspnet-core/modules/auditing/LINGYUN.Abp.AuditLogging.Elasticsearch/LINGYUN/Abp/AuditLogging/Elasticsearch/ElasticsearchAuditLogManager.cs

@ -17,7 +17,7 @@ using Volo.Abp;
namespace LINGYUN.Abp.AuditLogging.Elasticsearch namespace LINGYUN.Abp.AuditLogging.Elasticsearch
{ {
[Dependency(ReplaceServices = true)] [Dependency(ReplaceServices = true)]
public class ElasticsearchAuditLogManager : IAuditLogManager, ISingletonDependency public class ElasticsearchAuditLogManager : IAuditLogManager, ITransientDependency
{ {
private readonly AbpAuditingOptions _auditingOptions; private readonly AbpAuditingOptions _auditingOptions;
private readonly AbpElasticsearchOptions _elasticsearchOptions; private readonly AbpElasticsearchOptions _elasticsearchOptions;
@ -31,7 +31,7 @@ namespace LINGYUN.Abp.AuditLogging.Elasticsearch
public ElasticsearchAuditLogManager( public ElasticsearchAuditLogManager(
ICurrentTenant currentTenant, ICurrentTenant currentTenant,
IOptions<AbpElasticsearchOptions> elasticsearchOptions, IOptions<AbpElasticsearchOptions> elasticsearchOptions,
IOptions<AbpAuditLoggingElasticsearchOptions> options, IOptionsSnapshot<AbpAuditLoggingElasticsearchOptions> options,
IElasticsearchClientFactory clientFactory, IElasticsearchClientFactory clientFactory,
IOptions<AbpAuditingOptions> auditingOptions, IOptions<AbpAuditingOptions> auditingOptions,
IAuditLogInfoToAuditLogConverter converter) IAuditLogInfoToAuditLogConverter converter)

4
aspnet-core/modules/auditing/LINGYUN.Abp.AuditLogging.Elasticsearch/LINGYUN/Abp/AuditLogging/Elasticsearch/ElasticsearchSecurityLogManager.cs

@ -16,7 +16,7 @@ using Volo.Abp.SecurityLog;
namespace LINGYUN.Abp.AuditLogging.Elasticsearch namespace LINGYUN.Abp.AuditLogging.Elasticsearch
{ {
[Dependency(ReplaceServices = true)] [Dependency(ReplaceServices = true)]
public class ElasticsearchSecurityLogManager : ISecurityLogManager, ISingletonDependency public class ElasticsearchSecurityLogManager : ISecurityLogManager, ITransientDependency
{ {
private readonly AbpSecurityLogOptions _securityLogOptions; private readonly AbpSecurityLogOptions _securityLogOptions;
private readonly AbpElasticsearchOptions _elasticsearchOptions; private readonly AbpElasticsearchOptions _elasticsearchOptions;
@ -32,7 +32,7 @@ namespace LINGYUN.Abp.AuditLogging.Elasticsearch
IGuidGenerator guidGenerator, IGuidGenerator guidGenerator,
IOptions<AbpSecurityLogOptions> securityLogOptions, IOptions<AbpSecurityLogOptions> securityLogOptions,
IOptions<AbpElasticsearchOptions> elasticsearchOptions, IOptions<AbpElasticsearchOptions> elasticsearchOptions,
IOptions<AbpAuditLoggingElasticsearchOptions> options, IOptionsSnapshot<AbpAuditLoggingElasticsearchOptions> options,
IElasticsearchClientFactory clientFactory) IElasticsearchClientFactory clientFactory)
{ {
_options = options.Value; _options = options.Value;

2
aspnet-core/modules/elasticsearch/LINGYUN.Abp.Elasticsearch/LINGYUN/Abp/Elasticsearch/AbpElasticsearchOptions.cs

@ -15,7 +15,6 @@ namespace LINGYUN.Abp.Elasticsearch
/// 默认:false /// 默认:false
/// </summary> /// </summary>
public bool FieldCamelCase { get; set; } public bool FieldCamelCase { get; set; }
public string TypeName { get; set; }
public string NodeUris { get; set; } public string NodeUris { get; set; }
public int ConnectionLimit { get; set; } public int ConnectionLimit { get; set; }
public string UserName { get; set; } public string UserName { get; set; }
@ -26,7 +25,6 @@ namespace LINGYUN.Abp.Elasticsearch
public AbpElasticsearchOptions() public AbpElasticsearchOptions()
{ {
TypeName = "_doc";
ConnectionLimit = ConnectionConfiguration.DefaultConnectionLimit; ConnectionLimit = ConnectionConfiguration.DefaultConnectionLimit;
ConnectionTimeout = ConnectionConfiguration.DefaultTimeout; ConnectionTimeout = ConnectionConfiguration.DefaultTimeout;
} }

9
aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IMenuRepository.cs

@ -9,6 +9,15 @@ namespace LINGYUN.Platform.Menus
public interface IMenuRepository : IBasicRepository<Menu, Guid> public interface IMenuRepository : IBasicRepository<Menu, Guid>
{ {
/// <summary> /// <summary>
/// 获取最后一个菜单
/// </summary>
/// <param name="parentId"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
Task<Menu> GetLastMenuAsync(
Guid? parentId = null,
CancellationToken cancellationToken = default);
/// <summary>
/// 根据名称查询菜单 /// 根据名称查询菜单
/// </summary> /// </summary>
/// <param name="menuName"></param> /// <param name="menuName"></param>

10
aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs

@ -19,6 +19,16 @@ namespace LINGYUN.Platform.Menus
{ {
} }
public virtual async Task<Menu> GetLastMenuAsync(
Guid? parentId = null,
CancellationToken cancellationToken = default)
{
return await (await GetDbSetAsync())
.Where(x => x.ParentId == parentId)
.OrderByDescending(x => x.CreationTime)
.FirstOrDefaultAsync(GetCancellationToken(cancellationToken));
}
public virtual async Task<bool> UserHasInMenuAsync( public virtual async Task<bool> UserHasInMenuAsync(
Guid userId, Guid userId,
string menuName, string menuName,

1
aspnet-core/services/account/AuthServer.Host/Dockerfile

@ -9,5 +9,6 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo '$TZ' > /etc/timezone
EXPOSE 80/tcp EXPOSE 80/tcp
VOLUME [ "./app/Logs" ] VOLUME [ "./app/Logs" ]
VOLUME [ "./app/Modules" ]
ENTRYPOINT ["dotnet", "AuthServer.Host.dll"] ENTRYPOINT ["dotnet", "AuthServer.Host.dll"]

4
aspnet-core/services/admin/LINGYUN.Abp.BackendAdmin.HttpApi.Host/BackendAdminHostModule.cs

@ -19,7 +19,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.AspNetCore.Authentication.JwtBearer; using Volo.Abp.AspNetCore.Authentication.JwtBearer;
using Volo.Abp.AspNetCore.MultiTenancy; using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy;
using Volo.Abp.AspNetCore.Serilog; using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.Autofac; using Volo.Abp.Autofac;
using Volo.Abp.Caching.StackExchangeRedis; using Volo.Abp.Caching.StackExchangeRedis;
@ -43,7 +43,7 @@ namespace LINGYUN.Abp.BackendAdmin
typeof(AbpAspNetCoreSerilogModule), typeof(AbpAspNetCoreSerilogModule),
typeof(AbpLoggingSerilogElasticsearchModule), typeof(AbpLoggingSerilogElasticsearchModule),
typeof(AbpAuditLoggingElasticsearchModule), typeof(AbpAuditLoggingElasticsearchModule),
typeof(AbpAspNetCoreMultiTenancyModule), typeof(AbpAspNetCoreMvcUiMultiTenancyModule),
typeof(AbpSettingManagementApplicationModule), typeof(AbpSettingManagementApplicationModule),
typeof(AbpSettingManagementHttpApiModule), typeof(AbpSettingManagementHttpApiModule),
typeof(AbpPermissionManagementApplicationModule), typeof(AbpPermissionManagementApplicationModule),

2
aspnet-core/services/admin/LINGYUN.Abp.BackendAdmin.HttpApi.Host/LINGYUN.Abp.BackendAdmin.HttpApi.Host.csproj

@ -42,7 +42,7 @@
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.5" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.5" />
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="4.4.0" /> <PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="4.4.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="4.4.0" /> <PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="4.4.0" />
<PackageReference Include="Volo.Abp.AspNetCore.MultiTenancy" Version="4.4.0" /> <PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy" Version="4.4.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="4.4.0" /> <PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="4.4.0" />
<PackageReference Include="Volo.Abp.Autofac" Version="4.4.0" /> <PackageReference Include="Volo.Abp.Autofac" Version="4.4.0" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.MySQL" Version="4.4.0" /> <PackageReference Include="Volo.Abp.EntityFrameworkCore.MySQL" Version="4.4.0" />

1
aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/Dockerfile

@ -9,5 +9,6 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo '$TZ' > /etc/timezone
EXPOSE 80/tcp EXPOSE 80/tcp
VOLUME [ "./app/Logs" ] VOLUME [ "./app/Logs" ]
VOLUME [ "./app/Modules" ]
ENTRYPOINT ["dotnet", "LINGYUN.ApiGateway.Host.dll"] ENTRYPOINT ["dotnet", "LINGYUN.ApiGateway.Host.dll"]

1
aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/Dockerfile

@ -9,5 +9,6 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo '$TZ' > /etc/timezone
EXPOSE 80/tcp EXPOSE 80/tcp
VOLUME [ "./app/Logs" ] VOLUME [ "./app/Logs" ]
VOLUME [ "./app/Modules" ]
ENTRYPOINT ["dotnet", "LINGYUN.ApiGateway.HttpApi.Host.dll"] ENTRYPOINT ["dotnet", "LINGYUN.ApiGateway.HttpApi.Host.dll"]

139
aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/Volo/Abp/Authorization/Permissions/PermissionChecker.cs

@ -1,139 +0,0 @@
using Microsoft.Extensions.DependencyInjection;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Security.Principal;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Security.Claims;
namespace Volo.Abp.Authorization.Permissions
{
[Dependency(ServiceLifetime.Transient, ReplaceServices = true)]
[ExposeServices(typeof(IPermissionChecker))]
public class PermissionChecker : IPermissionChecker
{
protected IPermissionDefinitionManager PermissionDefinitionManager { get; }
protected ICurrentPrincipalAccessor PrincipalAccessor { get; }
protected ICurrentTenant CurrentTenant { get; }
protected IPermissionValueProviderManager PermissionValueProviderManager { get; }
public PermissionChecker(
ICurrentPrincipalAccessor principalAccessor,
IPermissionDefinitionManager permissionDefinitionManager,
ICurrentTenant currentTenant,
IPermissionValueProviderManager permissionValueProviderManager)
{
PrincipalAccessor = principalAccessor;
PermissionDefinitionManager = permissionDefinitionManager;
CurrentTenant = currentTenant;
PermissionValueProviderManager = permissionValueProviderManager;
}
public virtual async Task<bool> IsGrantedAsync(string name)
{
return await IsGrantedAsync(PrincipalAccessor.Principal, name);
}
public virtual async Task<bool> IsGrantedAsync(
ClaimsPrincipal claimsPrincipal,
string name)
{
Check.NotNull(name, nameof(name));
var permission = PermissionDefinitionManager.Get(name);
if (!permission.IsEnabled)
{
return false;
}
var multiTenancySide = claimsPrincipal?.GetMultiTenancySide()
?? CurrentTenant.GetMultiTenancySide();
if (!permission.MultiTenancySide.HasFlag(multiTenancySide))
{
return false;
}
var isGranted = false;
var context = new PermissionValueCheckContext(permission, claimsPrincipal);
foreach (var provider in PermissionValueProviderManager.ValueProviders)
{
if (context.Permission.Providers.Any() &&
!context.Permission.Providers.Contains(provider.Name))
{
continue;
}
var result = await provider.CheckAsync(context);
if (result == PermissionGrantResult.Granted)
{
isGranted = true;
}
else if (result == PermissionGrantResult.Prohibited)
{
return false;
}
}
return isGranted;
}
public async Task<MultiplePermissionGrantResult> IsGrantedAsync(string[] names)
{
return await IsGrantedAsync(PrincipalAccessor.Principal, names);
}
public async Task<MultiplePermissionGrantResult> IsGrantedAsync(ClaimsPrincipal claimsPrincipal, string[] names)
{
Check.NotNull(names, nameof(names));
var multiTenancySide = claimsPrincipal?.GetMultiTenancySide() ?? CurrentTenant.GetMultiTenancySide();
var result = new MultiplePermissionGrantResult();
if (!names.Any())
{
return result;
}
var permissionDefinitions = new List<PermissionDefinition>();
foreach (var name in names)
{
var permission = PermissionDefinitionManager.Get(name);
result.Result.Add(name, PermissionGrantResult.Undefined);
if (permission.IsEnabled && permission.MultiTenancySide.HasFlag(multiTenancySide))
{
permissionDefinitions.Add(permission);
}
}
foreach (var provider in PermissionValueProviderManager.ValueProviders)
{
var context = new PermissionValuesCheckContext(
permissionDefinitions.Where(x => !x.Providers.Any() || x.Providers.Contains(provider.Name)).ToList(),
claimsPrincipal);
var multipleResult = await provider.CheckAsync(context);
foreach (var grantResult in multipleResult.Result.Where(grantResult =>
result.Result.ContainsKey(grantResult.Key) &&
result.Result[grantResult.Key] == PermissionGrantResult.Undefined &&
grantResult.Value != PermissionGrantResult.Undefined))
{
result.Result[grantResult.Key] = grantResult.Value;
permissionDefinitions.RemoveAll(x => x.Name == grantResult.Key);
}
if (result.AllGranted || result.AllProhibited)
{
break;
}
}
return result;
}
}
}

1
aspnet-core/services/identity-server/LINGYUN.Abp.IdentityServer4.HttpApi.Host/Dockerfile

@ -9,5 +9,6 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo '$TZ' > /etc/timezone
EXPOSE 80/tcp EXPOSE 80/tcp
VOLUME [ "./app/Logs" ] VOLUME [ "./app/Logs" ]
VOLUME [ "./app/Modules" ]
ENTRYPOINT ["dotnet", "LINGYUN.Abp.IdentityServer4.HttpApi.Host.dll"] ENTRYPOINT ["dotnet", "LINGYUN.Abp.IdentityServer4.HttpApi.Host.dll"]

1
aspnet-core/services/localization/LINGYUN.Abp.LocalizationManagement.HttpApi.Host/Dockerfile

@ -9,5 +9,6 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo '$TZ' > /etc/timezone
EXPOSE 80/tcp EXPOSE 80/tcp
VOLUME [ "./app/Logs" ] VOLUME [ "./app/Logs" ]
VOLUME [ "./app/Modules" ]
ENTRYPOINT ["dotnet", "LINGYUN.Abp.LocalizationManagement.HttpApi.Host.dll"] ENTRYPOINT ["dotnet", "LINGYUN.Abp.LocalizationManagement.HttpApi.Host.dll"]

1
aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Dockerfile

@ -9,5 +9,6 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo '$TZ' > /etc/timezone
EXPOSE 80/tcp EXPOSE 80/tcp
VOLUME [ "./app/Logs" ] VOLUME [ "./app/Logs" ]
VOLUME [ "./app/Modules" ]
ENTRYPOINT ["dotnet", "LINGYUN.Abp.MessageService.HttpApi.Host.dll"] ENTRYPOINT ["dotnet", "LINGYUN.Abp.MessageService.HttpApi.Host.dll"]

4
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Dockerfile

@ -8,6 +8,8 @@ ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo '$TZ' > /etc/timezone RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo '$TZ' > /etc/timezone
EXPOSE 80/tcp EXPOSE 80/tcp
VOLUME [ "./app/Logs", "./app/file-blob-storing" ] VOLUME [ "./app/Logs" ]
VOLUME [ "./app/Modules" ]
VOLUME [ "./app/file-blob-storing" ]
ENTRYPOINT ["dotnet", "LINGYUN.Platform.HttpApi.Host.dll"] ENTRYPOINT ["dotnet", "LINGYUN.Platform.HttpApi.Host.dll"]

7
docker-compose.override.yml

@ -6,6 +6,7 @@ services:
context: ./aspnet-core/services/Publish/identityserver context: ./aspnet-core/services/Publish/identityserver
volumes: volumes:
- /var/opt/abp/logs/ids-sts:/app/Logs - /var/opt/abp/logs/ids-sts:/app/Logs
- /var/opt/abp/data/ids-sts/Modules:/app/Modules
restart: always restart: always
identity-server-admin: identity-server-admin:
@ -13,6 +14,7 @@ services:
context: ./aspnet-core/services/Publish/identityserver4-admin context: ./aspnet-core/services/Publish/identityserver4-admin
volumes: volumes:
- /var/opt/abp/logs/ids-admin:/app/Logs - /var/opt/abp/logs/ids-admin:/app/Logs
- /var/opt/abp/data/ids-admin/Modules:/app/Modules
depends_on: depends_on:
- identity-server-sts - identity-server-sts
restart: always restart: always
@ -32,6 +34,7 @@ services:
context: ./aspnet-core/services/Publish/localization context: ./aspnet-core/services/Publish/localization
volumes: volumes:
- /var/opt/abp/logs/localization:/app/Logs - /var/opt/abp/logs/localization:/app/Logs
- /var/opt/abp/data/localization/Modules:/app/Modules
restart: always restart: always
platform-service: platform-service:
@ -39,6 +42,7 @@ services:
context: ./aspnet-core/services/Publish/platform context: ./aspnet-core/services/Publish/platform
volumes: volumes:
- /var/opt/abp/logs/platform:/app/Logs - /var/opt/abp/logs/platform:/app/Logs
- /var/opt/abp/data/platform/Modules:/app/Modules
- /var/opt/abp/data/platform:/app/file-blob-storing - /var/opt/abp/data/platform:/app/file-blob-storing
depends_on: depends_on:
- identity-server-sts - identity-server-sts
@ -49,6 +53,7 @@ services:
context: ./aspnet-core/services/Publish/messages context: ./aspnet-core/services/Publish/messages
volumes: volumes:
- /var/opt/abp/logs/messages:/app/Logs - /var/opt/abp/logs/messages:/app/Logs
- /var/opt/abp/data/messages/Modules:/app/Modules
depends_on: depends_on:
- identity-server-sts - identity-server-sts
restart: always restart: always
@ -58,6 +63,7 @@ services:
context: ./aspnet-core/services/Publish/apigateway-admin context: ./aspnet-core/services/Publish/apigateway-admin
volumes: volumes:
- /var/opt/abp/logs/apigateway-admin:/app/Logs - /var/opt/abp/logs/apigateway-admin:/app/Logs
- /var/opt/abp/data/apigateway-admin/Modules:/app/Modules
depends_on: depends_on:
- identity-server-sts - identity-server-sts
- admin-service - admin-service
@ -68,6 +74,7 @@ services:
context: ./aspnet-core/services/Publish/apigateway-host context: ./aspnet-core/services/Publish/apigateway-host
volumes: volumes:
- /var/opt/abp/logs/apigateway-host:/app/Logs - /var/opt/abp/logs/apigateway-host:/app/Logs
- /var/opt/abp/data/apigateway-host/Modules:/app/Modules
depends_on: depends_on:
- identity-server-sts - identity-server-sts
- apigateway-admin-service - apigateway-admin-service

Loading…
Cancel
Save