109 changed files with 782 additions and 524 deletions
@ -1,3 +1,25 @@ |
|||||
# Oss-Management |
# Oss-Management |
||||
|
|
||||
File-Management更名为Oss-Management |
File-Management更名为Oss-Management |
||||
|
|
||||
|
|
||||
|
## 模块说明 |
||||
|
|
||||
|
### 基础模块 |
||||
|
|
||||
|
* LINGYUN.Abp.OssManagement.Domain.Shared 领域层公共模块,定义了错误代码、本地化、模块设置 |
||||
|
* LINGYUN.Abp.OssManagement.Domain 领域层模块,定义了抽象的Oss容器与对象管理接口 |
||||
|
* LINGYUN.Abp.OssManagement.Application.Contracts 应用服务层公共模块,定义了管理Oss的外部接口、权限、功能限制策略 |
||||
|
* LINGYUN.Abp.OssManagement.Application 应用服务层实现,实现了Oss管理接口 |
||||
|
* LINGYUN.Abp.OssManagement.HttpApi RestApi实现,实现了独立的对外RestApi接口 |
||||
|
* LINGYUN.Abp.OssManagement.SettingManagement 设置管理模块,对外暴露自身的设置管理,用于网关聚合 |
||||
|
|
||||
|
### 高阶模块 |
||||
|
|
||||
|
* LINGYUN.Abp.OssManagement.Aliyun Oss管理的阿里云实现,实现了部分阿里云Oss服务的容器与对象管理 |
||||
|
* LINGYUN.Abp.OssManagement.FileSystem Oss管理的本地文件系统实现,实现了部分本地文件系统的容器(目录)与对象(文件/目录)管理 |
||||
|
* LINGYUN.Abp.OssManagement.FileSystem.ImageSharp Oss本地对象的ImageSharp扩展,当前端传递需求处理对象时,此模块用于实现基于图形文件流的处理 |
||||
|
|
||||
|
## 更新日志 |
||||
|
|
||||
|
*【2021-03-10】 变更FileManagement命名空间为OssManagement |
||||
|
|||||
@ -1,12 +0,0 @@ |
|||||
using Volo.Abp.Application; |
|
||||
using Volo.Abp.Modularity; |
|
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement |
|
||||
{ |
|
||||
[DependsOn( |
|
||||
typeof(AbpFileManagementDomainSharedModule), |
|
||||
typeof(AbpDddApplicationModule))] |
|
||||
public class AbpFileManagementApplicationContractsModule : AbpModule |
|
||||
{ |
|
||||
} |
|
||||
} |
|
||||
@ -1,49 +0,0 @@ |
|||||
using LINGYUN.Abp.FileManagement.Localization; |
|
||||
using Volo.Abp.Features; |
|
||||
using Volo.Abp.Localization; |
|
||||
using Volo.Abp.Validation.StringValues; |
|
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement.Features |
|
||||
{ |
|
||||
public class AbpFileManagementFeatureDefinitionProvider : FeatureDefinitionProvider |
|
||||
{ |
|
||||
public override void Define(IFeatureDefinitionContext context) |
|
||||
{ |
|
||||
var featureGroup = context.AddGroup( |
|
||||
name: AbpFileManagementFeatureNames.GroupName, |
|
||||
displayName: L("Features:FileManagement")); |
|
||||
|
|
||||
var fileSystemFeature = featureGroup.AddFeature( |
|
||||
name: AbpFileManagementFeatureNames.FileSystem.Default, |
|
||||
displayName: L("Features:DisplayName:FileSystem"), |
|
||||
description: L("Features:Description:FileSystem")); |
|
||||
|
|
||||
fileSystemFeature.CreateChild( |
|
||||
name: AbpFileManagementFeatureNames.FileSystem.DownloadFile, |
|
||||
defaultValue: false.ToString(), |
|
||||
displayName: L("Features:DisplayName:DownloadFile"), |
|
||||
description: L("Features:Description:DownloadFile"), |
|
||||
valueType: new ToggleStringValueType(new BooleanValueValidator())); |
|
||||
|
|
||||
fileSystemFeature.CreateChild( |
|
||||
name: AbpFileManagementFeatureNames.FileSystem.UploadFile, |
|
||||
defaultValue: true.ToString(), |
|
||||
displayName: L("Features:DisplayName:UploadFile"), |
|
||||
description: L("Features:Description:UploadFile"), |
|
||||
valueType: new ToggleStringValueType(new BooleanValueValidator())); |
|
||||
|
|
||||
// TODO: 此功能需要控制器协同,暂时不实现
|
|
||||
fileSystemFeature.CreateChild( |
|
||||
name: AbpFileManagementFeatureNames.FileSystem.MaxUploadFileCount, |
|
||||
defaultValue: 1.ToString(), |
|
||||
displayName: L("Features:DisplayName:MaxUploadFileCount"), |
|
||||
description: L("Features:Description:MaxUploadFileCount"), |
|
||||
valueType: new FreeTextStringValueType(new NumericValueValidator(1, 10))); |
|
||||
} |
|
||||
|
|
||||
protected ILocalizableString L(string name) |
|
||||
{ |
|
||||
return LocalizableString.Create<AbpFileManagementResource>(name); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,23 +0,0 @@ |
|||||
namespace LINGYUN.Abp.FileManagement.Features |
|
||||
{ |
|
||||
public class AbpFileManagementFeatureNames |
|
||||
{ |
|
||||
public const string GroupName = "Abp.FileManagement"; |
|
||||
public class FileSystem |
|
||||
{ |
|
||||
public const string Default = GroupName + ".FileSystem"; |
|
||||
/// <summary>
|
|
||||
/// 下载文件功能
|
|
||||
/// </summary>
|
|
||||
public const string DownloadFile = Default + ".DownloadFile"; |
|
||||
/// <summary>
|
|
||||
/// 上传文件功能
|
|
||||
/// </summary>
|
|
||||
public const string UploadFile = Default + ".UploadFile"; |
|
||||
/// <summary>
|
|
||||
/// 最大上传文件
|
|
||||
/// </summary>
|
|
||||
public const string MaxUploadFileCount = Default + ".MaxUploadFileCount"; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,34 +0,0 @@ |
|||||
using LINGYUN.Abp.FileManagement.Localization; |
|
||||
using Volo.Abp.Authorization.Permissions; |
|
||||
using Volo.Abp.Localization; |
|
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement.Permissions |
|
||||
{ |
|
||||
public class AbpFileManagementPermissionDefinitionProvider : PermissionDefinitionProvider |
|
||||
{ |
|
||||
public override void Define(IPermissionDefinitionContext context) |
|
||||
{ |
|
||||
var fileManagement = context.AddGroup(AbpFileManagementPermissions.GroupName, L("Permission:FileManagement")); |
|
||||
|
|
||||
var fileSystem = fileManagement.AddPermission(AbpFileManagementPermissions.FileSystem.Default, L("Permission:FileSystem")); |
|
||||
fileSystem.AddChild(AbpFileManagementPermissions.FileSystem.Create, L("Permission:CreateFolder")); |
|
||||
fileSystem.AddChild(AbpFileManagementPermissions.FileSystem.Delete, L("Permission:DeleteFolder")); |
|
||||
fileSystem.AddChild(AbpFileManagementPermissions.FileSystem.Update, L("Permission:UpdateFolder")); |
|
||||
fileSystem.AddChild(AbpFileManagementPermissions.FileSystem.Copy, L("Permission:CopyFolder")); |
|
||||
fileSystem.AddChild(AbpFileManagementPermissions.FileSystem.Move, L("Permission:MoveFolder")); |
|
||||
|
|
||||
var fileManager = fileSystem.AddChild(AbpFileManagementPermissions.FileSystem.FileManager.Default, L("Permission:FileManager")); |
|
||||
fileManager.AddChild(AbpFileManagementPermissions.FileSystem.FileManager.Create, L("Permission:AppendFile")); |
|
||||
fileManager.AddChild(AbpFileManagementPermissions.FileSystem.FileManager.Update, L("Permission:UpdateFile")); |
|
||||
fileManager.AddChild(AbpFileManagementPermissions.FileSystem.FileManager.Delete, L("Permission:DeleteFile")); |
|
||||
fileManager.AddChild(AbpFileManagementPermissions.FileSystem.FileManager.Copy, L("Permission:CopyFile")); |
|
||||
fileManager.AddChild(AbpFileManagementPermissions.FileSystem.FileManager.Move, L("Permission:MoveFile")); |
|
||||
fileManager.AddChild(AbpFileManagementPermissions.FileSystem.FileManager.Download, L("Permission:DownloadFile")); |
|
||||
} |
|
||||
|
|
||||
private static LocalizableString L(string name) |
|
||||
{ |
|
||||
return LocalizableString.Create<AbpFileManagementResource>(name); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,44 +0,0 @@ |
|||||
namespace LINGYUN.Abp.FileManagement.Permissions |
|
||||
{ |
|
||||
public class AbpFileManagementPermissions |
|
||||
{ |
|
||||
public const string GroupName = "AbpFileManagement"; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// 文件系统
|
|
||||
/// </summary>
|
|
||||
public class FileSystem |
|
||||
{ |
|
||||
public const string Default = GroupName + ".FileSystem"; |
|
||||
|
|
||||
public const string Create = Default + ".Create"; |
|
||||
|
|
||||
public const string Delete = Default + ".Delete"; |
|
||||
|
|
||||
public const string Update = Default + ".Update"; |
|
||||
|
|
||||
public const string Copy = Default + ".Copy"; |
|
||||
|
|
||||
public const string Move = Default + ".Move"; |
|
||||
/// <summary>
|
|
||||
/// 文件管理
|
|
||||
/// </summary>
|
|
||||
public class FileManager |
|
||||
{ |
|
||||
public const string Default = FileSystem.Default + ".FileManager"; |
|
||||
|
|
||||
public const string Create = Default + ".Create"; |
|
||||
|
|
||||
public const string Copy = Default + ".Copy"; |
|
||||
|
|
||||
public const string Delete = Default + ".Delete"; |
|
||||
|
|
||||
public const string Update = Default + ".Update"; |
|
||||
|
|
||||
public const string Move = Default + ".Move"; |
|
||||
|
|
||||
public const string Download = Default + ".Download"; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,23 +0,0 @@ |
|||||
using Volo.Abp.AutoMapper; |
|
||||
using Volo.Abp.Modularity; |
|
||||
using Microsoft.Extensions.DependencyInjection; |
|
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement |
|
||||
{ |
|
||||
[DependsOn( |
|
||||
typeof(AbpAutoMapperModule), |
|
||||
typeof(AbpFileManagementDomainModule), |
|
||||
typeof(AbpFileManagementApplicationContractsModule))] |
|
||||
public class AbpFileManagementApplicationModule : AbpModule |
|
||||
{ |
|
||||
public override void ConfigureServices(ServiceConfigurationContext context) |
|
||||
{ |
|
||||
context.Services.AddAutoMapperObjectMapper<AbpFileManagementApplicationModule>(); |
|
||||
|
|
||||
Configure<AbpAutoMapperOptions>(options => |
|
||||
{ |
|
||||
options.AddProfile<FileManagementApplicationAutoMapperProfile>(validate: true); |
|
||||
}); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,13 +0,0 @@ |
|||||
using LINGYUN.Abp.FileManagement.Localization; |
|
||||
using Volo.Abp.Application.Services; |
|
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement |
|
||||
{ |
|
||||
public class FileManagementApplicationServiceBase : ApplicationService |
|
||||
{ |
|
||||
protected FileManagementApplicationServiceBase() |
|
||||
{ |
|
||||
LocalizationResource = typeof(AbpFileManagementResource); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,9 +0,0 @@ |
|||||
using Volo.Abp.Localization; |
|
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement.Localization |
|
||||
{ |
|
||||
[LocalizationResourceName("AbpFileManagement")] |
|
||||
public class AbpFileManagementResource |
|
||||
{ |
|
||||
} |
|
||||
} |
|
||||
@ -1,9 +0,0 @@ |
|||||
using Volo.Abp.BlobStoring; |
|
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement |
|
||||
{ |
|
||||
[BlobContainerName("abp-file-management")] |
|
||||
public class AbpFileManagementContainer |
|
||||
{ |
|
||||
} |
|
||||
} |
|
||||
@ -1,15 +0,0 @@ |
|||||
using Volo.Abp.Domain; |
|
||||
using Volo.Abp.Modularity; |
|
||||
using Volo.Abp.MultiTenancy; |
|
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement |
|
||||
{ |
|
||||
[DependsOn( |
|
||||
typeof(AbpDddDomainModule), |
|
||||
typeof(AbpMultiTenancyModule), |
|
||||
typeof(AbpFileManagementDomainSharedModule) |
|
||||
)] |
|
||||
public class AbpFileManagementDomainModule : AbpModule |
|
||||
{ |
|
||||
} |
|
||||
} |
|
||||
@ -1,18 +0,0 @@ |
|||||
using System.Threading; |
|
||||
using Volo.Abp.BlobStoring; |
|
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement.FileSystem |
|
||||
{ |
|
||||
public class FileSystemOssProviderArgs : BlobProviderArgs |
|
||||
{ |
|
||||
public FileSystemOssProviderArgs( |
|
||||
string containerName, |
|
||||
BlobContainerConfiguration configuration, |
|
||||
string blobName, |
|
||||
CancellationToken cancellationToken = default) |
|
||||
: base(containerName, configuration, blobName, cancellationToken) |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,7 +1,7 @@ |
|||||
using LINGYUN.Abp.BlobStoring.Aliyun; |
using LINGYUN.Abp.BlobStoring.Aliyun; |
||||
using Volo.Abp.MultiTenancy; |
using Volo.Abp.MultiTenancy; |
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement.Aliyun |
namespace LINGYUN.Abp.OssManagement.Aliyun |
||||
{ |
{ |
||||
public class AliyunOssContainerFactory : IOssContainerFactory |
public class AliyunOssContainerFactory : IOssContainerFactory |
||||
{ |
{ |
||||
@ -0,0 +1,12 @@ |
|||||
|
using Volo.Abp.Application; |
||||
|
using Volo.Abp.Modularity; |
||||
|
|
||||
|
namespace LINGYUN.Abp.OssManagement |
||||
|
{ |
||||
|
[DependsOn( |
||||
|
typeof(AbpOssManagementDomainSharedModule), |
||||
|
typeof(AbpDddApplicationModule))] |
||||
|
public class AbpOssManagementApplicationContractsModule : AbpModule |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
@ -1,6 +1,6 @@ |
|||||
using System.ComponentModel.DataAnnotations; |
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement |
namespace LINGYUN.Abp.OssManagement |
||||
{ |
{ |
||||
public class BulkDeleteOssObjectInput |
public class BulkDeleteOssObjectInput |
||||
{ |
{ |
||||
@ -0,0 +1,73 @@ |
|||||
|
using LINGYUN.Abp.OssManagement.Localization; |
||||
|
using Volo.Abp.Features; |
||||
|
using Volo.Abp.Localization; |
||||
|
using Volo.Abp.Validation.StringValues; |
||||
|
|
||||
|
namespace LINGYUN.Abp.OssManagement.Features |
||||
|
{ |
||||
|
public class AbpOssManagementFeatureDefinitionProvider : FeatureDefinitionProvider |
||||
|
{ |
||||
|
public override void Define(IFeatureDefinitionContext context) |
||||
|
{ |
||||
|
var featureGroup = context.AddGroup( |
||||
|
name: AbpOssManagementFeatureNames.GroupName, |
||||
|
displayName: L("Features:OssManagement")); |
||||
|
|
||||
|
var ossFeature = featureGroup.AddFeature( |
||||
|
name: AbpOssManagementFeatureNames.OssObject.Default, |
||||
|
displayName: L("Features:DisplayName:OssObject"), |
||||
|
description: L("Features:Description:OssObject")); |
||||
|
|
||||
|
ossFeature.CreateChild( |
||||
|
name: AbpOssManagementFeatureNames.OssObject.DownloadFile, |
||||
|
defaultValue: false.ToString(), |
||||
|
displayName: L("Features:DisplayName:DownloadFile"), |
||||
|
description: L("Features:Description:DownloadFile"), |
||||
|
valueType: new ToggleStringValueType(new BooleanValueValidator())); |
||||
|
ossFeature.CreateChild( |
||||
|
name: AbpOssManagementFeatureNames.OssObject.DownloadLimit, |
||||
|
defaultValue: "1000", |
||||
|
displayName: L("Features:DisplayName:DownloadLimit"), |
||||
|
description: L("Features:Description:DownloadLimit"), |
||||
|
valueType: new FreeTextStringValueType(new NumericValueValidator(0, 100_0000))); // 上限100万次调用
|
||||
|
ossFeature.CreateChild( |
||||
|
name: AbpOssManagementFeatureNames.OssObject.DownloadInterval, |
||||
|
defaultValue: "1", |
||||
|
displayName: L("Features:DisplayName:DownloadInterval"), |
||||
|
description: L("Features:Description:DownloadInterval"), |
||||
|
valueType: new FreeTextStringValueType(new NumericValueValidator(1, 12))); // 上限12月
|
||||
|
|
||||
|
ossFeature.CreateChild( |
||||
|
name: AbpOssManagementFeatureNames.OssObject.UploadFile, |
||||
|
defaultValue: true.ToString(), |
||||
|
displayName: L("Features:DisplayName:UploadFile"), |
||||
|
description: L("Features:Description:UploadFile"), |
||||
|
valueType: new ToggleStringValueType(new BooleanValueValidator())); |
||||
|
ossFeature.CreateChild( |
||||
|
name: AbpOssManagementFeatureNames.OssObject.UploadLimit, |
||||
|
defaultValue: "1000", |
||||
|
displayName: L("Features:DisplayName:UploadLimit"), |
||||
|
description: L("Features:Description:UploadLimit"), |
||||
|
valueType: new FreeTextStringValueType(new NumericValueValidator(0, 100_0000))); // 上限100万次调用
|
||||
|
ossFeature.CreateChild( |
||||
|
name: AbpOssManagementFeatureNames.OssObject.UploadInterval, |
||||
|
defaultValue: "1", |
||||
|
displayName: L("Features:DisplayName:UploadInterval"), |
||||
|
description: L("Features:Description:UploadInterval"), |
||||
|
valueType: new FreeTextStringValueType(new NumericValueValidator(1, 12))); // 上限12月
|
||||
|
|
||||
|
// TODO: 此功能需要控制器协同,暂时不实现
|
||||
|
//fileSystemFeature.CreateChild(
|
||||
|
// name: AbpOssManagementFeatureNames.OssObject.MaxUploadFileCount,
|
||||
|
// defaultValue: 1.ToString(),
|
||||
|
// displayName: L("Features:DisplayName:MaxUploadFileCount"),
|
||||
|
// description: L("Features:Description:MaxUploadFileCount"),
|
||||
|
// valueType: new FreeTextStringValueType(new NumericValueValidator(1, 10)));
|
||||
|
} |
||||
|
|
||||
|
protected ILocalizableString L(string name) |
||||
|
{ |
||||
|
return LocalizableString.Create<AbpOssManagementResource>(name); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,41 @@ |
|||||
|
namespace LINGYUN.Abp.OssManagement.Features |
||||
|
{ |
||||
|
public class AbpOssManagementFeatureNames |
||||
|
{ |
||||
|
public const string GroupName = "AbpOssManagement"; |
||||
|
|
||||
|
|
||||
|
public class OssObject |
||||
|
{ |
||||
|
public const string Default = GroupName + ".OssObject"; |
||||
|
/// <summary>
|
||||
|
/// 下载文件功能
|
||||
|
/// </summary>
|
||||
|
public const string DownloadFile = Default + ".DownloadFile"; |
||||
|
/// <summary>
|
||||
|
/// 下载文件功能限制次数
|
||||
|
/// </summary>
|
||||
|
public const string DownloadLimit = Default + ".DownloadLimit"; |
||||
|
/// <summary>
|
||||
|
/// 下载文件功能限制次数周期
|
||||
|
/// </summary>
|
||||
|
public const string DownloadInterval = Default + ".DownloadInterval"; |
||||
|
/// <summary>
|
||||
|
/// 上传文件功能
|
||||
|
/// </summary>
|
||||
|
public const string UploadFile = Default + ".UploadFile"; |
||||
|
/// <summary>
|
||||
|
/// 上传文件功能限制次数
|
||||
|
/// </summary>
|
||||
|
public const string UploadLimit = Default + ".UploadLimit"; |
||||
|
/// <summary>
|
||||
|
/// 上传文件功能限制次数周期
|
||||
|
/// </summary>
|
||||
|
public const string UploadInterval = Default + ".UploadInterval"; |
||||
|
/// <summary>
|
||||
|
/// 最大上传文件
|
||||
|
/// </summary>
|
||||
|
public const string MaxUploadFileCount = Default + ".MaxUploadFileCount"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,6 +1,6 @@ |
|||||
using Volo.Abp.Application.Dtos; |
using Volo.Abp.Application.Dtos; |
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement |
namespace LINGYUN.Abp.OssManagement |
||||
{ |
{ |
||||
public class GetOssContainersInput : PagedAndSortedResultRequestDto |
public class GetOssContainersInput : PagedAndSortedResultRequestDto |
||||
{ |
{ |
||||
@ -1,6 +1,6 @@ |
|||||
using System.ComponentModel.DataAnnotations; |
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement |
namespace LINGYUN.Abp.OssManagement |
||||
{ |
{ |
||||
public class GetOssObjectInput |
public class GetOssObjectInput |
||||
{ |
{ |
||||
@ -1,6 +1,6 @@ |
|||||
using Volo.Abp.Application.Dtos; |
using Volo.Abp.Application.Dtos; |
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement |
namespace LINGYUN.Abp.OssManagement |
||||
{ |
{ |
||||
public class GetOssObjectsInput : PagedAndSortedResultRequestDto |
public class GetOssObjectsInput : PagedAndSortedResultRequestDto |
||||
{ |
{ |
||||
@ -1,6 +1,6 @@ |
|||||
using System.ComponentModel.DataAnnotations; |
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement |
namespace LINGYUN.Abp.OssManagement |
||||
{ |
{ |
||||
public class GetStaticFileInput |
public class GetStaticFileInput |
||||
{ |
{ |
||||
@ -1,7 +1,7 @@ |
|||||
using System.Threading.Tasks; |
using System.Threading.Tasks; |
||||
using Volo.Abp.Application.Services; |
using Volo.Abp.Application.Services; |
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement |
namespace LINGYUN.Abp.OssManagement |
||||
{ |
{ |
||||
public interface IOssContainerAppService: IApplicationService |
public interface IOssContainerAppService: IApplicationService |
||||
{ |
{ |
||||
@ -1,7 +1,7 @@ |
|||||
using System.Threading.Tasks; |
using System.Threading.Tasks; |
||||
using Volo.Abp.Application.Services; |
using Volo.Abp.Application.Services; |
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement |
namespace LINGYUN.Abp.OssManagement |
||||
{ |
{ |
||||
public interface IOssObjectAppService : IApplicationService |
public interface IOssObjectAppService : IApplicationService |
||||
{ |
{ |
||||
@ -1,7 +1,7 @@ |
|||||
using System; |
using System; |
||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement |
namespace LINGYUN.Abp.OssManagement |
||||
{ |
{ |
||||
public class OssContainerDto |
public class OssContainerDto |
||||
{ |
{ |
||||
@ -1,6 +1,6 @@ |
|||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement |
namespace LINGYUN.Abp.OssManagement |
||||
{ |
{ |
||||
public class OssContainersResultDto |
public class OssContainersResultDto |
||||
{ |
{ |
||||
@ -0,0 +1,7 @@ |
|||||
|
namespace LINGYUN.Abp.OssManagement |
||||
|
{ |
||||
|
public static class OssManagementRemoteServiceConsts |
||||
|
{ |
||||
|
public const string RemoteServiceName = "AbpOssManagement"; |
||||
|
} |
||||
|
} |
||||
@ -1,7 +1,7 @@ |
|||||
using System; |
using System; |
||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement |
namespace LINGYUN.Abp.OssManagement |
||||
{ |
{ |
||||
public class OssObjectDto |
public class OssObjectDto |
||||
{ |
{ |
||||
@ -1,6 +1,6 @@ |
|||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement |
namespace LINGYUN.Abp.OssManagement |
||||
{ |
{ |
||||
public class OssObjectsResultDto |
public class OssObjectsResultDto |
||||
{ |
{ |
||||
@ -0,0 +1,27 @@ |
|||||
|
using LINGYUN.Abp.OssManagement.Localization; |
||||
|
using Volo.Abp.Authorization.Permissions; |
||||
|
using Volo.Abp.Localization; |
||||
|
|
||||
|
namespace LINGYUN.Abp.OssManagement.Permissions |
||||
|
{ |
||||
|
public class AbpOssManagementPermissionDefinitionProvider : PermissionDefinitionProvider |
||||
|
{ |
||||
|
public override void Define(IPermissionDefinitionContext context) |
||||
|
{ |
||||
|
var ossManagement = context.AddGroup(AbpOssManagementPermissions.GroupName, L("Permission:OssManagement")); |
||||
|
|
||||
|
var container = ossManagement.AddPermission(AbpOssManagementPermissions.Container.Default, L("Permission:Container")); |
||||
|
container.AddChild(AbpOssManagementPermissions.Container.Create, L("Permission:Create")); |
||||
|
container.AddChild(AbpOssManagementPermissions.Container.Delete, L("Permission:Delete")); |
||||
|
|
||||
|
var ossobject = ossManagement.AddPermission(AbpOssManagementPermissions.OssObject.Default, L("Permission:OssObject")); |
||||
|
ossobject.AddChild(AbpOssManagementPermissions.OssObject.Create, L("Permission:Create")); |
||||
|
ossobject.AddChild(AbpOssManagementPermissions.OssObject.Delete, L("Permission:Delete")); |
||||
|
} |
||||
|
|
||||
|
private static LocalizableString L(string name) |
||||
|
{ |
||||
|
return LocalizableString.Create<AbpOssManagementResource>(name); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,27 @@ |
|||||
|
namespace LINGYUN.Abp.OssManagement.Permissions |
||||
|
{ |
||||
|
public class AbpOssManagementPermissions |
||||
|
{ |
||||
|
public const string GroupName = "AbpOssManagement"; |
||||
|
|
||||
|
public class Container |
||||
|
{ |
||||
|
public const string Default = GroupName + ".Container"; |
||||
|
|
||||
|
public const string Create = Default + ".Create"; |
||||
|
|
||||
|
public const string Delete = Default + ".Delete"; |
||||
|
} |
||||
|
|
||||
|
public class OssObject |
||||
|
{ |
||||
|
public const string Default = GroupName + ".OssObject"; |
||||
|
|
||||
|
public const string Create = Default + ".Create"; |
||||
|
|
||||
|
public const string Delete = Default + ".Delete"; |
||||
|
|
||||
|
public const string Download = Default + ".Download"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
using Volo.Abp.AutoMapper; |
||||
|
using Volo.Abp.Modularity; |
||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
|
||||
|
namespace LINGYUN.Abp.OssManagement |
||||
|
{ |
||||
|
[DependsOn( |
||||
|
typeof(AbpAutoMapperModule), |
||||
|
typeof(AbpOssManagementDomainModule), |
||||
|
typeof(AbpOssManagementApplicationContractsModule))] |
||||
|
public class AbpOssManagementApplicationModule : AbpModule |
||||
|
{ |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
context.Services.AddAutoMapperObjectMapper<AbpOssManagementApplicationModule>(); |
||||
|
|
||||
|
Configure<AbpAutoMapperOptions>(options => |
||||
|
{ |
||||
|
options.AddProfile<OssManagementApplicationAutoMapperProfile>(validate: true); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,10 +1,10 @@ |
|||||
using AutoMapper; |
using AutoMapper; |
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement |
namespace LINGYUN.Abp.OssManagement |
||||
{ |
{ |
||||
public class FileManagementApplicationAutoMapperProfile : Profile |
public class OssManagementApplicationAutoMapperProfile : Profile |
||||
{ |
{ |
||||
public FileManagementApplicationAutoMapperProfile() |
public OssManagementApplicationAutoMapperProfile() |
||||
{ |
{ |
||||
CreateMap<OssContainer, OssContainerDto>(); |
CreateMap<OssContainer, OssContainerDto>(); |
||||
CreateMap<OssObject, OssObjectDto>() |
CreateMap<OssObject, OssObjectDto>() |
||||
@ -0,0 +1,14 @@ |
|||||
|
using LINGYUN.Abp.OssManagement.Localization; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
|
||||
|
namespace LINGYUN.Abp.OssManagement |
||||
|
{ |
||||
|
public class OssManagementApplicationServiceBase : ApplicationService |
||||
|
{ |
||||
|
protected OssManagementApplicationServiceBase() |
||||
|
{ |
||||
|
LocalizationResource = typeof(AbpOssManagementResource); |
||||
|
ObjectMapperContext = typeof(AbpOssManagementApplicationModule); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
using Volo.Abp.Localization; |
||||
|
|
||||
|
namespace LINGYUN.Abp.OssManagement.Localization |
||||
|
{ |
||||
|
[LocalizationResourceName("AbpOssManagement")] |
||||
|
public class AbpOssManagementResource |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
@ -1,8 +1,8 @@ |
|||||
namespace LINGYUN.Abp.FileManagement |
namespace LINGYUN.Abp.OssManagement |
||||
{ |
{ |
||||
public static class FileManagementErrorCodes |
public static class OssManagementErrorCodes |
||||
{ |
{ |
||||
public const string Namespace = "Abp.FileManagement"; |
public const string Namespace = "Abp.OssManagement"; |
||||
|
|
||||
public const string ContainerDeleteWithNotEmpty = Namespace + ":010001"; |
public const string ContainerDeleteWithNotEmpty = Namespace + ":010001"; |
||||
public const string ContainerAlreadyExists = Namespace + ":010402"; |
public const string ContainerAlreadyExists = Namespace + ":010402"; |
||||
16
aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Domain.Shared/LINGYUN/Abp/FileManagement/Settings/AbpFileManagementSettingDefinitionProvider.cs → aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Domain.Shared/LINGYUN/Abp/OssManagement/Settings/AbpOssManagementSettingDefinitionProvider.cs
16
aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.Domain.Shared/LINGYUN/Abp/FileManagement/Settings/AbpFileManagementSettingDefinitionProvider.cs → aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Domain.Shared/LINGYUN/Abp/OssManagement/Settings/AbpOssManagementSettingDefinitionProvider.cs
@ -1,8 +1,8 @@ |
|||||
namespace LINGYUN.Abp.FileManagement.Settings |
namespace LINGYUN.Abp.OssManagement.Settings |
||||
{ |
{ |
||||
public class AbpFileManagementSettingNames |
public class AbpOssManagementSettingNames |
||||
{ |
{ |
||||
public const string GroupName = "Abp.FileManagement"; |
public const string GroupName = "Abp.OssManagement"; |
||||
/// <summary>
|
/// <summary>
|
||||
/// 下载分包大小
|
/// 下载分包大小
|
||||
/// </summary>
|
/// </summary>
|
||||
@ -0,0 +1,9 @@ |
|||||
|
using Volo.Abp.BlobStoring; |
||||
|
|
||||
|
namespace LINGYUN.Abp.OssManagement |
||||
|
{ |
||||
|
[BlobContainerName("abp-oss-management")] |
||||
|
public class AbpOssManagementContainer |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
using LINGYUN.Abp.Features.LimitValidation; |
||||
|
using Volo.Abp.Domain; |
||||
|
using Volo.Abp.Modularity; |
||||
|
using Volo.Abp.MultiTenancy; |
||||
|
|
||||
|
namespace LINGYUN.Abp.OssManagement |
||||
|
{ |
||||
|
[DependsOn( |
||||
|
typeof(AbpDddDomainModule), |
||||
|
typeof(AbpMultiTenancyModule), |
||||
|
typeof(AbpFeaturesLimitValidationModule), |
||||
|
typeof(AbpOssManagementDomainSharedModule) |
||||
|
)] |
||||
|
public class AbpOssManagementDomainModule : AbpModule |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
@ -1,4 +1,4 @@ |
|||||
namespace LINGYUN.Abp.FileManagement |
namespace LINGYUN.Abp.OssManagement |
||||
{ |
{ |
||||
public class GetOssContainersRequest |
public class GetOssContainersRequest |
||||
{ |
{ |
||||
@ -1,6 +1,6 @@ |
|||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement |
namespace LINGYUN.Abp.OssManagement |
||||
{ |
{ |
||||
public class GetOssContainersResponse |
public class GetOssContainersResponse |
||||
{ |
{ |
||||
@ -1,7 +1,7 @@ |
|||||
using JetBrains.Annotations; |
using JetBrains.Annotations; |
||||
using Volo.Abp; |
using Volo.Abp; |
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement |
namespace LINGYUN.Abp.OssManagement |
||||
{ |
{ |
||||
public class GetOssObjectRequest |
public class GetOssObjectRequest |
||||
{ |
{ |
||||
@ -1,7 +1,7 @@ |
|||||
using JetBrains.Annotations; |
using JetBrains.Annotations; |
||||
using Volo.Abp; |
using Volo.Abp; |
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement |
namespace LINGYUN.Abp.OssManagement |
||||
{ |
{ |
||||
public class GetOssObjectsRequest |
public class GetOssObjectsRequest |
||||
{ |
{ |
||||
@ -1,6 +1,6 @@ |
|||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement |
namespace LINGYUN.Abp.OssManagement |
||||
{ |
{ |
||||
public class GetOssObjectsResponse |
public class GetOssObjectsResponse |
||||
{ |
{ |
||||
@ -1,6 +1,6 @@ |
|||||
using System.Threading.Tasks; |
using System.Threading.Tasks; |
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement |
namespace LINGYUN.Abp.OssManagement |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Oss容器
|
/// Oss容器
|
||||
@ -1,7 +1,7 @@ |
|||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||
using System.Threading.Tasks; |
using System.Threading.Tasks; |
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement |
namespace LINGYUN.Abp.OssManagement |
||||
{ |
{ |
||||
public static class IOssContainerExtensions |
public static class IOssContainerExtensions |
||||
{ |
{ |
||||
@ -1,4 +1,4 @@ |
|||||
namespace LINGYUN.Abp.FileManagement |
namespace LINGYUN.Abp.OssManagement |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// Oss容器构建工厂
|
/// Oss容器构建工厂
|
||||
@ -1,7 +1,7 @@ |
|||||
using System; |
using System; |
||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement |
namespace LINGYUN.Abp.OssManagement |
||||
{ |
{ |
||||
/// <summary>
|
/// <summary>
|
||||
/// 描述了一个容器的状态信息
|
/// 描述了一个容器的状态信息
|
||||
@ -1,6 +1,6 @@ |
|||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement |
namespace LINGYUN.Abp.OssManagement |
||||
{ |
{ |
||||
public class OssObjectComparer : IComparer<OssObject> |
public class OssObjectComparer : IComparer<OssObject> |
||||
{ |
{ |
||||
6
aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.FileSystem.ImageSharp/LINGYUN/Abp/FileManagement/FileSystem/ImageSharp/AbpFileManagementFileSystemImageSharpModule.cs → aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.FileSystem.ImageSharp/LINGYUN/Abp/OssManagement/FileSystem/ImageSharp/AbpOssManagementFileSystemImageSharpModule.cs
6
aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.FileSystem.ImageSharp/LINGYUN/Abp/FileManagement/FileSystem/ImageSharp/AbpFileManagementFileSystemImageSharpModule.cs → aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.FileSystem.ImageSharp/LINGYUN/Abp/OssManagement/FileSystem/ImageSharp/AbpOssManagementFileSystemImageSharpModule.cs
@ -1,9 +1,9 @@ |
|||||
using Volo.Abp.Modularity; |
using Volo.Abp.Modularity; |
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement.FileSystem.ImageSharp |
namespace LINGYUN.Abp.OssManagement.FileSystem.ImageSharp |
||||
{ |
{ |
||||
[DependsOn(typeof(AbpFileManagementFileSystemModule))] |
[DependsOn(typeof(AbpOssManagementFileSystemModule))] |
||||
public class AbpFileManagementFileSystemImageSharpModule : AbpModule |
public class AbpOssManagementFileSystemImageSharpModule : AbpModule |
||||
{ |
{ |
||||
public override void ConfigureServices(ServiceConfigurationContext context) |
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
{ |
{ |
||||
2
aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.FileSystem.ImageSharp/LINGYUN/Abp/FileManagement/FileSystem/ImageSharp/ImageSharpFileSystemOssObjectProcesser.cs → aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.FileSystem.ImageSharp/LINGYUN/Abp/OssManagement/FileSystem/ImageSharp/ImageSharpFileSystemOssObjectProcesser.cs
2
aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.FileSystem.ImageSharp/LINGYUN/Abp/FileManagement/FileSystem/ImageSharp/ImageSharpFileSystemOssObjectProcesser.cs → aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.FileSystem.ImageSharp/LINGYUN/Abp/OssManagement/FileSystem/ImageSharp/ImageSharpFileSystemOssObjectProcesser.cs
@ -1,7 +1,7 @@ |
|||||
using JetBrains.Annotations; |
using JetBrains.Annotations; |
||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement.FileSystem |
namespace LINGYUN.Abp.OssManagement.FileSystem |
||||
{ |
{ |
||||
public class FileSystemOssOptions |
public class FileSystemOssOptions |
||||
{ |
{ |
||||
@ -1,6 +1,6 @@ |
|||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement.FileSystem |
namespace LINGYUN.Abp.OssManagement.FileSystem |
||||
{ |
{ |
||||
public static class FileSystemOssOptionsExtensions |
public static class FileSystemOssOptionsExtensions |
||||
{ |
{ |
||||
5
aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.FileSystem/LINGYUN/Abp/FileManagement/FileSystem/IFileSystemOssObjectProcesserContributor.cs → aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.FileSystem/LINGYUN/Abp/OssManagement/FileSystem/IFileSystemOssObjectProcesserContributor.cs
5
aspnet-core/modules/file-management/LINGYUN.Abp.FileManagement.FileSystem/LINGYUN/Abp/FileManagement/FileSystem/IFileSystemOssObjectProcesserContributor.cs → aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.FileSystem/LINGYUN/Abp/OssManagement/FileSystem/IFileSystemOssObjectProcesserContributor.cs
@ -1,7 +1,6 @@ |
|||||
using System.IO; |
using System.Threading.Tasks; |
||||
using System.Threading.Tasks; |
|
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement.FileSystem |
namespace LINGYUN.Abp.OssManagement.FileSystem |
||||
{ |
{ |
||||
public interface IFileSystemOssObjectProcesserContributor |
public interface IFileSystemOssObjectProcesserContributor |
||||
{ |
{ |
||||
@ -1,7 +1,6 @@ |
|||||
using System.IO; |
using System.Threading.Tasks; |
||||
using System.Threading.Tasks; |
|
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement.FileSystem |
namespace LINGYUN.Abp.OssManagement.FileSystem |
||||
{ |
{ |
||||
public class NoneFileSystemOssObjectProcesser : IFileSystemOssObjectProcesserContributor |
public class NoneFileSystemOssObjectProcesser : IFileSystemOssObjectProcesserContributor |
||||
{ |
{ |
||||
@ -1,6 +1,6 @@ |
|||||
using System.Threading.Tasks; |
using System.Threading.Tasks; |
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement |
namespace LINGYUN.Abp.OssManagement |
||||
{ |
{ |
||||
public interface IFileValidater |
public interface IFileValidater |
||||
{ |
{ |
||||
@ -1,14 +1,13 @@ |
|||||
using Microsoft.AspNetCore.Mvc; |
using Microsoft.AspNetCore.Mvc; |
||||
using System.Threading.Tasks; |
using System.Threading.Tasks; |
||||
using Volo.Abp; |
using Volo.Abp; |
||||
using Volo.Abp.Application.Dtos; |
|
||||
using Volo.Abp.AspNetCore.Mvc; |
using Volo.Abp.AspNetCore.Mvc; |
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement |
namespace LINGYUN.Abp.OssManagement |
||||
{ |
{ |
||||
[RemoteService(Name = "AbpFileManagement")] |
[RemoteService(Name = OssManagementRemoteServiceConsts.RemoteServiceName)] |
||||
[Area("file-management")] |
[Area("oss-management")] |
||||
[Route("api/file-management/containes")] |
[Route("api/oss-management/containes")] |
||||
public class OssContainerController : AbpController, IOssContainerAppService |
public class OssContainerController : AbpController, IOssContainerAppService |
||||
{ |
{ |
||||
protected IOssContainerAppService OssContainerAppService { get; } |
protected IOssContainerAppService OssContainerAppService { get; } |
||||
@ -1,7 +1,7 @@ |
|||||
using Microsoft.AspNetCore.Http; |
using Microsoft.AspNetCore.Http; |
||||
using System.ComponentModel.DataAnnotations; |
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
namespace LINGYUN.Abp.FileManagement |
namespace LINGYUN.Abp.OssManagement |
||||
{ |
{ |
||||
public class UploadOssObjectInput |
public class UploadOssObjectInput |
||||
{ |
{ |
||||
@ -0,0 +1,20 @@ |
|||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Volo.Abp.AspNetCore.Mvc; |
||||
|
using Volo.Abp.Modularity; |
||||
|
|
||||
|
namespace LINGYUN.Abp.OssManagement.SettingManagement |
||||
|
{ |
||||
|
[DependsOn( |
||||
|
typeof(AbpOssManagementApplicationContractsModule), |
||||
|
typeof(AbpAspNetCoreMvcModule))] |
||||
|
public class AbpOssManagementSettingManagementModule : AbpModule |
||||
|
{ |
||||
|
public override void PreConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
PreConfigure<IMvcBuilder>(mvcBuilder => |
||||
|
{ |
||||
|
mvcBuilder.AddApplicationPartIfNotExists(typeof(AbpOssManagementSettingManagementModule).Assembly); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,18 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<TargetFramework>net5.0</TargetFramework> |
||||
|
<RootNamespace /> |
||||
|
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="4.2.1" /> |
||||
|
<PackageReference Include="Volo.Abp.SettingManagement.Domain" Version="4.2.1" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\..\settings\LINGYUN.Abp.SettingManagement.Application.Contracts\LINGYUN.Abp.SettingManagement.Application.Contracts.csproj" /> |
||||
|
<ProjectReference Include="..\LINGYUN.Abp.OssManagement.Application.Contracts\LINGYUN.Abp.OssManagement.Application.Contracts.csproj" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
</Project> |
||||
@ -0,0 +1,13 @@ |
|||||
|
using LINGYUN.Abp.SettingManagement; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
|
||||
|
namespace LINGYUN.Abp.OssManagement.SettingManagement |
||||
|
{ |
||||
|
public interface IOssManagementSettingAppService |
||||
|
{ |
||||
|
Task<ListResultDto<SettingGroupDto>> GetAllForGlobalAsync(); |
||||
|
|
||||
|
Task<ListResultDto<SettingGroupDto>> GetAllForCurrentTenantAsync(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,73 @@ |
|||||
|
using LINGYUN.Abp.OssManagement.Localization; |
||||
|
using LINGYUN.Abp.OssManagement.Permissions; |
||||
|
using LINGYUN.Abp.OssManagement.Settings; |
||||
|
using LINGYUN.Abp.SettingManagement; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
using Volo.Abp.Authorization.Permissions; |
||||
|
using Volo.Abp.MultiTenancy; |
||||
|
using Volo.Abp.SettingManagement; |
||||
|
using Volo.Abp.Settings; |
||||
|
using ValueType = LINGYUN.Abp.SettingManagement.ValueType; |
||||
|
|
||||
|
namespace LINGYUN.Abp.OssManagement.SettingManagement |
||||
|
{ |
||||
|
public class OssManagementSettingAppService : ApplicationService, IOssManagementSettingAppService |
||||
|
{ |
||||
|
protected ISettingManager SettingManager { get; } |
||||
|
protected IPermissionChecker PermissionChecker { get; } |
||||
|
protected ISettingDefinitionManager SettingDefinitionManager { get; } |
||||
|
|
||||
|
public OssManagementSettingAppService( |
||||
|
ISettingManager settingManager, |
||||
|
IPermissionChecker permissionChecker, |
||||
|
ISettingDefinitionManager settingDefinitionManager) |
||||
|
{ |
||||
|
SettingManager = settingManager; |
||||
|
PermissionChecker = permissionChecker; |
||||
|
SettingDefinitionManager = settingDefinitionManager; |
||||
|
LocalizationResource = typeof(AbpOssManagementResource); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<ListResultDto<SettingGroupDto>> GetAllForCurrentTenantAsync() |
||||
|
{ |
||||
|
return await GetAllForProviderAsync(TenantSettingValueProvider.ProviderName, CurrentTenant.GetId().ToString()); |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<ListResultDto<SettingGroupDto>> GetAllForGlobalAsync() |
||||
|
{ |
||||
|
return await GetAllForProviderAsync(GlobalSettingValueProvider.ProviderName, null); |
||||
|
} |
||||
|
|
||||
|
protected virtual async Task<ListResultDto<SettingGroupDto>> GetAllForProviderAsync(string providerName, string providerKey) |
||||
|
{ |
||||
|
var settingGroups = new List<SettingGroupDto>(); |
||||
|
|
||||
|
// 无权限返回空结果,直接报错的话,网关聚合会抛出异常
|
||||
|
if (await PermissionChecker.IsGrantedAsync(AbpOssManagementPermissions.OssObject.Default)) |
||||
|
{ |
||||
|
|
||||
|
var ossSettingGroup = new SettingGroupDto(L["DisplayName:OssManagement"], L["Description:OssManagement"]); |
||||
|
|
||||
|
var ossObjectSetting = ossSettingGroup.AddSetting(L["DisplayName:OssObject"], L["Description:OssObject"]); |
||||
|
|
||||
|
ossObjectSetting.AddDetail( |
||||
|
SettingDefinitionManager.Get(AbpOssManagementSettingNames.FileLimitLength), |
||||
|
StringLocalizerFactory, |
||||
|
await SettingManager.GetOrNullAsync(AbpOssManagementSettingNames.FileLimitLength, providerName, providerKey), |
||||
|
ValueType.Number); |
||||
|
ossObjectSetting.AddDetail( |
||||
|
SettingDefinitionManager.Get(AbpOssManagementSettingNames.AllowFileExtensions), |
||||
|
StringLocalizerFactory, |
||||
|
await SettingManager.GetOrNullAsync(AbpOssManagementSettingNames.AllowFileExtensions, providerName, providerKey), |
||||
|
ValueType.String); |
||||
|
|
||||
|
settingGroups.Add(ossSettingGroup); |
||||
|
} |
||||
|
|
||||
|
return new ListResultDto<SettingGroupDto>(settingGroups); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue