Model Permissions
To limit what data in a model is available to a role, you define a ModelPermissions
object with a filter
expression.
By default, whenever a new model is created in your metadata, all records are only accessible to the admin
role. You
can think of these as permissions on rows in a typical relational database table.
You can restrict access to certain data by adding a new item to the permissions
array in the ModelPermissions
object. Each item in the array should have a role
field and a select
field. The select
field should contain a
filter
expression that determines which rows are accessible to the role when selecting from the model.
Most commonly, you'll use session variables — accessed by the query engine via your configured authentication mechanism in a JWT or body of a webhook response — to restrict access to rows based on the user's role, identity or other criteria.
This filter expression can reference
- The fields in your Model
- Logical operators:
and
,or
andnot
fieldIsNull
predicatefieldComparison
predicate- Relationship predicates
null
Remote relationships (relationships between different data connectors) across subgraphs are not supported in permission filters.
To make a new ModelPermission
or role available in your application, after updating your metadata, you'll need to
create a new build using the CLI.