diff --git a/modules/permission-management/Volo.Abp.PermissionManagement.sln b/modules/permission-management/Volo.Abp.PermissionManagement.sln index 5812918a3c..e0fdd1e0ec 100644 --- a/modules/permission-management/Volo.Abp.PermissionManagement.sln +++ b/modules/permission-management/Volo.Abp.PermissionManagement.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.28729.10 +# Visual Studio 15 +VisualStudioVersion = 15.0.27428.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{B559B878-38F7-49CC-BC06-43A32D68C1A7}" EndProject @@ -29,11 +29,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.PermissionManageme EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.PermissionManagement.MongoDB.Tests", "test\Volo.Abp.PermissionManagement.MongoDB.Tests\Volo.Abp.PermissionManagement.MongoDB.Tests.csproj", "{AFA65E08-1F17-4BBE-96A6-80F3CFE22A75}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.PermissionManagement.HttpApi", "src\Volo.Abp.PermissionManagement.HttpApi\Volo.Abp.PermissionManagement.HttpApi.csproj", "{9E0B517E-F02E-436F-9695-7CF12795D34C}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.PermissionManagement.HttpApi", "src\Volo.Abp.PermissionManagement.HttpApi\Volo.Abp.PermissionManagement.HttpApi.csproj", "{9E0B517E-F02E-436F-9695-7CF12795D34C}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.PermissionManagement.HttpApi.Client", "src\Volo.Abp.PermissionManagement.HttpApi.Client\Volo.Abp.PermissionManagement.HttpApi.Client.csproj", "{1CD80519-9431-48DB-B0EA-291A73FF9F49}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.PermissionManagement.Application.Tests", "test\Volo.Abp.PermissionManagement.Application.Tests\Volo.Abp.PermissionManagement.Application.Tests.csproj", "{A0F72F5F-3713-4E06-ADB7-15ADFDCB79B1}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.PermissionManagement.HttpApi.Client", "src\Volo.Abp.PermissionManagement.HttpApi.Client\Volo.Abp.PermissionManagement.HttpApi.Client.csproj", "{1CD80519-9431-48DB-B0EA-291A73FF9F49}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -93,10 +91,6 @@ Global {1CD80519-9431-48DB-B0EA-291A73FF9F49}.Debug|Any CPU.Build.0 = Debug|Any CPU {1CD80519-9431-48DB-B0EA-291A73FF9F49}.Release|Any CPU.ActiveCfg = Release|Any CPU {1CD80519-9431-48DB-B0EA-291A73FF9F49}.Release|Any CPU.Build.0 = Release|Any CPU - {A0F72F5F-3713-4E06-ADB7-15ADFDCB79B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A0F72F5F-3713-4E06-ADB7-15ADFDCB79B1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A0F72F5F-3713-4E06-ADB7-15ADFDCB79B1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A0F72F5F-3713-4E06-ADB7-15ADFDCB79B1}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -115,7 +109,6 @@ Global {AFA65E08-1F17-4BBE-96A6-80F3CFE22A75} = {63DA4A89-5908-4F37-B7E6-525AEEF20C77} {9E0B517E-F02E-436F-9695-7CF12795D34C} = {B559B878-38F7-49CC-BC06-43A32D68C1A7} {1CD80519-9431-48DB-B0EA-291A73FF9F49} = {B559B878-38F7-49CC-BC06-43A32D68C1A7} - {A0F72F5F-3713-4E06-ADB7-15ADFDCB79B1} = {63DA4A89-5908-4F37-B7E6-525AEEF20C77} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {8FC7DF78-5E2D-489F-9D43-147D2ABAA112} diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo.Abp.PermissionManagement.Application.Tests.csproj b/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo.Abp.PermissionManagement.Application.Tests.csproj deleted file mode 100644 index 7e817abf24..0000000000 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo.Abp.PermissionManagement.Application.Tests.csproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - netcoreapp2.2 - - false - - - - - - - - - - - - diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo/Abp/PermissionManagement/AbpPermissionManagementApplicationTestBase.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo/Abp/PermissionManagement/AbpPermissionManagementApplicationTestBase.cs deleted file mode 100644 index 7102b8f851..0000000000 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo/Abp/PermissionManagement/AbpPermissionManagementApplicationTestBase.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Microsoft.Extensions.DependencyInjection; -using NSubstitute; -using Volo.Abp.Users; - -namespace Volo.Abp.PermissionManagement -{ - public class AbpPermissionManagementApplicationTestBase : PermissionManagementTestBase - { - protected Guid? CurrentUserId { get; set; } - - protected AbpPermissionManagementApplicationTestBase() - { - CurrentUserId = Guid.NewGuid(); - } - protected override void AfterAddApplication(IServiceCollection services) - { - var currentUser = Substitute.For(); - //currentUser.Id.Returns(ci => CurrentUserId); - currentUser.IsAuthenticated.Returns(true); - - services.AddSingleton(currentUser); - } - } -} diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo/Abp/PermissionManagement/AbpPermissionManagementApplicationTestModule.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo/Abp/PermissionManagement/AbpPermissionManagementApplicationTestModule.cs deleted file mode 100644 index 9028e64866..0000000000 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo/Abp/PermissionManagement/AbpPermissionManagementApplicationTestModule.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.Authorization.Permissions; -using Volo.Abp.Modularity; - -namespace Volo.Abp.PermissionManagement -{ - [DependsOn( - typeof(AbpPermissionManagementApplicationModule), - typeof(AbpPermissionManagementTestModule) - )] - public class AbpPermissionManagementApplicationTestModule : AbpModule - { - public override void ConfigureServices(ServiceConfigurationContext context) - { - context.Services.AddAlwaysAllowAuthorization(); - - context.Services.Configure(options => - { - options.ProviderPolicies["Test"] = "Test"; - options.ManagementProviders.Add(); - - }); - } - } -} diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo/Abp/PermissionManagement/PermissionAppService_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo/Abp/PermissionManagement/PermissionAppService_Tests.cs deleted file mode 100644 index 4a2ced5e16..0000000000 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo/Abp/PermissionManagement/PermissionAppService_Tests.cs +++ /dev/null @@ -1,96 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Shouldly; -using Volo.Abp.Authorization.Permissions; -using Xunit; - -namespace Volo.Abp.PermissionManagement.Application.Tests.Volo.Abp.PermissionManagement -{ - public class PermissionAppService_Tests : AbpPermissionManagementApplicationTestBase - { - private readonly IPermissionAppService _permissionAppService; - private readonly IPermissionGrantRepository _permissionGrantRepository; - - public PermissionAppService_Tests() - { - _permissionAppService = GetRequiredService(); - _permissionGrantRepository = GetRequiredService(); - } - - [Fact] - public async Task GetAsync() - { - var permissionListResultDto = await _permissionAppService.GetAsync(UserPermissionValueProvider.ProviderName, - PermissionTestDataBuilder.User1Id.ToString()); - - permissionListResultDto.ShouldNotBeNull(); - permissionListResultDto.EntityDisplayName.ShouldBe(PermissionTestDataBuilder.User1Id.ToString()); - permissionListResultDto.Groups.Count.ShouldBe(1); - permissionListResultDto.Groups.ShouldContain(x => x.Name == "TestGroup"); - - permissionListResultDto.Groups.First().Permissions.Count.ShouldBe(4); - permissionListResultDto.Groups.First().Permissions.ShouldContain(x => x.Name == "MyPermission1"); - permissionListResultDto.Groups.First().Permissions.ShouldContain(x => x.Name == "MyPermission2"); - permissionListResultDto.Groups.First().Permissions.ShouldContain(x => x.Name == "MyPermission2.ChildPermission1"); - permissionListResultDto.Groups.First().Permissions.ShouldContain(x => x.Name == "MyPermission3"); - - } - - [Fact] - public async Task UpdateAsync() - { - (await _permissionGrantRepository.FindAsync("MyPermission1", "Test", - PermissionTestDataBuilder.User1Id.ToString())).ShouldBeNull(); - - await _permissionAppService.UpdateAsync("Test", - PermissionTestDataBuilder.User1Id.ToString(), new UpdatePermissionsDto() - { - Permissions = new UpdatePermissionDto[] - { - new UpdatePermissionDto() - { - IsGranted = true, - Name = "MyPermission1" - } - } - }); - - (await _permissionGrantRepository.FindAsync("MyPermission1", "Test", - PermissionTestDataBuilder.User1Id.ToString())).ShouldNotBeNull(); - } - - [Fact] - public async Task Update_Revoke_Test() - { - _permissionGrantRepository.Insert( - new PermissionGrant( - Guid.NewGuid(), - "MyPermission1", - "Test", - PermissionTestDataBuilder.User1Id.ToString() - ) - ); - (await _permissionGrantRepository.FindAsync("MyPermission1", "Test", - PermissionTestDataBuilder.User1Id.ToString())).ShouldNotBeNull(); - - await _permissionAppService.UpdateAsync("Test", - PermissionTestDataBuilder.User1Id.ToString(), new UpdatePermissionsDto() - { - Permissions = new UpdatePermissionDto[] - { - new UpdatePermissionDto() - { - IsGranted = false, - Name = "MyPermission1" - } - } - }); - - (await _permissionGrantRepository.FindAsync("MyPermission1", "Test", - PermissionTestDataBuilder.User1Id.ToString())).ShouldBeNull(); - } - } -} diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/TestPermissionManagementProvider.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/TestPermissionManagementProvider.cs deleted file mode 100644 index f66ed2995d..0000000000 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/TestPermissionManagementProvider.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Volo.Abp.Guids; -using Volo.Abp.MultiTenancy; - -namespace Volo.Abp.PermissionManagement -{ - public class TestPermissionManagementProvider : PermissionManagementProvider - { - public override string Name => "Test"; - - public TestPermissionManagementProvider( - IPermissionGrantRepository permissionGrantRepository, - IGuidGenerator guidGenerator, - ICurrentTenant currentTenant) - : base( - permissionGrantRepository, - guidGenerator, - currentTenant) - { - - } - } -}