Role.byName()

Get a role by its name.

Signature

Role.byName(name: string): Role | NullRole

Description

Returns a Role for the given name.

Parameters

Parameter Type Required Description

name

String

Yes

Name of the Role.

Return value

One of:

Type Description

Role

A Role for the role.

NullRole

Document is non-existent or is inaccessible. See NullDoc.

Examples

Role.byName("humanResources")
{
  name: "humanResources",
  coll: Role,
  ts: Time("2023-07-21T00:22:25.260Z"),
  privileges: {
    resource: "People",
    actions: {
      read: true,
      create: "data => data.status == \'active\' "
    }
  }
}

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!