-
-
Notifications
You must be signed in to change notification settings - Fork 19
support using auth() in field defaults
#2
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
|
Caution Review failedThe pull request is closed. WalkthroughThis update introduces a new Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant CRUDHandler
participant DB
participant PolicyEvaluator
Client->>CRUDHandler: createManyAndReturn(args)
CRUDHandler->>DB: Insert multiple records (args.data)
DB-->>CRUDHandler: Inserted IDs
CRUDHandler->>DB: Query inserted records (by IDs, args.select/omit)
DB-->>CRUDHandler: Created records
CRUDHandler->>PolicyEvaluator: (if policy applies) Filter records
PolicyEvaluator-->>CRUDHandler: Filtered records
CRUDHandler-->>Client: Return created records
sequenceDiagram
participant PolicySystem
participant ExpressionEvaluator
participant AuthContext
PolicySystem->>ExpressionEvaluator: evaluate(expression, { auth })
ExpressionEvaluator->>AuthContext: Access auth() or auth().member
AuthContext-->>ExpressionEvaluator: Return auth value/member
ExpressionEvaluator-->>PolicySystem: Evaluation result (boolean/value)
Poem
Tip ⚡️ Faster reviews with caching
Enjoy the performance boost—your workflow just got faster. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (21)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 (
|
auth() in field defaultsauth() in field defaults
* feat: audit policy collection aliases provides a means to alias collections in @@Allow collections by extending the ast this allows for utilizing collections inside of @@Allow like: ``` memberships?[m, auth().memberships?[ tenantId == m.tenantId ... ] ] ``` * fix: code review comments + syntax fixes * refactor: extract collection predicate binding to its own language construct (#2) - adjusted language processing chain accordingly - fixed several issues in policy transformer/evaluator - more test cases * addressing PR comments --------- Co-authored-by: Yiming Cao <[email protected]> Co-authored-by: ymc9 <[email protected]>
Summary by CodeRabbit
New Features
createManyAndReturnoperation, allowing creation of multiple records with immediate return of the created entities and support for field selection and omission.auth()) as default values for fields, including nested member access.Bug Fixes
Documentation
Tests
createManyAndReturnand advanced authorization scenarios, including field-level and relation-based policies.Refactor
Chores