The default: owner only
If none of a user’s roles has an allow policy on a collection, the user sees only records they created.Policy types
field_equals supports the operators =, !=, <>, >, >=, <, <=.
Allow and deny
Each policy has an effect:- allow: the record is visible if it matches at least one allow policy.
- deny: the record is hidden if it matches any deny policy. Deny wins.
Create a policy
1
Open the guard's policies
Authentication → Guards → your guard → Row policies → Create policy.
2
Pick the collection and type
For example
products, type field_equals.3
Configure it
Field
status, operator =, value published, effect allow.4
Attach roles
Choose which roles the policy applies to, for example
customer.Recipes
Users see only their own records
Users see only their own records
Nothing to configure: this is the default. Make it explicit with an allow
owner policy if you also add other allow policies.Everyone sees published content
Everyone sees published content
allow
field_equals status = published for role user on articles.Own drafts + all published
Own drafts + all published
Two allow policies on
articles: owner and field_equals status = published. A record matching either is visible.Team members see their team's projects
Team members see their team's projects
Add a
many_to_many relation between projects and users (members). Create an allow relation policy on projects using that relation.Hide archived records
Hide archived records
deny
field_equals archived = true. Applies on top of any allow policies.Admins see everything
Admins see everything
Run admin tools on your own server with a
platform key, which isn’t filtered by row policies. If admins must use an end_users key, give role admin an allow field_equals policy on a field every record has a value for, such as tenant = "acme".What users see
Row policies apply to
end_users keys. platform keys, hooks, and the dashboard aren’t filtered. Policies of type expression or custom aren’t supported and match nothing.