SLang has a built-in security model based on Subjects, Permissions, and Roles.Documentation Index
Fetch the complete documentation index at: https://docs.withsutro.com/llms.txt
Use this file to discover all available pages before exploring further.
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.
If a trigger omits the auth block entirely, the route is public and can be called without authentication.
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).
@subject.entity when you need the authenticated subject’s data row: