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

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("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!