mirror of https://github.com/abpframework/abp.git
11 changed files with 59 additions and 17 deletions
@ -0,0 +1,13 @@ |
|||
using Microsoft.Extensions.DependencyInjection.Extensions; |
|||
using Volo.Abp.Authorization.Permissions; |
|||
|
|||
namespace Microsoft.Extensions.DependencyInjection |
|||
{ |
|||
public static class AbpAuthorizationServiceCollectionExtensions |
|||
{ |
|||
public static IServiceCollection AddAlwaysAllowPermissionChecker(this IServiceCollection services) |
|||
{ |
|||
return services.Replace(ServiceDescriptor.Singleton<IPermissionChecker, AlwaysAllowPermissionChecker>()); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Volo.Abp.Authorization.Permissions |
|||
{ |
|||
/// <summary>
|
|||
/// Always allows for any permission.
|
|||
///
|
|||
/// Use IServiceCollection.AddAlwaysAllowPermissionChecker() to replace
|
|||
/// IPermissionChecker with this class. This is useful for tests.
|
|||
/// </summary>
|
|||
public class AlwaysAllowPermissionChecker : IPermissionChecker |
|||
{ |
|||
public Task<PermissionGrantInfo> CheckAsync(string name) |
|||
{ |
|||
return Task.FromResult(new PermissionGrantInfo(name, true, "AlwaysAllow")); |
|||
} |
|||
} |
|||
} |
|||
@ -1,9 +0,0 @@ |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace Volo.Abp.TestBase |
|||
{ |
|||
public class AbpTestBaseModule : AbpModule |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace Volo.Abp |
|||
{ |
|||
public class AbpTestBaseModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(IServiceCollection services) |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
@ -1,7 +1,7 @@ |
|||
using System; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
|
|||
namespace Volo.Abp.TestBase |
|||
namespace Volo.Abp |
|||
{ |
|||
public abstract class AbpTestBaseWithServiceProvider |
|||
{ |
|||
Loading…
Reference in new issue