committed by
GitHub
108 changed files with 18452 additions and 1559 deletions
@ -0,0 +1,20 @@ |
|||
using System; |
|||
using Volo.Abp.EventBus; |
|||
|
|||
namespace LINGYUN.Abp.DataProtection; |
|||
|
|||
[Serializable] |
|||
[EventName("abp.data_protection.resource_changed")] |
|||
public class DataAccessResourceChangeEvent |
|||
{ |
|||
public DataAccessResource Resource { get; set; } |
|||
public DataAccessResourceChangeEvent() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public DataAccessResourceChangeEvent(DataAccessResource resource) |
|||
{ |
|||
Resource = resource; |
|||
} |
|||
} |
|||
@ -1,6 +1,10 @@ |
|||
{ |
|||
"culture": "en", |
|||
"texts": { |
|||
"DataProtection:010001": "Data access permission not granted to protected resources!" |
|||
"DataProtection:010001": "Data access permission not granted to protected resources!", |
|||
"DisplayName:LastModifierId": "Last Modifier Id", |
|||
"DisplayName:LastModificationTime": "Last Modification Time", |
|||
"DisplayName:CreatorId": "Creator Id", |
|||
"DisplayName:CreationTime": "Creation Time" |
|||
} |
|||
} |
|||
@ -1,6 +1,10 @@ |
|||
{ |
|||
"culture": "zh-Hans", |
|||
"texts": { |
|||
"DataProtection:010001": "未授予受保护资源的数据访问权限!" |
|||
"DataProtection:010001": "未授予受保护资源的数据访问权限!", |
|||
"DisplayName:LastModifierId": "上次修改人", |
|||
"DisplayName:LastModificationTime": "上次修改时间", |
|||
"DisplayName:CreatorId": "创建人", |
|||
"DisplayName:CreationTime": "创建时间" |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
namespace LINGYUN.Abp.DataProtection.Models; |
|||
|
|||
public class EntityEnumInfoModel |
|||
{ |
|||
public string Key { get; set; } |
|||
public object Value { get; set; } |
|||
} |
|||
@ -0,0 +1,33 @@ |
|||
namespace LINGYUN.Abp.DataProtection.Models; |
|||
|
|||
public class EntityPropertyInfoModel |
|||
{ |
|||
/// <summary>
|
|||
/// 名称
|
|||
/// </summary>
|
|||
public string Name { get; set; } |
|||
/// <summary>
|
|||
/// 显示名称
|
|||
/// </summary>
|
|||
public string DisplayName { get; set; } |
|||
/// <summary>
|
|||
/// 类型全名
|
|||
/// </summary>
|
|||
public string TypeFullName { get; set; } |
|||
/// <summary>
|
|||
/// JavaScript类型
|
|||
/// </summary>
|
|||
public string JavaScriptType { get; set; } |
|||
/// <summary>
|
|||
/// JavaScript名称
|
|||
/// </summary>
|
|||
public string JavaScriptName { get; set; } |
|||
/// <summary>
|
|||
/// 枚举列表
|
|||
/// </summary>
|
|||
public EntityEnumInfoModel[] Enums { get; set; } |
|||
/// <summary>
|
|||
/// 允许的过滤操作列表
|
|||
/// </summary>
|
|||
public DataAccessFilterOperate[] Operates { get; set; } |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
using System.ComponentModel.DataAnnotations; |
|||
|
|||
namespace LINGYUN.Abp.DataProtection.Models; |
|||
|
|||
public class EntityTypeInfoGetModel |
|||
{ |
|||
[Required] |
|||
public DataAccessOperation Operation { get; set; } |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
using System.Collections.Generic; |
|||
|
|||
namespace LINGYUN.Abp.DataProtection.Models; |
|||
|
|||
public class EntityTypeInfoModel |
|||
{ |
|||
/// <summary>
|
|||
/// 实体名称
|
|||
/// </summary>
|
|||
public string Name { get; set; } |
|||
/// <summary>
|
|||
/// 显示名称
|
|||
/// </summary>
|
|||
public string DisplayName { get; set; } |
|||
/// <summary>
|
|||
/// 可访问属性列表
|
|||
/// </summary>
|
|||
public List<EntityPropertyInfoModel> Properties { get; set; } = new List<EntityPropertyInfoModel>(); |
|||
} |
|||
@ -0,0 +1,3 @@ |
|||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
|||
<ConfigureAwait ContinueOnCapturedContext="false" /> |
|||
</Weavers> |
|||
@ -0,0 +1,24 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\..\configureawait.props" /> |
|||
<Import Project="..\..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0;net9.0</TargetFrameworks> |
|||
<AssemblyName>LINGYUN.Abp.DataProtection.Application.Contracts</AssemblyName> |
|||
<PackageId>LINGYUN.Abp.DataProtection.Application.Contracts</PackageId> |
|||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> |
|||
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> |
|||
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> |
|||
<RootNamespace /> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.Ddd.Application.Contracts" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\LINGYUN.Abp.DataProtection.Abstractions\LINGYUN.Abp.DataProtection.Abstractions.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,12 @@ |
|||
using Volo.Abp.Application; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace LINGYUN.Abp.DataProtection; |
|||
|
|||
[DependsOn( |
|||
typeof(AbpDataProtectionAbstractionsModule), |
|||
typeof(AbpDddApplicationContractsModule))] |
|||
public class AbpDataProtectionApplicationContractsModule : AbpModule |
|||
{ |
|||
|
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
namespace LINGYUN.Abp.DataProtection; |
|||
|
|||
public class EntityEnumInfoDto |
|||
{ |
|||
public string Key { get; set; } |
|||
public object Value { get; set; } |
|||
} |
|||
@ -0,0 +1,29 @@ |
|||
namespace LINGYUN.Abp.DataProtection; |
|||
|
|||
public class EntityPropertyInfoDto |
|||
{ |
|||
/// <summary>
|
|||
/// 名称
|
|||
/// </summary>
|
|||
public string Name { get; set; } |
|||
/// <summary>
|
|||
/// 显示名称
|
|||
/// </summary>
|
|||
public string DisplayName { get; set; } |
|||
/// <summary>
|
|||
/// 类型全名
|
|||
/// </summary>
|
|||
public string TypeFullName { get; set; } |
|||
/// <summary>
|
|||
/// JavaScript类型
|
|||
/// </summary>
|
|||
public string JavaScriptType { get; set; } |
|||
/// <summary>
|
|||
/// 枚举列表
|
|||
/// </summary>
|
|||
public EntityEnumInfoDto[] Enums { get; set; } = new EntityEnumInfoDto[0]; |
|||
/// <summary>
|
|||
/// 允许的过滤操作列表
|
|||
/// </summary>
|
|||
public DataAccessFilterOperate[] Operates { get; set; } |
|||
} |
|||
@ -0,0 +1,17 @@ |
|||
namespace LINGYUN.Abp.DataProtection; |
|||
|
|||
public class EntityTypeInfoDto |
|||
{ |
|||
/// <summary>
|
|||
/// 实体名称
|
|||
/// </summary>
|
|||
public string Name { get; set; } |
|||
/// <summary>
|
|||
/// 显示名称
|
|||
/// </summary>
|
|||
public string DisplayName { get; set; } |
|||
/// <summary>
|
|||
/// 可访问属性列表
|
|||
/// </summary>
|
|||
public EntityPropertyInfoDto[] Properties { get; set; } = new EntityPropertyInfoDto[0]; |
|||
} |
|||
@ -0,0 +1,6 @@ |
|||
namespace LINGYUN.Abp.DataProtection; |
|||
|
|||
public class EntityTypeInfoGetInput |
|||
{ |
|||
public DataAccessOperation Operation { get; set; } |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Services; |
|||
|
|||
namespace LINGYUN.Abp.DataProtection; |
|||
|
|||
public interface IEntityTypeInfoAppService : IApplicationService |
|||
{ |
|||
/// <summary>
|
|||
/// 获取实体可访问规则
|
|||
/// </summary>
|
|||
/// <param name="input"></param>
|
|||
/// <returns></returns>
|
|||
Task<EntityTypeInfoDto> GetEntityRuleAsync(EntityTypeInfoGetInput input); |
|||
} |
|||
@ -0,0 +1,3 @@ |
|||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
|||
<ConfigureAwait ContinueOnCapturedContext="false" /> |
|||
</Weavers> |
|||
@ -0,0 +1,25 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\..\configureawait.props" /> |
|||
<Import Project="..\..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0;net9.0</TargetFrameworks> |
|||
<AssemblyName>LINGYUN.Abp.DataProtection.Application</AssemblyName> |
|||
<PackageId>LINGYUN.Abp.DataProtection.Application</PackageId> |
|||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> |
|||
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> |
|||
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> |
|||
<RootNamespace /> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.Ddd.Application" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\LINGYUN.Abp.DataProtection\LINGYUN.Abp.DataProtection.csproj" /> |
|||
<ProjectReference Include="..\LINGYUN.Abp.DataProtection.Application.Contracts\LINGYUN.Abp.DataProtection.Application.Contracts.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,13 @@ |
|||
using Volo.Abp.Application; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace LINGYUN.Abp.DataProtection; |
|||
|
|||
[DependsOn( |
|||
typeof(AbpDataProtectionApplicationContractsModule), |
|||
typeof(AbpDataProtectionModule), |
|||
typeof(AbpDddApplicationModule))] |
|||
public class AbpDataProtectionApplicationModule : AbpModule |
|||
{ |
|||
|
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Services; |
|||
using Volo.Abp.Localization; |
|||
|
|||
namespace LINGYUN.Abp.DataProtection; |
|||
|
|||
public abstract class EntityTypeInfoAppService<TEntity> : ApplicationService, IEntityTypeInfoAppService |
|||
{ |
|||
protected IDataAccessEntityTypeInfoProvider EntityTypeInfoProvider => LazyServiceProvider.GetRequiredService<IDataAccessEntityTypeInfoProvider>(); |
|||
|
|||
[Authorize] |
|||
public virtual async Task<EntityTypeInfoDto> GetEntityRuleAsync(EntityTypeInfoGetInput input) |
|||
{ |
|||
var entityType = typeof(TEntity); |
|||
var resourceType = LocalizationResource ?? typeof(DefaultResource); |
|||
|
|||
var context = new DataAccessEntitTypeInfoContext( |
|||
entityType, |
|||
resourceType, |
|||
input.Operation, |
|||
LazyServiceProvider); |
|||
|
|||
var model = await EntityTypeInfoProvider.GetEntitTypeInfoAsync(context); |
|||
|
|||
return new EntityTypeInfoDto |
|||
{ |
|||
Name = model.Name, |
|||
DisplayName = model.DisplayName, |
|||
Properties = model.Properties.Select(prop => new EntityPropertyInfoDto |
|||
{ |
|||
Name = prop.Name, |
|||
DisplayName = prop.DisplayName, |
|||
TypeFullName = prop.TypeFullName, |
|||
JavaScriptType = prop.JavaScriptType, |
|||
Operates = prop.Operates, |
|||
Enums = prop.Enums.Select(em => new EntityEnumInfoDto |
|||
{ |
|||
Key = em.Key, |
|||
Value = em.Value, |
|||
}).ToArray() |
|||
}).ToArray(), |
|||
}; |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
namespace System; |
|||
|
|||
internal static class NullableTypeExtensions |
|||
{ |
|||
public static bool IsNullableType(this Type theType) => |
|||
theType.IsGenericType(typeof(Nullable<>)); |
|||
|
|||
public static bool IsGenericType(this Type type, Type genericType) => |
|||
type.IsGenericType && type.GetGenericTypeDefinition() == genericType; |
|||
} |
|||
@ -1,64 +0,0 @@ |
|||
using Microsoft.EntityFrameworkCore.Diagnostics; |
|||
using Microsoft.Extensions.Options; |
|||
using System; |
|||
using System.Linq; |
|||
using System.Linq.Expressions; |
|||
using System.Reflection; |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Domain.Entities; |
|||
using Volo.Abp.Users; |
|||
|
|||
namespace LINGYUN.Abp.DataProtection.EntityFrameworkCore; |
|||
public class AbpDataProtectedReadEntityInterceptor : IQueryExpressionInterceptor, ITransientDependency |
|||
{ |
|||
public IAbpLazyServiceProvider LazyServiceProvider { get; set; } = default!; |
|||
public IOptions<AbpDataProtectionOptions> DataProtectionOptions => LazyServiceProvider.LazyGetRequiredService<IOptions<AbpDataProtectionOptions>>(); |
|||
public ICurrentUser CurrentUser => LazyServiceProvider.LazyGetRequiredService<ICurrentUser>(); |
|||
public IDataFilter DataFilter => LazyServiceProvider.LazyGetRequiredService<IDataFilter>(); |
|||
public IEntityTypeFilterBuilder EntityTypeFilterBuilder => LazyServiceProvider.LazyGetRequiredService<IEntityTypeFilterBuilder>(); |
|||
|
|||
private static readonly MethodInfo WhereMethodInfo = typeof(Queryable).GetMethods().First(m => m.Name == nameof(Queryable.Where)); |
|||
|
|||
public Expression QueryCompilationStarting(Expression queryExpression, QueryExpressionEventData eventData) |
|||
{ |
|||
if (DataFilter.IsEnabled<IDataProtected>() && queryExpression.Type.GenericTypeArguments.Length > 0) |
|||
{ |
|||
var entityType = queryExpression.Type.GenericTypeArguments[0]; |
|||
var exp = EntityTypeFilterBuilder.Build(entityType, DataAccessOperation.Read); |
|||
|
|||
return Expression.Call( |
|||
method: WhereMethodInfo.MakeGenericMethod(entityType), |
|||
arg0: queryExpression, |
|||
arg1: exp); |
|||
} |
|||
|
|||
return queryExpression; |
|||
} |
|||
|
|||
public class DataProtectedExpressionVisitor : ExpressionVisitor |
|||
{ |
|||
private readonly Type _entityType; |
|||
private readonly IEntityTypeFilterBuilder _entityTypeFilterBuilder; |
|||
|
|||
public DataProtectedExpressionVisitor(Type entityType, IEntityTypeFilterBuilder entityTypeFilterBuilder) |
|||
{ |
|||
_entityType = entityType; |
|||
_entityTypeFilterBuilder = entityTypeFilterBuilder; |
|||
} |
|||
|
|||
private static readonly MethodInfo WhereMethodInfo = typeof(Queryable).GetMethods().First(m => m.Name == nameof(Queryable.Where)); |
|||
|
|||
protected override Expression VisitMethodCall(MethodCallExpression methodCallExpression) |
|||
{ |
|||
var method = WhereMethodInfo.MakeGenericMethod(_entityType); |
|||
var args0 = base.VisitMethodCall(methodCallExpression); |
|||
var args1 = _entityTypeFilterBuilder.Build(_entityType, DataAccessOperation.Read); |
|||
|
|||
return Expression.Call( |
|||
method: method, |
|||
arg0: args0, |
|||
arg1: args1); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
using System; |
|||
|
|||
namespace LINGYUN.Abp.DataProtection; |
|||
|
|||
public class DataAccessEntitTypeInfoContext |
|||
{ |
|||
public Type EntityType { get; } |
|||
public Type ResourceType { get; } |
|||
public DataAccessOperation Operation { get; } |
|||
public IServiceProvider ServiceProvider { get; } |
|||
public DataAccessEntitTypeInfoContext( |
|||
Type entityType, |
|||
Type resourceType, |
|||
DataAccessOperation operation, |
|||
IServiceProvider serviceProvider) |
|||
{ |
|||
EntityType = entityType; |
|||
ResourceType = resourceType; |
|||
Operation = operation; |
|||
ServiceProvider = serviceProvider; |
|||
} |
|||
} |
|||
@ -0,0 +1,103 @@ |
|||
using LINGYUN.Abp.DataProtection.Models; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Localization; |
|||
using Microsoft.Extensions.Options; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Reflection; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace LINGYUN.Abp.DataProtection; |
|||
|
|||
public class DataAccessEntityTypeInfoProvider : IDataAccessEntityTypeInfoProvider, ISingletonDependency |
|||
{ |
|||
public async virtual Task<EntityTypeInfoModel> GetEntitTypeInfoAsync(DataAccessEntitTypeInfoContext context) |
|||
{ |
|||
var allowProperties = new List<string>(); |
|||
|
|||
var dataProtectionOptions = context.ServiceProvider.GetRequiredService<IOptions<AbpDataProtectionOptions>>().Value; |
|||
var javaScriptTypeConvert = context.ServiceProvider.GetRequiredService<IJavaScriptTypeConvert>(); |
|||
var localizerFactory = context.ServiceProvider.GetRequiredService<IStringLocalizerFactory>(); |
|||
var stringLozalizer = localizerFactory.Create(context.ResourceType); |
|||
|
|||
var entityTypeRuleModel = new EntityTypeInfoModel |
|||
{ |
|||
Name = context.EntityType.Name, |
|||
DisplayName = stringLozalizer[$"DisplayName:{context.EntityType.Name}"].Value ?? context.EntityType.Name |
|||
}; |
|||
|
|||
var subjectContext = new DataAccessSubjectContributorContext( |
|||
context.EntityType.FullName, |
|||
context.Operation, |
|||
context.ServiceProvider); |
|||
|
|||
foreach (var subjectContributor in dataProtectionOptions.SubjectContributors) |
|||
{ |
|||
var subjectAllowProperties = await subjectContributor.GetAccessdProperties(subjectContext); |
|||
|
|||
allowProperties.AddIfNotContains(subjectAllowProperties); |
|||
} |
|||
|
|||
IEnumerable<PropertyInfo> entityPropeties = context.EntityType.GetProperties(); |
|||
|
|||
if (allowProperties.Count > 0) |
|||
{ |
|||
if (dataProtectionOptions.EntityIgnoreProperties.TryGetValue(context.EntityType, out var entityIgnoreProps)) |
|||
{ |
|||
allowProperties.AddIfNotContains(entityIgnoreProps); |
|||
} |
|||
|
|||
allowProperties.AddIfNotContains(dataProtectionOptions.GlobalIgnoreProperties); |
|||
|
|||
entityPropeties = entityPropeties.Where(x => allowProperties.Contains(x.Name)); |
|||
} |
|||
|
|||
foreach (var propertyInfo in entityPropeties) |
|||
{ |
|||
// 字段本地化描述规则
|
|||
// 在本地化文件中定义 DisplayName:PropertyName
|
|||
var localizedProp = stringLozalizer[$"DisplayName:{propertyInfo.Name}"]; |
|||
var propertyInfoResult = javaScriptTypeConvert.Convert(propertyInfo.PropertyType); |
|||
var entityPropertyInfo = new EntityPropertyInfoModel |
|||
{ |
|||
Name = propertyInfo.Name, |
|||
TypeFullName = propertyInfo.PropertyType.FullName, |
|||
DisplayName = localizedProp.Value ?? propertyInfo.Name, |
|||
JavaScriptType = propertyInfoResult.Type, |
|||
JavaScriptName = propertyInfo.Name.ToCamelCase(), |
|||
Operates = propertyInfoResult.AllowOperates |
|||
}; |
|||
|
|||
var propertyType = propertyInfo.PropertyType; |
|||
if (propertyType.IsNullableType()) |
|||
{ |
|||
propertyType = propertyType.GetGenericArguments().FirstOrDefault(); |
|||
} |
|||
|
|||
if (typeof(Enum).IsAssignableFrom(propertyType)) |
|||
{ |
|||
var enumNames = Enum.GetNames(propertyType); |
|||
var enumValues = Enum.GetValues(propertyType); |
|||
var paramterOptions = new EntityEnumInfoModel[enumNames.Length]; |
|||
for (var index = 0; index < enumNames.Length; index++) |
|||
{ |
|||
var enumName = enumNames[index]; |
|||
var localizerEnumKey = $"{propertyInfo.Name}:{enumName}"; |
|||
var localizerEnumName = stringLozalizer[localizerEnumKey]; |
|||
paramterOptions[index] = new EntityEnumInfoModel |
|||
{ |
|||
Key = localizerEnumName.ResourceNotFound ? enumName : localizerEnumName.Value, |
|||
Value = enumValues.GetValue(index), |
|||
}; |
|||
} |
|||
entityPropertyInfo.Enums = paramterOptions; |
|||
} |
|||
|
|||
entityTypeRuleModel.Properties.Add(entityPropertyInfo); |
|||
} |
|||
|
|||
return entityTypeRuleModel; |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.EventBus.Distributed; |
|||
|
|||
namespace LINGYUN.Abp.DataProtection; |
|||
|
|||
public class DataAccessResourceCacheInvalidator : IDistributedEventHandler<DataAccessResourceChangeEvent>, ITransientDependency |
|||
{ |
|||
private readonly IDataProtectedResourceStore _resourceStore; |
|||
public DataAccessResourceCacheInvalidator(IDataProtectedResourceStore resourceStore) |
|||
{ |
|||
_resourceStore = resourceStore; |
|||
} |
|||
public async virtual Task HandleEventAsync(DataAccessResourceChangeEvent eventData) |
|||
{ |
|||
await _resourceStore.SetAsync(eventData.Resource); |
|||
} |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
using LINGYUN.Abp.DataProtection.Models; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace LINGYUN.Abp.DataProtection; |
|||
|
|||
public interface IDataAccessEntityTypeInfoProvider |
|||
{ |
|||
Task<EntityTypeInfoModel> GetEntitTypeInfoAsync(DataAccessEntitTypeInfoContext context); |
|||
} |
|||
@ -1,9 +1,10 @@ |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace LINGYUN.Abp.DataProtection; |
|||
public interface IDataAccessSubjectContributor |
|||
{ |
|||
string Name { get; } |
|||
List<DataAccessFilterGroup> GetFilterGroups(DataAccessSubjectContributorContext context); |
|||
List<string> GetAllowProperties(DataAccessSubjectContributorContext context); |
|||
Task<List<DataAccessFilterGroup>> GetFilterGroups(DataAccessSubjectContributorContext context); |
|||
Task<List<string>> GetAccessdProperties(DataAccessSubjectContributorContext context); |
|||
} |
|||
|
|||
@ -1,9 +1,11 @@ |
|||
namespace LINGYUN.Abp.DataProtection; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace LINGYUN.Abp.DataProtection; |
|||
public interface IDataProtectedResourceStore |
|||
{ |
|||
void Set(DataAccessResource resource); |
|||
Task SetAsync(DataAccessResource resource); |
|||
|
|||
void Remove(DataAccessResource resource); |
|||
Task RemoveAsync(DataAccessResource resource); |
|||
|
|||
DataAccessResource Get(string subjectName, string subjectId, string entityTypeFullName, DataAccessOperation operation); |
|||
Task<DataAccessResource> GetAsync(string subjectName, string subjectId, string entityTypeFullName, DataAccessOperation operation); |
|||
} |
|||
|
|||
@ -0,0 +1,8 @@ |
|||
using System; |
|||
|
|||
namespace LINGYUN.Abp.DataProtection; |
|||
|
|||
public interface IJavaScriptTypeConvert |
|||
{ |
|||
JavaScriptTypeConvertResult Convert(Type propertyType); |
|||
} |
|||
@ -0,0 +1,132 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Reflection; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace LINGYUN.Abp.DataProtection; |
|||
|
|||
public class JavaScriptTypeConvert : IJavaScriptTypeConvert, ISingletonDependency |
|||
{ |
|||
public JavaScriptTypeConvertResult Convert(Type propertyType) |
|||
{ |
|||
var (JavaScriptType, AccessOperates) = InnerConvert(propertyType); |
|||
|
|||
return new JavaScriptTypeConvertResult(JavaScriptType, AccessOperates); |
|||
} |
|||
|
|||
protected virtual (string JavaScriptType, DataAccessFilterOperate[] AccessFilterOperates) InnerConvert(Type propertyType) |
|||
{ |
|||
var availableComparator = new List<DataAccessFilterOperate>(); |
|||
if (propertyType.IsNullableType()) |
|||
{ |
|||
propertyType = propertyType.GetGenericArguments().FirstOrDefault(); |
|||
} |
|||
|
|||
if (typeof(Enum).IsAssignableFrom(propertyType)) |
|||
{ |
|||
// 枚举类型只支持如下操作符
|
|||
// 小于、小于等于、大于、大于等于、等于、不等于、空、非空
|
|||
availableComparator.AddRange(new[] |
|||
{ |
|||
DataAccessFilterOperate.Greater, |
|||
DataAccessFilterOperate.GreaterOrEqual, |
|||
DataAccessFilterOperate.Less, |
|||
DataAccessFilterOperate.LessOrEqual, |
|||
DataAccessFilterOperate.Equal, |
|||
DataAccessFilterOperate.NotEqual, |
|||
}); |
|||
return ("number", availableComparator.ToArray()); |
|||
} |
|||
|
|||
var typeFullName = propertyType.FullName; |
|||
|
|||
switch (typeFullName) |
|||
{ |
|||
case "System.Int16": |
|||
case "System.Int32": |
|||
case "System.Int64": |
|||
case "System.UInt16": |
|||
case "System.UInt32": |
|||
case "System.UInt64": |
|||
case "System.Single": |
|||
case "System.Double": |
|||
case "System.Byte": |
|||
case "System.SByte": |
|||
case "System.Decimal": |
|||
// 数值类型只支持如下操作符
|
|||
// 小于、小于等于、大于、大于等于、等于、不等于、空、非空
|
|||
availableComparator.AddRange(new[] |
|||
{ |
|||
DataAccessFilterOperate.Greater, |
|||
DataAccessFilterOperate.GreaterOrEqual, |
|||
DataAccessFilterOperate.Less, |
|||
DataAccessFilterOperate.LessOrEqual, |
|||
DataAccessFilterOperate.Equal, |
|||
DataAccessFilterOperate.NotEqual, |
|||
}); |
|||
return ("number", availableComparator.ToArray()); |
|||
case "System.Boolean": |
|||
// 布尔类型只支持如下操作符
|
|||
// 等于、不等于、空、非空
|
|||
availableComparator.AddRange(new[] |
|||
{ |
|||
DataAccessFilterOperate.Equal, |
|||
DataAccessFilterOperate.NotEqual, |
|||
}); |
|||
return ("boolean", availableComparator.ToArray()); |
|||
case "System.Guid": |
|||
// Guid类型只支持如下操作符
|
|||
// 等于、不等于、空、非空
|
|||
availableComparator.AddRange(new[] |
|||
{ |
|||
DataAccessFilterOperate.Equal, |
|||
DataAccessFilterOperate.NotEqual, |
|||
}); |
|||
return ("string", availableComparator.ToArray()); |
|||
case "System.Char": |
|||
case "System.String": |
|||
// 字符类型支持所有操作符
|
|||
return ("string", availableComparator.ToArray()); |
|||
case "System.DateTime": |
|||
// 时间类型只支持如下操作符
|
|||
// 小于、小于等于、大于、大于等于、等于、不等于、空、非空
|
|||
availableComparator.AddRange(new[] |
|||
{ |
|||
DataAccessFilterOperate.Greater, |
|||
DataAccessFilterOperate.GreaterOrEqual, |
|||
DataAccessFilterOperate.Less, |
|||
DataAccessFilterOperate.LessOrEqual, |
|||
DataAccessFilterOperate.Equal, |
|||
DataAccessFilterOperate.NotEqual, |
|||
}); |
|||
return ("Date", availableComparator.ToArray()); |
|||
default: |
|||
case "System.Object": |
|||
case "System.DBNull": |
|||
if (propertyType.IsArray) |
|||
{ |
|||
// 数组类型只支持如下操作符
|
|||
// 包含、不包含、空、非空
|
|||
availableComparator.AddRange(new[] |
|||
{ |
|||
DataAccessFilterOperate.Contains, |
|||
DataAccessFilterOperate.NotContains, |
|||
}); |
|||
|
|||
return ("array", availableComparator.ToArray()); |
|||
} |
|||
else |
|||
{ |
|||
// 未知对象类型只支持如下操作符
|
|||
// 等于、不等于、空、非空
|
|||
availableComparator.AddRange(new[] |
|||
{ |
|||
DataAccessFilterOperate.Equal, |
|||
DataAccessFilterOperate.NotEqual, |
|||
}); |
|||
return ("object", availableComparator.ToArray()); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
namespace LINGYUN.Abp.DataProtection; |
|||
|
|||
public class JavaScriptTypeConvertResult |
|||
{ |
|||
public string Type { get; } |
|||
public DataAccessFilterOperate[] AllowOperates { get; } |
|||
public JavaScriptTypeConvertResult(string type, DataAccessFilterOperate[] allowOperates) |
|||
{ |
|||
Type = type; |
|||
AllowOperates = allowOperates; |
|||
} |
|||
} |
|||
File diff suppressed because it is too large
@ -0,0 +1,768 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace LY.MicroService.Applications.Single.EntityFrameworkCore.MySql.Migrations |
|||
{ |
|||
/// <inheritdoc />
|
|||
public partial class RemoveIdentityServerAndAddEntityEnumInfo : Migration |
|||
{ |
|||
/// <inheritdoc />
|
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropTable( |
|||
name: "IdentityServerApiResourceClaims"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "IdentityServerApiResourceProperties"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "IdentityServerApiResourceScopes"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "IdentityServerApiResourceSecrets"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "IdentityServerApiScopeClaims"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "IdentityServerApiScopeProperties"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "IdentityServerClientClaims"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "IdentityServerClientCorsOrigins"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "IdentityServerClientGrantTypes"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "IdentityServerClientIdPRestrictions"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "IdentityServerClientPostLogoutRedirectUris"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "IdentityServerClientProperties"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "IdentityServerClientRedirectUris"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "IdentityServerClientScopes"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "IdentityServerClientSecrets"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "IdentityServerDeviceFlowCodes"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "IdentityServerIdentityResourceClaims"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "IdentityServerIdentityResourceProperties"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "IdentityServerPersistedGrants"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "IdentityServerApiResources"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "IdentityServerApiScopes"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "IdentityServerClients"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "IdentityServerIdentityResources"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "ValueRange", |
|||
table: "AbpAuthEntityProperties"); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "AbpAuthEntityEnums", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
Name = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
DisplayName = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Value = table.Column<string>(type: "varchar(10)", maxLength: 10, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
PropertyInfoId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci") |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AbpAuthEntityEnums", x => x.Id); |
|||
table.ForeignKey( |
|||
name: "FK_AbpAuthEntityEnums_AbpAuthEntityProperties_PropertyInfoId", |
|||
column: x => x.PropertyInfoId, |
|||
principalTable: "AbpAuthEntityProperties", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AbpAuthEntityEnums_PropertyInfoId_Name", |
|||
table: "AbpAuthEntityEnums", |
|||
columns: new[] { "PropertyInfoId", "Name" }); |
|||
} |
|||
|
|||
/// <inheritdoc />
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropTable( |
|||
name: "AbpAuthEntityEnums"); |
|||
|
|||
migrationBuilder.AddColumn<string>( |
|||
name: "ValueRange", |
|||
table: "AbpAuthEntityProperties", |
|||
type: "varchar(512)", |
|||
maxLength: 512, |
|||
nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "IdentityServerApiResources", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
AllowedAccessTokenSigningAlgorithms = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
|||
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|||
DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|||
DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|||
Description = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
DisplayName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Enabled = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|||
ExtraProperties = table.Column<string>(type: "longtext", nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false), |
|||
LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|||
LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|||
Name = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
ShowInDiscoveryDocument = table.Column<bool>(type: "tinyint(1)", nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_IdentityServerApiResources", x => x.Id); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "IdentityServerApiScopes", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
|||
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|||
DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|||
DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|||
Description = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
DisplayName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Emphasize = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|||
Enabled = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|||
ExtraProperties = table.Column<string>(type: "longtext", nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false), |
|||
LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|||
LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|||
Name = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Required = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|||
ShowInDiscoveryDocument = table.Column<bool>(type: "tinyint(1)", nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_IdentityServerApiScopes", x => x.Id); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "IdentityServerClients", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
AbsoluteRefreshTokenLifetime = table.Column<int>(type: "int", nullable: false), |
|||
AccessTokenLifetime = table.Column<int>(type: "int", nullable: false), |
|||
AccessTokenType = table.Column<int>(type: "int", nullable: false), |
|||
AllowAccessTokensViaBrowser = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|||
AllowOfflineAccess = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|||
AllowPlainTextPkce = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|||
AllowRememberConsent = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|||
AllowedIdentityTokenSigningAlgorithms = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
AlwaysIncludeUserClaimsInIdToken = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|||
AlwaysSendClientClaims = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|||
AuthorizationCodeLifetime = table.Column<int>(type: "int", nullable: false), |
|||
BackChannelLogoutSessionRequired = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|||
BackChannelLogoutUri = table.Column<string>(type: "varchar(2000)", maxLength: 2000, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
ClientClaimsPrefix = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
ClientId = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
ClientName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
ClientUri = table.Column<string>(type: "varchar(2000)", maxLength: 2000, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
ConsentLifetime = table.Column<int>(type: "int", nullable: true), |
|||
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
|||
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|||
DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|||
DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|||
Description = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
DeviceCodeLifetime = table.Column<int>(type: "int", nullable: false), |
|||
EnableLocalLogin = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|||
Enabled = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|||
ExtraProperties = table.Column<string>(type: "longtext", nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
FrontChannelLogoutSessionRequired = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|||
FrontChannelLogoutUri = table.Column<string>(type: "varchar(2000)", maxLength: 2000, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
IdentityTokenLifetime = table.Column<int>(type: "int", nullable: false), |
|||
IncludeJwtId = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|||
IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false), |
|||
LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|||
LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|||
LogoUri = table.Column<string>(type: "varchar(2000)", maxLength: 2000, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
PairWiseSubjectSalt = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
ProtocolType = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
RefreshTokenExpiration = table.Column<int>(type: "int", nullable: false), |
|||
RefreshTokenUsage = table.Column<int>(type: "int", nullable: false), |
|||
RequireClientSecret = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|||
RequireConsent = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|||
RequirePkce = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|||
RequireRequestObject = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|||
SlidingRefreshTokenLifetime = table.Column<int>(type: "int", nullable: false), |
|||
UpdateAccessTokenClaimsOnRefresh = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|||
UserCodeType = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
UserSsoLifetime = table.Column<int>(type: "int", nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_IdentityServerClients", x => x.Id); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "IdentityServerDeviceFlowCodes", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
ClientId = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
|||
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|||
Data = table.Column<string>(type: "varchar(10000)", maxLength: 10000, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Description = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
DeviceCode = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Expiration = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
|||
ExtraProperties = table.Column<string>(type: "longtext", nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
SessionId = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
SubjectId = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
UserCode = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4") |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_IdentityServerDeviceFlowCodes", x => x.Id); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "IdentityServerIdentityResources", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
|||
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|||
DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|||
DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|||
Description = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
DisplayName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Emphasize = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|||
Enabled = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|||
ExtraProperties = table.Column<string>(type: "longtext", nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false), |
|||
LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|||
LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|||
Name = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Required = table.Column<bool>(type: "tinyint(1)", nullable: false), |
|||
ShowInDiscoveryDocument = table.Column<bool>(type: "tinyint(1)", nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_IdentityServerIdentityResources", x => x.Id); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "IdentityServerPersistedGrants", |
|||
columns: table => new |
|||
{ |
|||
Key = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
ClientId = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
ConsumedTime = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|||
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
|||
Data = table.Column<string>(type: "varchar(10000)", maxLength: 10000, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Description = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Expiration = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|||
ExtraProperties = table.Column<string>(type: "longtext", nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
SessionId = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
SubjectId = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Type = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4") |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_IdentityServerPersistedGrants", x => x.Key); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "IdentityServerApiResourceClaims", |
|||
columns: table => new |
|||
{ |
|||
ApiResourceId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
Type = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4") |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_IdentityServerApiResourceClaims", x => new { x.ApiResourceId, x.Type }); |
|||
table.ForeignKey( |
|||
name: "FK_IdentityServerApiResourceClaims_IdentityServerApiResources_A~", |
|||
column: x => x.ApiResourceId, |
|||
principalTable: "IdentityServerApiResources", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "IdentityServerApiResourceProperties", |
|||
columns: table => new |
|||
{ |
|||
ApiResourceId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
Key = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Value = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4") |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_IdentityServerApiResourceProperties", x => new { x.ApiResourceId, x.Key, x.Value }); |
|||
table.ForeignKey( |
|||
name: "FK_IdentityServerApiResourceProperties_IdentityServerApiResourc~", |
|||
column: x => x.ApiResourceId, |
|||
principalTable: "IdentityServerApiResources", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "IdentityServerApiResourceScopes", |
|||
columns: table => new |
|||
{ |
|||
ApiResourceId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
Scope = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4") |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_IdentityServerApiResourceScopes", x => new { x.ApiResourceId, x.Scope }); |
|||
table.ForeignKey( |
|||
name: "FK_IdentityServerApiResourceScopes_IdentityServerApiResources_A~", |
|||
column: x => x.ApiResourceId, |
|||
principalTable: "IdentityServerApiResources", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "IdentityServerApiResourceSecrets", |
|||
columns: table => new |
|||
{ |
|||
ApiResourceId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
Type = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Value = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Description = table.Column<string>(type: "varchar(1000)", maxLength: 1000, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Expiration = table.Column<DateTime>(type: "datetime(6)", nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_IdentityServerApiResourceSecrets", x => new { x.ApiResourceId, x.Type, x.Value }); |
|||
table.ForeignKey( |
|||
name: "FK_IdentityServerApiResourceSecrets_IdentityServerApiResources_~", |
|||
column: x => x.ApiResourceId, |
|||
principalTable: "IdentityServerApiResources", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "IdentityServerApiScopeClaims", |
|||
columns: table => new |
|||
{ |
|||
ApiScopeId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
Type = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4") |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_IdentityServerApiScopeClaims", x => new { x.ApiScopeId, x.Type }); |
|||
table.ForeignKey( |
|||
name: "FK_IdentityServerApiScopeClaims_IdentityServerApiScopes_ApiScop~", |
|||
column: x => x.ApiScopeId, |
|||
principalTable: "IdentityServerApiScopes", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "IdentityServerApiScopeProperties", |
|||
columns: table => new |
|||
{ |
|||
ApiScopeId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
Key = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Value = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4") |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_IdentityServerApiScopeProperties", x => new { x.ApiScopeId, x.Key, x.Value }); |
|||
table.ForeignKey( |
|||
name: "FK_IdentityServerApiScopeProperties_IdentityServerApiScopes_Api~", |
|||
column: x => x.ApiScopeId, |
|||
principalTable: "IdentityServerApiScopes", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "IdentityServerClientClaims", |
|||
columns: table => new |
|||
{ |
|||
ClientId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
Type = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Value = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4") |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_IdentityServerClientClaims", x => new { x.ClientId, x.Type, x.Value }); |
|||
table.ForeignKey( |
|||
name: "FK_IdentityServerClientClaims_IdentityServerClients_ClientId", |
|||
column: x => x.ClientId, |
|||
principalTable: "IdentityServerClients", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "IdentityServerClientCorsOrigins", |
|||
columns: table => new |
|||
{ |
|||
ClientId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
Origin = table.Column<string>(type: "varchar(150)", maxLength: 150, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4") |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_IdentityServerClientCorsOrigins", x => new { x.ClientId, x.Origin }); |
|||
table.ForeignKey( |
|||
name: "FK_IdentityServerClientCorsOrigins_IdentityServerClients_Client~", |
|||
column: x => x.ClientId, |
|||
principalTable: "IdentityServerClients", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "IdentityServerClientGrantTypes", |
|||
columns: table => new |
|||
{ |
|||
ClientId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
GrantType = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4") |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_IdentityServerClientGrantTypes", x => new { x.ClientId, x.GrantType }); |
|||
table.ForeignKey( |
|||
name: "FK_IdentityServerClientGrantTypes_IdentityServerClients_ClientId", |
|||
column: x => x.ClientId, |
|||
principalTable: "IdentityServerClients", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "IdentityServerClientIdPRestrictions", |
|||
columns: table => new |
|||
{ |
|||
ClientId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
Provider = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4") |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_IdentityServerClientIdPRestrictions", x => new { x.ClientId, x.Provider }); |
|||
table.ForeignKey( |
|||
name: "FK_IdentityServerClientIdPRestrictions_IdentityServerClients_Cl~", |
|||
column: x => x.ClientId, |
|||
principalTable: "IdentityServerClients", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "IdentityServerClientPostLogoutRedirectUris", |
|||
columns: table => new |
|||
{ |
|||
ClientId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
PostLogoutRedirectUri = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4") |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_IdentityServerClientPostLogoutRedirectUris", x => new { x.ClientId, x.PostLogoutRedirectUri }); |
|||
table.ForeignKey( |
|||
name: "FK_IdentityServerClientPostLogoutRedirectUris_IdentityServerCli~", |
|||
column: x => x.ClientId, |
|||
principalTable: "IdentityServerClients", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "IdentityServerClientProperties", |
|||
columns: table => new |
|||
{ |
|||
ClientId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
Key = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Value = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4") |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_IdentityServerClientProperties", x => new { x.ClientId, x.Key, x.Value }); |
|||
table.ForeignKey( |
|||
name: "FK_IdentityServerClientProperties_IdentityServerClients_ClientId", |
|||
column: x => x.ClientId, |
|||
principalTable: "IdentityServerClients", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "IdentityServerClientRedirectUris", |
|||
columns: table => new |
|||
{ |
|||
ClientId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
RedirectUri = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4") |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_IdentityServerClientRedirectUris", x => new { x.ClientId, x.RedirectUri }); |
|||
table.ForeignKey( |
|||
name: "FK_IdentityServerClientRedirectUris_IdentityServerClients_Clien~", |
|||
column: x => x.ClientId, |
|||
principalTable: "IdentityServerClients", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "IdentityServerClientScopes", |
|||
columns: table => new |
|||
{ |
|||
ClientId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
Scope = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4") |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_IdentityServerClientScopes", x => new { x.ClientId, x.Scope }); |
|||
table.ForeignKey( |
|||
name: "FK_IdentityServerClientScopes_IdentityServerClients_ClientId", |
|||
column: x => x.ClientId, |
|||
principalTable: "IdentityServerClients", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "IdentityServerClientSecrets", |
|||
columns: table => new |
|||
{ |
|||
ClientId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
Type = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Value = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Description = table.Column<string>(type: "varchar(2000)", maxLength: 2000, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Expiration = table.Column<DateTime>(type: "datetime(6)", nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_IdentityServerClientSecrets", x => new { x.ClientId, x.Type, x.Value }); |
|||
table.ForeignKey( |
|||
name: "FK_IdentityServerClientSecrets_IdentityServerClients_ClientId", |
|||
column: x => x.ClientId, |
|||
principalTable: "IdentityServerClients", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "IdentityServerIdentityResourceClaims", |
|||
columns: table => new |
|||
{ |
|||
IdentityResourceId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
Type = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4") |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_IdentityServerIdentityResourceClaims", x => new { x.IdentityResourceId, x.Type }); |
|||
table.ForeignKey( |
|||
name: "FK_IdentityServerIdentityResourceClaims_IdentityServerIdentityR~", |
|||
column: x => x.IdentityResourceId, |
|||
principalTable: "IdentityServerIdentityResources", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "IdentityServerIdentityResourceProperties", |
|||
columns: table => new |
|||
{ |
|||
IdentityResourceId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
Key = table.Column<string>(type: "varchar(250)", maxLength: 250, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Value = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4") |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_IdentityServerIdentityResourceProperties", x => new { x.IdentityResourceId, x.Key, x.Value }); |
|||
table.ForeignKey( |
|||
name: "FK_IdentityServerIdentityResourceProperties_IdentityServerIdent~", |
|||
column: x => x.IdentityResourceId, |
|||
principalTable: "IdentityServerIdentityResources", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_IdentityServerClients_ClientId", |
|||
table: "IdentityServerClients", |
|||
column: "ClientId"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_IdentityServerDeviceFlowCodes_DeviceCode", |
|||
table: "IdentityServerDeviceFlowCodes", |
|||
column: "DeviceCode", |
|||
unique: true); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_IdentityServerDeviceFlowCodes_Expiration", |
|||
table: "IdentityServerDeviceFlowCodes", |
|||
column: "Expiration"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_IdentityServerDeviceFlowCodes_UserCode", |
|||
table: "IdentityServerDeviceFlowCodes", |
|||
column: "UserCode"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_IdentityServerPersistedGrants_Expiration", |
|||
table: "IdentityServerPersistedGrants", |
|||
column: "Expiration"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_IdentityServerPersistedGrants_SubjectId_ClientId_Type", |
|||
table: "IdentityServerPersistedGrants", |
|||
columns: new[] { "SubjectId", "ClientId", "Type" }); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_IdentityServerPersistedGrants_SubjectId_SessionId_Type", |
|||
table: "IdentityServerPersistedGrants", |
|||
columns: new[] { "SubjectId", "SessionId", "Type" }); |
|||
} |
|||
} |
|||
} |
|||
File diff suppressed because it is too large
@ -0,0 +1,31 @@ |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace LY.MicroService.Applications.Single.EntityFrameworkCore.MySql.Migrations |
|||
{ |
|||
/// <inheritdoc />
|
|||
public partial class AddJavascriptType : Migration |
|||
{ |
|||
/// <inheritdoc />
|
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AddColumn<string>( |
|||
name: "JavaScriptType", |
|||
table: "AbpAuthEntityProperties", |
|||
type: "varchar(256)", |
|||
maxLength: 256, |
|||
nullable: false, |
|||
defaultValue: "") |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
} |
|||
|
|||
/// <inheritdoc />
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropColumn( |
|||
name: "JavaScriptType", |
|||
table: "AbpAuthEntityProperties"); |
|||
} |
|||
} |
|||
} |
|||
File diff suppressed because it is too large
@ -0,0 +1,38 @@ |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace LY.MicroService.Applications.Single.EntityFrameworkCore.MySql.Migrations |
|||
{ |
|||
/// <inheritdoc />
|
|||
public partial class RenameAllowPropertiesToAccessedProperties : Migration |
|||
{ |
|||
/// <inheritdoc />
|
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.RenameColumn( |
|||
name: "AllowProperties", |
|||
table: "AbpAuthRoleEntityRules", |
|||
newName: "AccessedProperties"); |
|||
|
|||
migrationBuilder.RenameColumn( |
|||
name: "AllowProperties", |
|||
table: "AbpAuthOrganizationUnitEntityRules", |
|||
newName: "AccessedProperties"); |
|||
} |
|||
|
|||
/// <inheritdoc />
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.RenameColumn( |
|||
name: "AccessedProperties", |
|||
table: "AbpAuthRoleEntityRules", |
|||
newName: "AllowProperties"); |
|||
|
|||
migrationBuilder.RenameColumn( |
|||
name: "AccessedProperties", |
|||
table: "AbpAuthOrganizationUnitEntityRules", |
|||
newName: "AllowProperties"); |
|||
} |
|||
} |
|||
} |
|||
File diff suppressed because it is too large
@ -0,0 +1,20 @@ |
|||
using System; |
|||
using Volo.Abp.Application.Dtos; |
|||
|
|||
namespace LINGYUN.Abp.DataProtectionManagement; |
|||
|
|||
public class EntityEnumInfoDto : EntityDto<Guid> |
|||
{ |
|||
/// <summary>
|
|||
/// 名称
|
|||
/// </summary>
|
|||
public string Name { get; set; } |
|||
/// <summary>
|
|||
/// 显示名称
|
|||
/// </summary>
|
|||
public string DisplayName { get; set; } |
|||
/// <summary>
|
|||
/// 枚举值
|
|||
/// </summary>
|
|||
public string Value { get; set; } |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
namespace LINGYUN.Abp.DataProtectionManagement; |
|||
|
|||
public static class EntityEnumInfoConsts |
|||
{ |
|||
public static int MaxNameLength { get; set; } = EntityTypeInfoConsts.MaxNameLength; |
|||
public static int MaxDisplayNameLength { get; set; } = EntityTypeInfoConsts.MaxDisplayNameLength; |
|||
public static int MaxValueLength { get; set; } = 10; |
|||
} |
|||
@ -1,56 +0,0 @@ |
|||
using LINGYUN.Abp.Authorization.Permissions; |
|||
using LINGYUN.Abp.DataProtection; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Authorization.Permissions; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Domain.Entities.Events; |
|||
using Volo.Abp.EventBus; |
|||
|
|||
namespace LINGYUN.Abp.DataProtectionManagement; |
|||
public class DataProtectedResourceCacheItemInvalidator : |
|||
ILocalEventHandler<EntityChangedEventData<RoleEntityRule>>, |
|||
ILocalEventHandler<EntityChangedEventData<OrganizationUnitEntityRule>>, |
|||
ITransientDependency |
|||
{ |
|||
private readonly IDataProtectedResourceCache _resourceCache; |
|||
|
|||
public DataProtectedResourceCacheItemInvalidator(IDataProtectedResourceCache resourceCache) |
|||
{ |
|||
_resourceCache = resourceCache; |
|||
} |
|||
|
|||
public virtual Task HandleEventAsync(EntityChangedEventData<RoleEntityRule> eventData) |
|||
{ |
|||
var dataResource = new DataAccessResource( |
|||
RolePermissionValueProvider.ProviderName, |
|||
eventData.Entity.RoleName, |
|||
eventData.Entity.EntityTypeFullName, |
|||
eventData.Entity.Operation, |
|||
eventData.Entity.FilterGroup) |
|||
{ |
|||
AllowProperties = eventData.Entity.AllowProperties?.Split(",").ToList(), |
|||
}; |
|||
|
|||
_resourceCache.SetCache(dataResource); |
|||
|
|||
return Task.CompletedTask; |
|||
} |
|||
|
|||
public virtual Task HandleEventAsync(EntityChangedEventData<OrganizationUnitEntityRule> eventData) |
|||
{ |
|||
var dataResource = new DataAccessResource( |
|||
OrganizationUnitPermissionValueProvider.ProviderName, |
|||
eventData.Entity.OrgCode, |
|||
eventData.Entity.EntityTypeFullName, |
|||
eventData.Entity.Operation, |
|||
eventData.Entity.FilterGroup) |
|||
{ |
|||
AllowProperties = eventData.Entity.AllowProperties?.Split(",").ToList(), |
|||
}; |
|||
|
|||
_resourceCache.SetCache(dataResource); |
|||
|
|||
return Task.CompletedTask; |
|||
} |
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
using System; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Domain.Entities; |
|||
|
|||
namespace LINGYUN.Abp.DataProtectionManagement; |
|||
|
|||
public class EntityEnumInfo : Entity<Guid> |
|||
{ |
|||
/// <summary>
|
|||
/// 名称
|
|||
/// </summary>
|
|||
public virtual string Name { get; protected set; } |
|||
/// <summary>
|
|||
/// 显示名称
|
|||
/// </summary>
|
|||
public virtual string DisplayName { get; protected set; } |
|||
/// <summary>
|
|||
/// 枚举值
|
|||
/// </summary>
|
|||
public virtual string Value { get; protected set; } |
|||
/// <summary>
|
|||
/// 所属属性
|
|||
/// </summary>
|
|||
public virtual EntityPropertyInfo PropertyInfo { get; protected set; } |
|||
/// <summary>
|
|||
/// 所属属性标识
|
|||
/// </summary>
|
|||
public virtual Guid PropertyInfoId { get; protected set; } |
|||
protected EntityEnumInfo() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public EntityEnumInfo( |
|||
Guid id, |
|||
Guid propertyInfoId, |
|||
string name, |
|||
string displayName, |
|||
string value) |
|||
: base(id) |
|||
{ |
|||
PropertyInfoId = propertyInfoId; |
|||
Name = Check.NotNullOrWhiteSpace(name, nameof(name), EntityEnumInfoConsts.MaxNameLength); |
|||
DisplayName = Check.NotNullOrWhiteSpace(displayName, nameof(displayName), EntityEnumInfoConsts.MaxDisplayNameLength); |
|||
Value = Check.NotNullOrWhiteSpace(value, nameof(value), EntityEnumInfoConsts.MaxValueLength); |
|||
} |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
using LINGYUN.Abp.OssManagement; |
|||
using LINGYUN.Abp.OssManagement.Aliyun; |
|||
using System; |
|||
|
|||
namespace Microsoft.Extensions.DependencyInjection; |
|||
|
|||
public static class AliyunOssContainerServiceCollectionExtensions |
|||
{ |
|||
public static IServiceCollection AddMinioContainer(this IServiceCollection services) |
|||
{ |
|||
services.AddTransient<IOssContainerFactory, AliyunOssContainerFactory>(); |
|||
|
|||
services.AddTransient<IOssObjectExpireor>(provider => |
|||
provider |
|||
.GetRequiredService<IOssContainerFactory>() |
|||
.Create() |
|||
.As<AliyunOssContainer>()); |
|||
|
|||
return services; |
|||
} |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
using LINGYUN.Abp.OssManagement; |
|||
using LINGYUN.Abp.OssManagement.FileSystem; |
|||
using System; |
|||
|
|||
namespace Microsoft.Extensions.DependencyInjection; |
|||
|
|||
public static class FileSystemOssContainerServiceCollectionExtensions |
|||
{ |
|||
public static IServiceCollection AddFileSystemContainer(this IServiceCollection services) |
|||
{ |
|||
services.AddTransient<IOssContainerFactory, FileSystemOssContainerFactory>(); |
|||
|
|||
services.AddTransient<IOssObjectExpireor>(provider => |
|||
provider |
|||
.GetRequiredService<IOssContainerFactory>() |
|||
.Create() |
|||
.As<FileSystemOssContainer>()); |
|||
|
|||
return services; |
|||
} |
|||
} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue