AccessProvider.where()

Get the set of accessible AccessProviders in the database.

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.

Parameters

Parameter Type Required Description

predicate

Function

An anonymous function that compares values in each provider and returns true for matches or false for mismatches.

predicate parameters:

Parameter Type Required Description

val

AccessProvider

Provider to compare. If omitted, use dot notation to access provider properties.

Return value

One of:

Type Description

Set<AccessProvider>

Set representing the access providers that match the predicate function.

Null

No matches found. Returns an empty set.

Examples

AccessProvider.where((.issuer.includes("fauna")))
{
  data: [
    {
      name: "theAccessProvider",
      coll: AccessProvider,
      ts: Time("2023-07-28T03:52:58.610Z"),
      roles: "humanResources",
      audience: "https://db.fauna.com/db/ywtfhw4poyynr",
      jwks_uri: "https://fauna.auth0.com/.well-known/jwks.json",
      issuer: "https://fauna-updated.auth0.com"
    },
    {
      name: "newAccesProvider",
      coll: AccessProvider,
      ts: Time("2023-07-28T03:49:22.120Z"),
      audience: "https://db.fauna.com/db/ywtfhw4poyynr",
      roles: [
        "mgmtTeam",
        {
          role: "mgmtTeam",
          predicate: "_ => true"
        }
      ],
      jwks_uri: "https://fauna.auth0.com/.well-known/jwks.json",
      issuer: "https://fauna.auth2.com",
      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!