Role document definition
Learn: Roles |
---|
We recommend you use FSL to create and update user-defined roles. See Role schema. |
A role document definition is an FQL version of an FSL role schema.
{
name: "customer",
coll: Role,
ts: Time("2099-06-18T13:23:02.780Z"),
privileges: [
{
resource: "Store",
actions: {
read: true
}
},
{
resource: "Product",
actions: {
read: true
}
},
{
resource: "Order",
actions: {
read: "(ref) => Query.identity() == ref.customer"
}
},
{
resource: "Customer",
actions: {
read: "(ref) => Query.identity() == ref"
}
},
{
resource: "submitOrder",
actions: {
call: "(customer, _) => Query.identity() == customer"
}
},
{
resource: "inventory",
actions: {
call: "(name) => true"
}
}
],
membership: [
{
resource: "Customer"
}
]
}
Fields
Field name | Value type | Description |
---|---|---|
|
(required) Unique name for the role in the database. +
Must begin with a letter. Can only include letters, numbers, and underscores.
|
|
|
(optional) Assigns the role to tokens based on the token’s identity document. See Membership definition. |
|
|
(optional) Allows one or more actions on a resource. See Privileges definition. |
|
|
The |
|
|
Timestamp of the most recent document write. |
|
|
(optional) Arbitrary user-defined metadata. |
Is this article helpful?
Tell Fauna how the article can be improved:
Visit Fauna's forums
or email docs@fauna.com
Thank you for your feedback!