|
|
|
@ -1,5 +1,6 @@ |
|
|
|
using JetBrains.Annotations; |
|
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
using Volo.Abp.Authorization.Permissions; |
|
|
|
using Volo.Abp.EntityFrameworkCore.Modeling; |
|
|
|
|
|
|
|
namespace Volo.Abp.PermissionManagement.EntityFrameworkCore; |
|
|
|
@ -17,11 +18,44 @@ public static class AbpPermissionManagementDbContextModelBuilderExtensions |
|
|
|
|
|
|
|
b.ConfigureByConvention(); |
|
|
|
|
|
|
|
b.Property(x => x.Name).HasMaxLength(PermissionGrantConsts.MaxNameLength).IsRequired(); |
|
|
|
b.Property(x => x.Name).HasMaxLength(PermissionDefinitionRecordConsts.MaxNameLength).IsRequired(); |
|
|
|
b.Property(x => x.ProviderName).HasMaxLength(PermissionGrantConsts.MaxProviderNameLength).IsRequired(); |
|
|
|
b.Property(x => x.ProviderKey).HasMaxLength(PermissionGrantConsts.MaxProviderKeyLength).IsRequired(); |
|
|
|
|
|
|
|
b.HasIndex(x => new { x.TenantId, x.Name, x.ProviderName, x.ProviderKey }).IsUnique(true); |
|
|
|
b.HasIndex(x => new { x.TenantId, x.Name, x.ProviderName, x.ProviderKey }).IsUnique(); |
|
|
|
|
|
|
|
b.ApplyObjectExtensionMappings(); |
|
|
|
}); |
|
|
|
|
|
|
|
builder.Entity<PermissionGroupDefinitionRecord>(b => |
|
|
|
{ |
|
|
|
b.ToTable(AbpPermissionManagementDbProperties.DbTablePrefix + "PermissionGroups", AbpPermissionManagementDbProperties.DbSchema); |
|
|
|
|
|
|
|
b.ConfigureByConvention(); |
|
|
|
|
|
|
|
b.Property(x => x.Name).HasMaxLength(PermissionGroupDefinitionRecordConsts.MaxNameLength).IsRequired(); |
|
|
|
b.Property(x => x.DisplayName).HasMaxLength(PermissionGroupDefinitionRecordConsts.MaxDisplayNameLength).IsRequired(); |
|
|
|
|
|
|
|
b.HasIndex(x => new { x.Name }).IsUnique(); |
|
|
|
|
|
|
|
b.ApplyObjectExtensionMappings(); |
|
|
|
}); |
|
|
|
|
|
|
|
builder.Entity<PermissionDefinitionRecord>(b => |
|
|
|
{ |
|
|
|
b.ToTable(AbpPermissionManagementDbProperties.DbTablePrefix + "Permissions", AbpPermissionManagementDbProperties.DbSchema); |
|
|
|
|
|
|
|
b.ConfigureByConvention(); |
|
|
|
|
|
|
|
b.Property(x => x.GroupName).HasMaxLength(PermissionGroupDefinitionRecordConsts.MaxNameLength).IsRequired(); |
|
|
|
b.Property(x => x.Name).HasMaxLength(PermissionDefinitionRecordConsts.MaxNameLength).IsRequired(); |
|
|
|
b.Property(x => x.ParentName).HasMaxLength(PermissionDefinitionRecordConsts.MaxNameLength); |
|
|
|
b.Property(x => x.DisplayName).HasMaxLength(PermissionDefinitionRecordConsts.MaxDisplayNameLength).IsRequired(); |
|
|
|
b.Property(x => x.Providers).HasMaxLength(PermissionDefinitionRecordConsts.MaxProvidersLength).IsRequired(); |
|
|
|
b.Property(x => x.StateCheckers).HasMaxLength(PermissionDefinitionRecordConsts.MaxStateCheckersLength).IsRequired(); |
|
|
|
|
|
|
|
b.HasIndex(x => new { x.Name }).IsUnique(); |
|
|
|
b.HasIndex(x => new { x.GroupName }); |
|
|
|
|
|
|
|
b.ApplyObjectExtensionMappings(); |
|
|
|
}); |
|
|
|
|