-
-
Notifications
You must be signed in to change notification settings - Fork 120
feat: extend policy size limit from 12 to 14 parameters #388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: extend policy size limit from 12 to 14 parameters #388
Conversation
There was a problem hiding this 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 extends the policy size limit from 12 to 14 parameters in the Casbin.NET library to address issue #358. The changes systematically add support for two additional parameter positions (Value13 and Value14) across all relevant data structures and operations.
Key changes include:
- Updated field index validation limits from 12 to 14 in policy filtering logic
- Added new Value13 and Value14 properties to persistence interfaces and implementations
- Extended generic type support with new RequestValues and PolicyValues variants for 13 and 14 parameters
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
Casbin/Persist/PolicyFilter.cs | Updated field index limits and added filtering logic for Value13 and Value14 |
Casbin/Persist/PersistantPolicy.cs | Added Value13/Value14 properties and cases for 13/14 parameter creation |
Casbin/Model/RequestValues.cs | Added RequestValues structs for 13 and 14 generic parameters with indexer fixes |
Casbin/Model/Request.cs | Extended generic support limit and added factory methods for 13/14 parameters |
Casbin/Model/PolicyValues.cs | Added PolicyValues records for 13 and 14 parameters |
Casbin/Model/Policy.cs | Updated support limits and added factory methods for 13/14 parameter policies |
Casbin/Extensions/Enforcer/EnforcerExtension.GenericEnforce.cs | Added complete enforcement method sets for 13 and 14 generic parameters |
Casbin/Enforcer.Internal.cs | Added internal enforcement cases for 13 and 14 parameter policies |
Casbin/Abstractions/Persist/IReadOnlyPersistPolicy.cs | Added Value13 and Value14 properties to interface |
Casbin/Abstractions/Persist/IPersistPolicy.cs | Added Value13 and Value14 properties to interface |
Casbin.UnitTests/GenericTests/SupportCountTest.cs | Updated test loop limit and added test case for 14 parameters |
Casbin.UnitTests/Examples/support_count_model.conf | Added r14/p14/m14 definitions and updated comments |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
if (fieldIndex <= 10 && lastIndex >= 10) | ||
{ | ||
string field = values[5 - fieldIndex]; | ||
string field = values[10 - fieldIndex]; |
Copilot
AI
Sep 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The array index calculation appears incorrect. For fieldIndex 10 and lastIndex 10, this calculates values[0], but it should access values[10] to get the 11th value (Value11). The formula should be values[fieldIndex]
not values[10 - fieldIndex]
.
Copilot uses AI. Check for mistakes.
} | ||
|
||
if (lastIndex is 11) // and fieldIndex <= 11 | ||
if (fieldIndex <= 11 && lastIndex >= 11) |
Copilot
AI
Sep 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This condition change from lastIndex is 11
to fieldIndex <= 11 && lastIndex >= 11
is inconsistent with the pattern used in other field checks. The original pattern lastIndex is 11
was more specific and should be maintained for consistency, or all other conditions should be updated to match this new pattern.
if (fieldIndex <= 11 && lastIndex >= 11) | |
if (lastIndex == 11) |
Copilot uses AI. Check for mistakes.
🎉 This PR is included in version 2.16.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Fix: #358