AccessProvider.where()
Learn: Access providers |
---|
Get a Set of access providers that match a provided predicate.
Signature
AccessProvider.where( predicate: () => Boolean)) => Set<AccessProvider>
AccessProvider.where( predicate: (val: AccessProvider) => Boolean)) => Set<AccessProvider>
Description
Each provider in a Fauna database is represented by a AccessProvider
document. AccessProvider.where()
gets the Set of accessible providers that
match the predicate function.
If AccessProvider.where()
is the last value in a query, the first page of the
Set is returned.
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 |
---|---|---|---|
predicate |
An anonymous function that compares values in each provider and returns
|
Return value
One of:
Type | Description |
---|---|
Set representing the access providers that match the predicate function. |
|
No matches found. Returns an empty Set. |
Examples
AccessProvider.where((.issuer.includes("example.com")))
{
data: [
{
name: "someIssuer",
coll: AccessProvider,
ts: Time("2099-06-25T13:15:14.165Z"),
jwks_uri: "https://example.com/.well-known/jwks.json",
issuer: "https://example.com/",
audience: "https://db.fauna.com/db/ysjons5xryyr4",
roles: [
"customer",
{
role: "manager",
predicate: "(jwt) => jwt!.scope.includes(\"manager\")"
}
],
},
...
]
}
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!