mirror of https://github.com/abpframework/abp.git
86 changed files with 2203 additions and 2292 deletions
@ -1,11 +1,10 @@ |
|||
using System.Collections.Generic; |
|||
|
|||
namespace Volo.Abp.PermissionManagement |
|||
namespace Volo.Abp.PermissionManagement; |
|||
|
|||
public class GetPermissionListResultDto |
|||
{ |
|||
public class GetPermissionListResultDto |
|||
{ |
|||
public string EntityDisplayName { get; set; } |
|||
public string EntityDisplayName { get; set; } |
|||
|
|||
public List<PermissionGroupDto> Groups { get; set; } |
|||
} |
|||
} |
|||
public List<PermissionGroupDto> Groups { get; set; } |
|||
} |
|||
|
|||
@ -1,19 +1,18 @@ |
|||
using System.Collections.Generic; |
|||
|
|||
namespace Volo.Abp.PermissionManagement |
|||
namespace Volo.Abp.PermissionManagement; |
|||
|
|||
public class PermissionGrantInfoDto |
|||
{ |
|||
public class PermissionGrantInfoDto |
|||
{ |
|||
public string Name { get; set; } |
|||
public string Name { get; set; } |
|||
|
|||
public string DisplayName { get; set; } |
|||
public string DisplayName { get; set; } |
|||
|
|||
public string ParentName { get; set; } |
|||
public string ParentName { get; set; } |
|||
|
|||
public bool IsGranted { get; set; } |
|||
public bool IsGranted { get; set; } |
|||
|
|||
public List<string> AllowedProviders { get; set; } |
|||
public List<string> AllowedProviders { get; set; } |
|||
|
|||
public List<ProviderInfoDto> GrantedProviders { get; set; } |
|||
} |
|||
} |
|||
public List<ProviderInfoDto> GrantedProviders { get; set; } |
|||
} |
|||
|
|||
@ -1,13 +1,12 @@ |
|||
using System.Collections.Generic; |
|||
|
|||
namespace Volo.Abp.PermissionManagement |
|||
namespace Volo.Abp.PermissionManagement; |
|||
|
|||
public class PermissionGroupDto |
|||
{ |
|||
public class PermissionGroupDto |
|||
{ |
|||
public string Name { get; set; } |
|||
public string Name { get; set; } |
|||
|
|||
public string DisplayName { get; set; } |
|||
public string DisplayName { get; set; } |
|||
|
|||
public List<PermissionGrantInfoDto> Permissions { get; set; } |
|||
} |
|||
} |
|||
public List<PermissionGrantInfoDto> Permissions { get; set; } |
|||
} |
|||
|
|||
@ -1,9 +1,8 @@ |
|||
namespace Volo.Abp.PermissionManagement |
|||
namespace Volo.Abp.PermissionManagement; |
|||
|
|||
public class PermissionManagementRemoteServiceConsts |
|||
{ |
|||
public class PermissionManagementRemoteServiceConsts |
|||
{ |
|||
public const string RemoteServiceName = "AbpPermissionManagement"; |
|||
public const string RemoteServiceName = "AbpPermissionManagement"; |
|||
|
|||
public const string ModuleName = "permissionManagement"; |
|||
} |
|||
public const string ModuleName = "permissionManagement"; |
|||
} |
|||
|
|||
@ -1,9 +1,8 @@ |
|||
namespace Volo.Abp.PermissionManagement |
|||
namespace Volo.Abp.PermissionManagement; |
|||
|
|||
public class ProviderInfoDto |
|||
{ |
|||
public class ProviderInfoDto |
|||
{ |
|||
public string ProviderName { get; set; } |
|||
public string ProviderName { get; set; } |
|||
|
|||
public string ProviderKey { get; set; } |
|||
} |
|||
} |
|||
public string ProviderKey { get; set; } |
|||
} |
|||
|
|||
@ -1,9 +1,8 @@ |
|||
namespace Volo.Abp.PermissionManagement |
|||
namespace Volo.Abp.PermissionManagement; |
|||
|
|||
public class UpdatePermissionDto |
|||
{ |
|||
public class UpdatePermissionDto |
|||
{ |
|||
public string Name { get; set; } |
|||
public string Name { get; set; } |
|||
|
|||
public bool IsGranted { get; set; } |
|||
} |
|||
} |
|||
public bool IsGranted { get; set; } |
|||
} |
|||
|
|||
@ -1,7 +1,6 @@ |
|||
namespace Volo.Abp.PermissionManagement |
|||
namespace Volo.Abp.PermissionManagement; |
|||
|
|||
public class UpdatePermissionsDto |
|||
{ |
|||
public class UpdatePermissionsDto |
|||
{ |
|||
public UpdatePermissionDto[] Permissions { get; set; } |
|||
} |
|||
} |
|||
public UpdatePermissionDto[] Permissions { get; set; } |
|||
} |
|||
|
|||
@ -1,15 +1,14 @@ |
|||
using Volo.Abp.Application; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace Volo.Abp.PermissionManagement |
|||
namespace Volo.Abp.PermissionManagement; |
|||
|
|||
[DependsOn( |
|||
typeof(AbpPermissionManagementDomainModule), |
|||
typeof(AbpPermissionManagementApplicationContractsModule), |
|||
typeof(AbpDddApplicationModule) |
|||
)] |
|||
public class AbpPermissionManagementApplicationModule : AbpModule |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpPermissionManagementDomainModule), |
|||
typeof(AbpPermissionManagementApplicationContractsModule), |
|||
typeof(AbpDddApplicationModule) |
|||
)] |
|||
public class AbpPermissionManagementApplicationModule : AbpModule |
|||
{ |
|||
|
|||
} |
|||
|
|||
} |
|||
|
|||
@ -1,13 +1,12 @@ |
|||
using Volo.Abp.AspNetCore.Components.Server.Theming; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace Volo.Abp.PermissionManagement.Blazor.Server |
|||
namespace Volo.Abp.PermissionManagement.Blazor.Server; |
|||
|
|||
[DependsOn( |
|||
typeof(AbpPermissionManagementBlazorModule), |
|||
typeof(AbpAspNetCoreComponentsServerThemingModule) |
|||
)] |
|||
public class AbpPermissionManagementBlazorServerModule : AbpModule |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpPermissionManagementBlazorModule), |
|||
typeof(AbpAspNetCoreComponentsServerThemingModule) |
|||
)] |
|||
public class AbpPermissionManagementBlazorServerModule : AbpModule |
|||
{ |
|||
} |
|||
} |
|||
|
|||
@ -1,14 +1,13 @@ |
|||
using Volo.Abp.AspNetCore.Components.WebAssembly.Theming; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace Volo.Abp.PermissionManagement.Blazor.WebAssembly |
|||
namespace Volo.Abp.PermissionManagement.Blazor.WebAssembly; |
|||
|
|||
[DependsOn( |
|||
typeof(AbpPermissionManagementBlazorModule), |
|||
typeof(AbpAspNetCoreComponentsWebAssemblyThemingModule), |
|||
typeof(AbpPermissionManagementHttpApiClientModule) |
|||
)] |
|||
public class AbpPermissionManagementBlazorWebAssemblyModule : AbpModule |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpPermissionManagementBlazorModule), |
|||
typeof(AbpAspNetCoreComponentsWebAssemblyThemingModule), |
|||
typeof(AbpPermissionManagementHttpApiClientModule) |
|||
)] |
|||
public class AbpPermissionManagementBlazorWebAssemblyModule : AbpModule |
|||
{ |
|||
} |
|||
} |
|||
|
|||
@ -1,10 +1,9 @@ |
|||
using Volo.Abp.Localization; |
|||
|
|||
namespace Volo.Abp.PermissionManagement.Localization |
|||
namespace Volo.Abp.PermissionManagement.Localization; |
|||
|
|||
[LocalizationResourceName("AbpPermissionManagement")] |
|||
public class AbpPermissionManagementResource |
|||
{ |
|||
[LocalizationResourceName("AbpPermissionManagement")] |
|||
public class AbpPermissionManagementResource |
|||
{ |
|||
|
|||
} |
|||
|
|||
} |
|||
|
|||
@ -1,20 +1,19 @@ |
|||
namespace Volo.Abp.PermissionManagement |
|||
namespace Volo.Abp.PermissionManagement; |
|||
|
|||
public static class PermissionGrantConsts |
|||
{ |
|||
public static class PermissionGrantConsts |
|||
{ |
|||
/// <summary>
|
|||
/// Default value: 128
|
|||
/// </summary>
|
|||
public static int MaxNameLength { get; set; } = 128; |
|||
/// <summary>
|
|||
/// Default value: 128
|
|||
/// </summary>
|
|||
public static int MaxNameLength { get; set; } = 128; |
|||
|
|||
/// <summary>
|
|||
/// Default value: 64
|
|||
/// </summary>
|
|||
public static int MaxProviderNameLength { get; set; } = 64; |
|||
/// <summary>
|
|||
/// Default value: 64
|
|||
/// </summary>
|
|||
public static int MaxProviderNameLength { get; set; } = 64; |
|||
|
|||
/// <summary>
|
|||
/// Default value: 64
|
|||
/// </summary>
|
|||
public static int MaxProviderKeyLength { get; set; } = 64; |
|||
} |
|||
/// <summary>
|
|||
/// Default value: 64
|
|||
/// </summary>
|
|||
public static int MaxProviderKeyLength { get; set; } = 64; |
|||
} |
|||
|
|||
@ -1,13 +1,12 @@ |
|||
using Volo.Abp.Data; |
|||
|
|||
namespace Volo.Abp.PermissionManagement |
|||
namespace Volo.Abp.PermissionManagement; |
|||
|
|||
public static class AbpPermissionManagementDbProperties |
|||
{ |
|||
public static class AbpPermissionManagementDbProperties |
|||
{ |
|||
public static string DbTablePrefix { get; set; } = AbpCommonDbProperties.DbTablePrefix; |
|||
public static string DbTablePrefix { get; set; } = AbpCommonDbProperties.DbTablePrefix; |
|||
|
|||
public static string DbSchema { get; set; } = AbpCommonDbProperties.DbSchema; |
|||
public static string DbSchema { get; set; } = AbpCommonDbProperties.DbSchema; |
|||
|
|||
public const string ConnectionStringName = "AbpPermissionManagement"; |
|||
} |
|||
public const string ConnectionStringName = "AbpPermissionManagement"; |
|||
} |
|||
|
|||
@ -1,26 +1,25 @@ |
|||
using System.Collections.Generic; |
|||
|
|||
namespace Volo.Abp.PermissionManagement |
|||
namespace Volo.Abp.PermissionManagement; |
|||
|
|||
public class MultiplePermissionValueProviderGrantInfo |
|||
{ |
|||
public class MultiplePermissionValueProviderGrantInfo |
|||
{ |
|||
public Dictionary<string, PermissionValueProviderGrantInfo> Result { get; } |
|||
public Dictionary<string, PermissionValueProviderGrantInfo> Result { get; } |
|||
|
|||
public MultiplePermissionValueProviderGrantInfo() |
|||
{ |
|||
Result = new Dictionary<string, PermissionValueProviderGrantInfo>(); |
|||
} |
|||
public MultiplePermissionValueProviderGrantInfo() |
|||
{ |
|||
Result = new Dictionary<string, PermissionValueProviderGrantInfo>(); |
|||
} |
|||
|
|||
public MultiplePermissionValueProviderGrantInfo(string[] names) |
|||
{ |
|||
Check.NotNull(names, nameof(names)); |
|||
public MultiplePermissionValueProviderGrantInfo(string[] names) |
|||
{ |
|||
Check.NotNull(names, nameof(names)); |
|||
|
|||
Result = new Dictionary<string, PermissionValueProviderGrantInfo>(); |
|||
Result = new Dictionary<string, PermissionValueProviderGrantInfo>(); |
|||
|
|||
foreach (var name in names) |
|||
{ |
|||
Result.Add(name, PermissionValueProviderGrantInfo.NonGranted); |
|||
} |
|||
foreach (var name in names) |
|||
{ |
|||
Result.Add(name, PermissionValueProviderGrantInfo.NonGranted); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,26 +1,25 @@ |
|||
using System.Collections.Generic; |
|||
|
|||
namespace Volo.Abp.PermissionManagement |
|||
namespace Volo.Abp.PermissionManagement; |
|||
|
|||
public class MultiplePermissionWithGrantedProviders |
|||
{ |
|||
public class MultiplePermissionWithGrantedProviders |
|||
{ |
|||
public List<PermissionWithGrantedProviders> Result { get; } |
|||
public List<PermissionWithGrantedProviders> Result { get; } |
|||
|
|||
public MultiplePermissionWithGrantedProviders() |
|||
{ |
|||
Result = new List<PermissionWithGrantedProviders>(); |
|||
} |
|||
public MultiplePermissionWithGrantedProviders() |
|||
{ |
|||
Result = new List<PermissionWithGrantedProviders>(); |
|||
} |
|||
|
|||
public MultiplePermissionWithGrantedProviders(string[] names) |
|||
{ |
|||
Check.NotNull(names, nameof(names)); |
|||
public MultiplePermissionWithGrantedProviders(string[] names) |
|||
{ |
|||
Check.NotNull(names, nameof(names)); |
|||
|
|||
Result = new List<PermissionWithGrantedProviders>(); |
|||
Result = new List<PermissionWithGrantedProviders>(); |
|||
|
|||
foreach (var name in names) |
|||
{ |
|||
Result.Add(new PermissionWithGrantedProviders(name, false)); |
|||
} |
|||
foreach (var name in names) |
|||
{ |
|||
Result.Add(new PermissionWithGrantedProviders(name, false)); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,18 +1,17 @@ |
|||
using System.Collections.Generic; |
|||
using Volo.Abp.Collections; |
|||
|
|||
namespace Volo.Abp.PermissionManagement |
|||
namespace Volo.Abp.PermissionManagement; |
|||
|
|||
public class PermissionManagementOptions |
|||
{ |
|||
public class PermissionManagementOptions |
|||
{ |
|||
public ITypeList<IPermissionManagementProvider> ManagementProviders { get; } |
|||
public ITypeList<IPermissionManagementProvider> ManagementProviders { get; } |
|||
|
|||
public Dictionary<string, string> ProviderPolicies { get; } |
|||
public Dictionary<string, string> ProviderPolicies { get; } |
|||
|
|||
public PermissionManagementOptions() |
|||
{ |
|||
ManagementProviders = new TypeList<IPermissionManagementProvider>(); |
|||
ProviderPolicies = new Dictionary<string, string>(); |
|||
} |
|||
public PermissionManagementOptions() |
|||
{ |
|||
ManagementProviders = new TypeList<IPermissionManagementProvider>(); |
|||
ProviderPolicies = new Dictionary<string, string>(); |
|||
} |
|||
} |
|||
|
|||
@ -1,19 +1,18 @@ |
|||
using JetBrains.Annotations; |
|||
|
|||
namespace Volo.Abp.PermissionManagement |
|||
namespace Volo.Abp.PermissionManagement; |
|||
|
|||
public class PermissionValueProviderGrantInfo //TODO: Rename to PermissionGrantInfo
|
|||
{ |
|||
public class PermissionValueProviderGrantInfo //TODO: Rename to PermissionGrantInfo
|
|||
{ |
|||
public static PermissionValueProviderGrantInfo NonGranted { get; } = new PermissionValueProviderGrantInfo(false); |
|||
public static PermissionValueProviderGrantInfo NonGranted { get; } = new PermissionValueProviderGrantInfo(false); |
|||
|
|||
public virtual bool IsGranted { get; } |
|||
public virtual bool IsGranted { get; } |
|||
|
|||
public virtual string ProviderKey { get; } |
|||
public virtual string ProviderKey { get; } |
|||
|
|||
public PermissionValueProviderGrantInfo(bool isGranted, [CanBeNull] string providerKey = null) |
|||
{ |
|||
IsGranted = isGranted; |
|||
ProviderKey = providerKey; |
|||
} |
|||
public PermissionValueProviderGrantInfo(bool isGranted, [CanBeNull] string providerKey = null) |
|||
{ |
|||
IsGranted = isGranted; |
|||
ProviderKey = providerKey; |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,20 +1,19 @@ |
|||
using JetBrains.Annotations; |
|||
|
|||
namespace Volo.Abp.PermissionManagement |
|||
namespace Volo.Abp.PermissionManagement; |
|||
|
|||
public class PermissionValueProviderInfo |
|||
{ |
|||
public class PermissionValueProviderInfo |
|||
{ |
|||
public string Name { get; } |
|||
public string Name { get; } |
|||
|
|||
public string Key { get; } |
|||
|
|||
public PermissionValueProviderInfo([NotNull]string name, [NotNull]string key) |
|||
{ |
|||
Check.NotNull(name, nameof(name)); |
|||
Check.NotNull(key, nameof(key)); |
|||
public string Key { get; } |
|||
|
|||
public PermissionValueProviderInfo([NotNull] string name, [NotNull] string key) |
|||
{ |
|||
Check.NotNull(name, nameof(name)); |
|||
Check.NotNull(key, nameof(key)); |
|||
|
|||
Name = name; |
|||
Key = key; |
|||
} |
|||
Name = name; |
|||
Key = key; |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,24 +1,23 @@ |
|||
using System.Collections.Generic; |
|||
using JetBrains.Annotations; |
|||
|
|||
namespace Volo.Abp.PermissionManagement |
|||
namespace Volo.Abp.PermissionManagement; |
|||
|
|||
public class PermissionWithGrantedProviders |
|||
{ |
|||
public class PermissionWithGrantedProviders |
|||
{ |
|||
public string Name { get; } |
|||
public string Name { get; } |
|||
|
|||
public bool IsGranted { get; set; } |
|||
public bool IsGranted { get; set; } |
|||
|
|||
public List<PermissionValueProviderInfo> Providers { get; set; } |
|||
public List<PermissionValueProviderInfo> Providers { get; set; } |
|||
|
|||
public PermissionWithGrantedProviders([NotNull] string name, bool isGranted) |
|||
{ |
|||
Check.NotNull(name, nameof(name)); |
|||
public PermissionWithGrantedProviders([NotNull] string name, bool isGranted) |
|||
{ |
|||
Check.NotNull(name, nameof(name)); |
|||
|
|||
Name = name; |
|||
IsGranted = isGranted; |
|||
Name = name; |
|||
IsGranted = isGranted; |
|||
|
|||
Providers = new List<PermissionValueProviderInfo>(); |
|||
} |
|||
Providers = new List<PermissionValueProviderInfo>(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,8 +1,7 @@ |
|||
// This file is part of PermissionsClientProxy, you can customize it here
|
|||
// ReSharper disable once CheckNamespace
|
|||
namespace Volo.Abp.PermissionManagement.ClientProxies |
|||
namespace Volo.Abp.PermissionManagement.ClientProxies; |
|||
|
|||
public partial class PermissionsClientProxy |
|||
{ |
|||
public partial class PermissionsClientProxy |
|||
{ |
|||
} |
|||
} |
|||
|
|||
@ -1,18 +1,17 @@ |
|||
using Volo.Abp.MongoDB; |
|||
|
|||
namespace Volo.Abp.PermissionManagement.MongoDB |
|||
namespace Volo.Abp.PermissionManagement.MongoDB; |
|||
|
|||
public static class AbpPermissionManagementMongoDbContextExtensions |
|||
{ |
|||
public static class AbpPermissionManagementMongoDbContextExtensions |
|||
public static void ConfigurePermissionManagement( |
|||
this IMongoModelBuilder builder) |
|||
{ |
|||
public static void ConfigurePermissionManagement( |
|||
this IMongoModelBuilder builder) |
|||
{ |
|||
Check.NotNull(builder, nameof(builder)); |
|||
Check.NotNull(builder, nameof(builder)); |
|||
|
|||
builder.Entity<PermissionGrant>(b => |
|||
{ |
|||
b.CollectionName = AbpPermissionManagementDbProperties.DbTablePrefix + "PermissionGrants"; |
|||
}); |
|||
} |
|||
builder.Entity<PermissionGrant>(b => |
|||
{ |
|||
b.CollectionName = AbpPermissionManagementDbProperties.DbTablePrefix + "PermissionGrants"; |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,11 +1,10 @@ |
|||
namespace Volo.Abp.PermissionManagement.Web.Utils |
|||
namespace Volo.Abp.PermissionManagement.Web.Utils; |
|||
|
|||
public interface IFlatTreeItem |
|||
{ |
|||
public interface IFlatTreeItem |
|||
{ |
|||
string Name { get; } |
|||
string Name { get; } |
|||
|
|||
string ParentName { get; } |
|||
string ParentName { get; } |
|||
|
|||
int Depth { get; set; } |
|||
} |
|||
} |
|||
int Depth { get; set; } |
|||
} |
|||
|
|||
@ -1,16 +1,15 @@ |
|||
using Shouldly; |
|||
using Xunit; |
|||
|
|||
namespace Volo.Abp.PermissionManagement |
|||
namespace Volo.Abp.PermissionManagement; |
|||
|
|||
public class PermissionGrantCacheItem_Tests |
|||
{ |
|||
public class PermissionGrantCacheItem_Tests |
|||
[Fact] |
|||
public void GetPermissionNameFormCacheKeyOrNull() |
|||
{ |
|||
[Fact] |
|||
public void GetPermissionNameFormCacheKeyOrNull() |
|||
{ |
|||
var key = PermissionGrantCacheItem.CalculateCacheKey("aaa", "bbb", "ccc"); |
|||
PermissionGrantCacheItem.GetPermissionNameFormCacheKeyOrNull(key).ShouldBe("aaa"); |
|||
PermissionGrantCacheItem.GetPermissionNameFormCacheKeyOrNull("aaabbbccc").ShouldBeNull(); |
|||
} |
|||
var key = PermissionGrantCacheItem.CalculateCacheKey("aaa", "bbb", "ccc"); |
|||
PermissionGrantCacheItem.GetPermissionNameFormCacheKeyOrNull(key).ShouldBe("aaa"); |
|||
PermissionGrantCacheItem.GetPermissionNameFormCacheKeyOrNull("aaabbbccc").ShouldBeNull(); |
|||
} |
|||
} |
|||
|
|||
@ -1,24 +1,23 @@ |
|||
using System; |
|||
using Volo.Abp.PermissionManagement.EntityFrameworkCore; |
|||
|
|||
namespace Volo.Abp.PermissionManagement |
|||
namespace Volo.Abp.PermissionManagement; |
|||
|
|||
public abstract class PermissionTestBase : PermissionManagementTestBase<AbpPermissionManagementTestModule> |
|||
{ |
|||
public abstract class PermissionTestBase : PermissionManagementTestBase<AbpPermissionManagementTestModule> |
|||
protected virtual void UsingDbContext(Action<IPermissionManagementDbContext> action) |
|||
{ |
|||
protected virtual void UsingDbContext(Action<IPermissionManagementDbContext> action) |
|||
using (var dbContext = GetRequiredService<IPermissionManagementDbContext>()) |
|||
{ |
|||
using (var dbContext = GetRequiredService<IPermissionManagementDbContext>()) |
|||
{ |
|||
action.Invoke(dbContext); |
|||
} |
|||
action.Invoke(dbContext); |
|||
} |
|||
} |
|||
|
|||
protected virtual T UsingDbContext<T>(Func<IPermissionManagementDbContext, T> action) |
|||
protected virtual T UsingDbContext<T>(Func<IPermissionManagementDbContext, T> action) |
|||
{ |
|||
using (var dbContext = GetRequiredService<IPermissionManagementDbContext>()) |
|||
{ |
|||
using (var dbContext = GetRequiredService<IPermissionManagementDbContext>()) |
|||
{ |
|||
return action.Invoke(dbContext); |
|||
} |
|||
return action.Invoke(dbContext); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,7 +1,6 @@ |
|||
namespace Volo.Abp.PermissionManagement.EntityFrameworkCore |
|||
namespace Volo.Abp.PermissionManagement.EntityFrameworkCore; |
|||
|
|||
public class PermissionGrantRepository_Tests : PermissionGrantRepository_Tests<AbpPermissionManagementEntityFrameworkCoreTestModule> |
|||
{ |
|||
public class PermissionGrantRepository_Tests : PermissionGrantRepository_Tests<AbpPermissionManagementEntityFrameworkCoreTestModule> |
|||
{ |
|||
|
|||
} |
|||
} |
|||
|
|||
@ -1,22 +1,21 @@ |
|||
using System; |
|||
using Mongo2Go; |
|||
|
|||
namespace Volo.Abp.PermissionManagement.MongoDB |
|||
namespace Volo.Abp.PermissionManagement.MongoDB; |
|||
|
|||
public class MongoDbFixture : IDisposable |
|||
{ |
|||
public class MongoDbFixture : IDisposable |
|||
{ |
|||
private static readonly MongoDbRunner MongoDbRunner; |
|||
public static readonly string ConnectionString; |
|||
private static readonly MongoDbRunner MongoDbRunner; |
|||
public static readonly string ConnectionString; |
|||
|
|||
static MongoDbFixture() |
|||
{ |
|||
MongoDbRunner = MongoDbRunner.Start(singleNodeReplSet: true, singleNodeReplSetWaitTimeout: 20); |
|||
ConnectionString = MongoDbRunner.ConnectionString; |
|||
} |
|||
static MongoDbFixture() |
|||
{ |
|||
MongoDbRunner = MongoDbRunner.Start(singleNodeReplSet: true, singleNodeReplSetWaitTimeout: 20); |
|||
ConnectionString = MongoDbRunner.ConnectionString; |
|||
} |
|||
|
|||
public void Dispose() |
|||
{ |
|||
MongoDbRunner?.Dispose(); |
|||
} |
|||
public void Dispose() |
|||
{ |
|||
MongoDbRunner?.Dispose(); |
|||
} |
|||
} |
|||
|
|||
@ -1,10 +1,9 @@ |
|||
using Xunit; |
|||
|
|||
namespace Volo.Abp.PermissionManagement.MongoDB |
|||
namespace Volo.Abp.PermissionManagement.MongoDB; |
|||
|
|||
[CollectionDefinition(Name)] |
|||
public class MongoTestCollection : ICollectionFixture<MongoDbFixture> |
|||
{ |
|||
[CollectionDefinition(Name)] |
|||
public class MongoTestCollection : ICollectionFixture<MongoDbFixture> |
|||
{ |
|||
public const string Name = "MongoDB Collection"; |
|||
} |
|||
} |
|||
public const string Name = "MongoDB Collection"; |
|||
} |
|||
|
|||
@ -1,10 +1,9 @@ |
|||
using Xunit; |
|||
|
|||
namespace Volo.Abp.PermissionManagement.MongoDB |
|||
namespace Volo.Abp.PermissionManagement.MongoDB; |
|||
|
|||
[Collection(MongoTestCollection.Name)] |
|||
public class PermissionGrantRepository_Tests : PermissionGrantRepository_Tests<AbpPermissionManagementMongoDbTestModule> |
|||
{ |
|||
[Collection(MongoTestCollection.Name)] |
|||
public class PermissionGrantRepository_Tests : PermissionGrantRepository_Tests<AbpPermissionManagementMongoDbTestModule> |
|||
{ |
|||
|
|||
} |
|||
} |
|||
|
|||
@ -1,14 +1,13 @@ |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.Testing; |
|||
|
|||
namespace Volo.Abp.PermissionManagement |
|||
namespace Volo.Abp.PermissionManagement; |
|||
|
|||
public abstract class PermissionManagementTestBase<TStartupModule> : AbpIntegratedTest<TStartupModule> |
|||
where TStartupModule : IAbpModule |
|||
{ |
|||
public abstract class PermissionManagementTestBase<TStartupModule> : AbpIntegratedTest<TStartupModule> |
|||
where TStartupModule : IAbpModule |
|||
protected override void SetAbpApplicationCreationOptions(AbpApplicationCreationOptions options) |
|||
{ |
|||
protected override void SetAbpApplicationCreationOptions(AbpApplicationCreationOptions options) |
|||
{ |
|||
options.UseAutofac(); |
|||
} |
|||
options.UseAutofac(); |
|||
} |
|||
} |
|||
|
|||
@ -1,25 +1,24 @@ |
|||
using Volo.Abp.Authorization.Permissions; |
|||
using Volo.Abp.MultiTenancy; |
|||
|
|||
namespace Volo.Abp.PermissionManagement |
|||
namespace Volo.Abp.PermissionManagement; |
|||
|
|||
public class TestPermissionDefinitionProvider : PermissionDefinitionProvider |
|||
{ |
|||
public class TestPermissionDefinitionProvider : PermissionDefinitionProvider |
|||
public override void Define(IPermissionDefinitionContext context) |
|||
{ |
|||
public override void Define(IPermissionDefinitionContext context) |
|||
{ |
|||
var testGroup = context.AddGroup("TestGroup"); |
|||
var testGroup = context.AddGroup("TestGroup"); |
|||
|
|||
testGroup.AddPermission("MyPermission1"); |
|||
testGroup.AddPermission("MyDisabledPermission1", isEnabled: false); |
|||
testGroup.AddPermission("MyPermission1"); |
|||
testGroup.AddPermission("MyDisabledPermission1", isEnabled: false); |
|||
|
|||
var myPermission2 = testGroup.AddPermission("MyPermission2"); |
|||
myPermission2.AddChild("MyPermission2.ChildPermission1"); |
|||
var myPermission2 = testGroup.AddPermission("MyPermission2"); |
|||
myPermission2.AddChild("MyPermission2.ChildPermission1"); |
|||
|
|||
testGroup.AddPermission("MyPermission3", multiTenancySide: MultiTenancySides.Host); |
|||
testGroup.AddPermission("MyPermission3", multiTenancySide: MultiTenancySides.Host); |
|||
|
|||
testGroup.AddPermission("MyPermission4", multiTenancySide: MultiTenancySides.Host).WithProviders(UserPermissionValueProvider.ProviderName); |
|||
testGroup.AddPermission("MyPermission4", multiTenancySide: MultiTenancySides.Host).WithProviders(UserPermissionValueProvider.ProviderName); |
|||
|
|||
testGroup.AddPermission("MyPermission5").StateCheckers.Add(new TestRequireRolePermissionStateProvider("super-admin")); |
|||
} |
|||
testGroup.AddPermission("MyPermission5").StateCheckers.Add(new TestRequireRolePermissionStateProvider("super-admin")); |
|||
} |
|||
} |
|||
|
|||
Loading…
Reference in new issue