Browse Source

Skip the permission update when the modal posts no change

- Assert that no per-permission state check runs in the batched read test
pull/26127/head
maliming 1 day ago
parent
commit
a7bf816669
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 5
      modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml.cs
  2. 1
      modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/PermissionManager_Tests.cs

5
modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml.cs

@ -110,6 +110,11 @@ public class PermissionManagementModal : AbpPageModel
})
.ToArray();
if (updatePermissionDtos.IsNullOrEmpty())
{
return NoContent();
}
await PermissionAppService.UpdateAsync(
ProviderName,
ProviderKey,

1
modules/permission-management/test/Volo.Abp.PermissionManagement.Domain.Tests/Volo/Abp/PermissionManagement/PermissionManager_Tests.cs

@ -98,6 +98,7 @@ public class PermissionManager_Tests : PermissionTestBase
_stateCheckerCounter.Reset();
var grantedProviders = await _permissionManager.GetAsync(names, "Test", "Test");
_stateCheckerCounter.BatchCheckCount.ShouldBe(1);
_stateCheckerCounter.SingleCheckCount.ShouldBe(0);
grantedProviders.Result.Single(x => x.Name == "MyPermission1").IsGranted.ShouldBeTrue();
grantedProviders.Result.Single(x => x.Name == "MyPermission5").IsGranted.ShouldBeFalse();

Loading…
Cancel
Save