Skip to content

fix: resource permission definition bugs in cache and event notification#25017

Open
maliming wants to merge 7 commits intorel-10.1from
fix/resource-permission-definition-bugs
Open

fix: resource permission definition bugs in cache and event notification#25017
maliming wants to merge 7 commits intorel-10.1from
fix/resource-permission-definition-bugs

Conversation

@maliming
Copy link
Member

@maliming maliming commented Mar 4, 2026

Problem

  1. DynamicPermissionDefinitionStoreInMemoryCache.FillAsync never populated ResourcePermissionDefinitions, causing GetResourcePermissionOrNull and GetResourcePermissions to always return empty
  2. Resource permissions in FillAsync were missing Providers, StateCheckers, and ExtraProperties deserialization
  3. StaticPermissionSaver.UpdateChangedPermissionsAsync used newRecords instead of changedRecords for DynamicPermissionDefinitionsChangedEto

Solution

  • Populate ResourcePermissionDefinitions with full properties (Providers, StateCheckers, ExtraProperties) in FillAsync
  • Fix changedRecords reference in UpdateChangedPermissionsAsync
  • Add 4 regression tests for DynamicPermissionDefinitionStoreInMemoryCache

- Fix ResourcePermissionDefinitions not being populated in DynamicPermissionDefinitionStoreInMemoryCache.FillAsync, causing GetResourcePermissionOrNull and GetResourcePermissions to always return empty
- Fix StaticPermissionSaver incorrectly using newRecords instead of changedRecords when collecting changed permission names for event notification
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes two issues in the permission-management domain module that prevented dynamic resource permissions from being returned from the dynamic store cache and caused incorrect permission-name lists to be published in the DynamicPermissionDefinitionsChangedEto event when static permissions change.

Changes:

  • Populate ResourcePermissionDefinitions in DynamicPermissionDefinitionStoreInMemoryCache.FillAsync so dynamic resource permission queries return results.
  • Fix StaticPermissionSaver to collect changed permission names from changedRecords (not newRecords) for distributed event notification.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/StaticPermissionSaver.cs Fixes event payload to include updated permission names when records change.
modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/DynamicPermissionDefinitionStoreInMemoryCache.cs Ensures resource permission definitions are stored in-memory so dynamic resource permission lookups return non-empty results.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

@maliming maliming changed the title fix: fix resource permission definition bugs fix: resource permission definition bugs in cache and event notification Mar 4, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

yagmurcelk

This comment was marked as resolved.

@maliming maliming requested a review from oykuermann March 9, 2026 12:15
@abpframework abpframework deleted a comment from maliming Mar 9, 2026
@yagmurcelk yagmurcelk requested review from yagmurcelk and removed request for oykuermann March 9, 2026 13:34
yagmurcelk

This comment was marked as off-topic.

Copy link
Contributor

@yagmurcelk yagmurcelk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The permissions deletion process shows localization problems.

Image

@maliming
Copy link
Member Author

The permissions deletion process shows localization problems.

Please pull the latest changes.

Thanks.

@maliming maliming requested a review from yagmurcelk March 10, 2026 01:05
@codecov
Copy link

codecov bot commented Mar 10, 2026

Codecov Report

❌ Patch coverage is 7.10059% with 157 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.69%. Comparing base (19e1c47) to head (bacca3a).
⚠️ Report is 47 commits behind head on rel-10.1.

Files with missing lines Patch % Lines
...micPermissionDefinitionStoreInMemoryCache_Tests.cs 0.00% 151 Missing ⚠️
...t/DynamicPermissionDefinitionStoreInMemoryCache.cs 70.58% 3 Missing and 2 partials ⚠️
.../Abp/PermissionManagement/StaticPermissionSaver.cs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           rel-10.1   #25017      +/-   ##
============================================
+ Coverage     50.67%   50.69%   +0.01%     
============================================
  Files          3389     3390       +1     
  Lines        112024   112185     +161     
  Branches       8492     8493       +1     
============================================
+ Hits          56767    56869     +102     
- Misses        53524    53569      +45     
- Partials       1733     1747      +14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants