Defining permissions
Permissions are defined on relationships between a resource (e.g.,Clinic) and a user link (e.g., Membership).
Membership entity will dictate access to Clinic resources.
Enforcing auth
Theauth block in a Trigger acts as a firewall. Logic is not executed unless the condition passes.
Permission checks
Check if the authenticated user (@subject) has a specific permission.
Role checks
You can also check for specific roles directly, though permissions are preferred for flexibility.Complex logic
Auth rules can be combined withand / or.
The @subject
The keyword @subject refers to the currently authenticated user (derived from the Bearer token or session). It is available in:
- Triggers: For
authchecks. - Actions: To assign ownership (e.g.,
Owner := @subject).