Protect record actions
Choose allowed actions using actor and admin permissions.
Permissions are written with allow rules. A post action is allowed only when every matching permission expression resolves to a truthy value.
Rule input (JSON)
Use a complete version 2 rule file. Select a post with “postType” and “action”, or an “endpoint” by name. Saved data, jobs, payments and email need the local server. Dedupe replay protection also needs a site.
Check complete rules or run schemas, permissions, hooks and calculations against the input above. Add excerpts to a complete rule before running.
If an action does not have an allow rule, the action is denied.
Actions
| Action | When it runs |
|---|---|
create | A new post is being created. |
get | One post is being fetched. |
list | A collection of posts is being fetched. |
read | A grouped permission that applies to both get and list. |
edit | An existing post is being updated. |
delete | A post is being deleted. |
write | A grouped permission that applies to create, edit, and delete. |
Each concrete action can have a separate rule because safe single-post access is often different from safe list access. Use allow read: expression when the same expression should protect get and list, allow write: expression when the same expression should protect create, edit, and delete, or comma-separated actions such as allow create, edit: expression when a smaller group shares one rule.
Use comma-separated grouped actions when the same broad condition should cover every read and write action:
Rule excerpt: add this to a complete FRL rule before running it. Try a complete example →
Matching rules intersect. If a rule file declares allow read, write: ..., allow read: ..., and allow get: ..., a get request must pass all three matching rules.
allow list: decides whether a visitor may request a list. Use FQL where or filter to choose which rows appear in that list. Because allow read: also applies to list requests, allow read: and allow list: cannot use post-scoped values such as $post, $row, or $rowMeta. This also applies inside helper functions called from list permissions. Put single-post conditions in allow get: instead.
Runtime Values for Permissions
Permission expressions commonly use these variables:
| Variable | Use |
|---|---|
$post.current.data | The saved post data before the action. Useful for published/draft and owner checks. |
$post.current | Backend metadata for the saved post, such as id and author id. |
$post.pending.data | The submitted or merged data that will be saved. before create and before edit hooks write here. |
$post.pending | Backend metadata for the pending write, including the generated id during create. |
$action | Metadata for the current operation. $action.where contains requested read filters, $action.payment names the current payment event, $action.isRead is true for get/list, and $action.isWrite is true for create/edit/delete. |
$actor | Current requester. Use $actor.id, $actor.email, $actor.name, $actor.data, $actor.wallet, $actor.isGuest, $actor.isSignedIn, $actor.isAdmin, $actor.isEndpoint, and $actor.endpoint when available. |
$admin | Content permission helpers for FRL-managed posts and profile data. |
$secret | Secret credentials referenced by FRL. fb-admin automatically creates Secret Keys fields for referenced keys. |
$page | Page settings from the site's page settings. |
$currency | Site currency config, including value, baseCurrency, and the selected support mode when configured. |
$context | Scratch values for the current rule run. Write it in before hooks, after hooks, endpoint bodies, and event blocks; read it in allow rules and helper functions. |
$local | Scratch values inside one fn call. Use it when a helper needs temporary values before returning a result. |
Admin Permission Helpers
Use $admin.canRead(...), $admin.canCreate(...), $admin.canEdit(...), and $admin.canDelete(...) when the current user must have site-admin permission for FRL-managed content.
Rule input (JSON)
Use a complete version 2 rule file. Select a post with “postType” and “action”, or an “endpoint” by name. Saved data, jobs, payments and email need the local server. Dedupe replay protection also needs a site.
Check complete rules or run schemas, permissions, hooks and calculations against the input above. Add excerpts to a complete rule before running.
Pass a post type for post-level permission, or a field path for field-level permission:
Rule excerpt: add this to a complete FRL rule before running it. Try a complete example →
Field checks inherit from broader permissions. For example, products.price.amount passes when the admin has permission for products.price or products. Array indexes are ignored, so products.images[0].url is checked like products.images.url.
Inside a post or user rule, $this means the current post type. For example, inside post products, $admin.canEdit("$this.name") is checked as products.name.
Calling a helper with no argument checks all-post permission for that action across FRL-managed content:
Rule excerpt: add this to a complete FRL rule before running it. Try a complete example →
That no-argument form is useful for broad admin dashboards. Prefer resource-specific checks when a rule protects one post type or one sensitive field.
Continue with Apply ownership rules.