AccessProvider.firstWhere()
Get the first matching accessible AccessProvider.
Signature
Collection.firstWhere(predicate: () => Boolean)): AccessProvider | NullAccessProvider
Collection.firstWhere(predicate: (val: AccessProvider) => Boolean)): AccessProvider | NullAccessProvider
Description
Each access provider document in a Fauna database is in the AccessProvider
collection. This method returns the first accessible provider that
matches the predicate function. When no matching providers exist or are
accessible, this method returns null
.
The predicate function must return a Boolean.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
predicate |
Anonymous function that returns the first accessible provider that
matches the predicate function. When no matching collections exist or are
accessible, returns |
Return value
One of:
Type | Description |
---|---|
First accessible document matching the predicate function. |
|
When no provides match the predicate function or all matching providers are inaccessible. |
Examples
{
name: "newAccesProvider",
coll: AccessProvider,
ts: Time("2023-07-28T03:49:22.120Z"),
issuer: "https://fauna.auth2.com",
audience: "https://db.fauna.com/db/ywtfhw4poyynr",
roles: [
"mgmtTeam",
{
role: "mgmtTeam",
predicate: "_ => true"
}
],
jwks_uri: "https://fauna.auth0.com/.well-known/jwks.json",
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!