Role.all()
Learn: Roles |
---|
Get a Set of all user-defined roles.
Signature
Role.all() => Set<Role>
Role.all(range: { from: Any } | { to: Any } | { from: Any, to: Any }) => Set<Role>
Description
Gets a Set containing all user-defined roles,
represented as Role
documents, for the
database. To limit the returned Set, you can provide an optional range.
Role
documents are FQL versions of a database’s FSL
role schema. See Roles.
If this method is the last expression in a query, the first page of the Set is returned. See Pagination.
Staged schema
If a database has staged schema, this method interacts with the database’s staged schema, not the active schema.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
range |
|
Specifies a range of The Set only includes documents in this range (inclusive). Omit If a range is omitted, all roles are returned. |
Range parameters
Name | Type | Required | Description |
---|---|---|---|
|
Beginning of the range (inclusive). Must be an
|
||
|
End of the range (inclusive). Must be an
|
Return value
Type | Description |
---|---|
Set of The Set is empty if:
|
Examples
Range examples
-
Get all roles for the database:
Role.all()
{ data: [ { name: "manager", coll: Role, ts: Time("2099-10-28T16:14:20.640Z"), privileges: [ ... ], membership: [ ... ] }, { name: "customer", coll: Role, ts: Time("2099-10-28T16:14:20.640Z"), privileges: [ ... ], membership: [ ... ] } ] }
-
Given the previous Set, get all roles starting with
manager
(inclusive):Role.all({ from: Role.byName("manager") })
{ data: [ { name: "manager", coll: Role, ts: Time("2099-10-28T16:14:20.640Z"), privileges: [ ... ], membership: [ ... ] }, { name: "customer", coll: Role, ts: Time("2099-10-28T16:14:20.640Z"), privileges: [ ... ], membership: [ ... ] } ] }
-
Get a Set of roles from
manager
(inclusive) tocustomer
(inclusive):Role.all({ from: Role.byName("manager"), to: Role.byName("customer") })
{ data: [ { name: "manager", coll: Role, ts: Time("2099-10-28T16:14:20.640Z"), privileges: [ ... ], membership: [ ... ] }, { name: "customer", coll: Role, ts: Time("2099-10-28T16:14:20.640Z"), privileges: [ ... ], membership: [ ... ] } ] }
-
Get a Set of roles up to
customer
(inclusive):Role.all({ to: Role.byName("customer") })
{ data: [ { name: "manager", coll: Role, ts: Time("2099-10-28T16:14:20.640Z"), privileges: [ ... ], membership: [ ... ] }, { name: "customer", coll: Role, ts: Time("2099-10-28T16:14:20.640Z"), privileges: [ ... ], membership: [ ... ] } ] }