Role.create()
Create a role.
Description
This method adds a new role to the Role
collection and returns the
corresponding Role
. The maximum number of overlapping roles is 64. Attempts
to create the sixty-fifth overlapping role result in an error.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
data |
Yes |
Object describing the role. |
data fields
Name | Type | Required | Description |
---|---|---|---|
name |
Yes |
A unique name. |
|
privileges |
Yes |
One or more privilege configuration objects. |
|
membership |
One or more membership configuration objects. |
||
data |
User-defined metadata that stores supplemental information. |
Examples
{
name: "mgmtTeam",
coll: Role,
ts: Time("2023-07-27T21:59:03.480Z"),
privileges: [
{
resource: "CoffeeBean",
actions: {
read: true
}
},
{
resource: "Customers",
actions: {
create: true
}
}
],
membership: [
{
resource: "People"
}
],
data: {
custom: "some data"
}
}
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!