Skip to content

feat: add LoadIncrementalFilteredPolicy() API for incremental filtered policy loading - #392

Merged
hsluoyz merged 4 commits into
masterfrom
copilot/fix-loading-filtered-policy
Nov 1, 2025
Merged

hsluoyz merged 4 commits into
masterfrom
copilot/fix-loading-filtered-policy

Conversation

Copilot AI commented Oct 31, 2025 •

Copy link
Copy Markdown
Contributor

Fix: #387

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@hsluoyz
hsluoyz marked this pull request as ready for review October 31, 2025 16:52
Copilot AI and others added 2 commits October 31, 2025 17:04
Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com>
Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix loading filtered policy to prevent overwriting Add LoadIncrementalFilteredPolicy for incremental filtered policy loading Oct 31, 2025
Copilot AI requested a review from hsluoyz October 31, 2025 17:19
@hsluoyz

hsluoyz commented Nov 1, 2025

Copy link
Copy Markdown
Member

@copilot for code and test code, need to refer to Golang Casbin as much as possible: apache/casbin#582

Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com>

Copilot AI commented Nov 1, 2025 •

Copy link
Copy Markdown
Contributor Author

@copilot for code and test code, need to refer to Golang Casbin as much as possible: apache/casbin#582

Refactored to match the Golang pattern from PR #582 (commit e7e7989):

Key changes to align with Golang architecture:

  • Removed separate adapter methods (LoadIncrementalFilteredPolicy from IFilteredAdapter)
  • Created shared internal method LoadFilteredPolicyInternal (similar to Golang's loadFilteredPolicy)
  • LoadFilteredPolicy now calls ClearPolicy() before loading (matches Golang's model.ClearPolicy())
  • LoadIncrementalFilteredPolicy directly calls the shared method without clearing
  • Both methods now use the same underlying logic, differing only in whether they clear first

This matches the pattern where Golang has one adapter method and the clearing happens at the enforcer/model level, not in the adapter.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/casbin/casbin/pulls/582/files
    • Triggering command: curl -s REDACTED (http block)

If you need me to access, download, or install something from one of these locations, you can either:

@hsluoyz hsluoyz closed this Nov 1, 2025
@hsluoyz hsluoyz reopened this Nov 1, 2025
@hsluoyz hsluoyz changed the title Add LoadIncrementalFilteredPolicy for incremental filtered policy loading feat: add LoadIncrementalFilteredPolicy() API for incremental filtered policy loading Nov 1, 2025
@hsluoyz
hsluoyz merged commit 67dd0a4 into master Nov 1, 2025
11 of 17 checks passed
@github-actions

github-actions Bot commented Nov 1, 2025

Copy link
Copy Markdown

🎉 This PR is included in version 2.19.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Loading filtered policy overwrites previous policies

3 participants