-
-
Notifications
You must be signed in to change notification settings - Fork 127
fix(delegate): update with "connect" is not properly rejected for polymorphic models #1675
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
Conversation
…ymorphic models Fixes #1674
WalkthroughWalkthroughThe changes introduce modifications to the Changes
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- packages/sdk/src/model-meta-generator.ts (1 hunks)
- tests/integration/tests/enhancements/with-delegate/policy-interaction.test.ts (1 hunks)
- tests/regression/tests/issue-1674.test.ts (1 hunks)
Additional comments not posted (6)
tests/regression/tests/issue-1674.test.ts (4)
1-1: Approved import statement.The import of
loadSchemafrom@zenstackhq/testtoolsis essential for setting up the test environment.
2-2: Clear and concise test suite setup.The test suite is appropriately named after the issue it addresses, enhancing traceability and clarity.
3-56: Well-structured test case setup.The asynchronous test case properly sets up the environment using
loadSchema, which is crucial for accurately testing the permissions and relations defined in the schema.
59-85: Test logic aligns well with PR objectives.The test effectively simulates the scenario described in the issue, where a
PostAinstance attempts to connect to aBlogwithout the necessary permissions. The use oftoBeRejectedByPolicyappropriately tests the enforcement of access control policies.tests/integration/tests/enhancements/with-delegate/policy-interaction.test.ts (1)
212-270: Comprehensive test case for policy interaction.The test case is well-structured and effectively tests the enforcement of policies during
connectoperations. The schema setup and the use oftoBeRejectedByPolicyandtoResolveTruthyassertions are appropriate for verifying that the policies are correctly applied based on user permissions.packages/sdk/src/model-meta-generator.ts (1)
301-302: Enhanced handling of polymorphic models ingetBackLink.The use of the nullish coalescing operator to determine the
sourceModelbased onfield.$inheritedFromis a robust solution for handling polymorphic scenarios. This ensures that the correct base model is used, which is crucial for maintaining the integrity of model relationships.
Fixes #1674