AccessProvider.where()

Learn: Access providers

Get a Set of access providers that match a provided predicate.

Signature

AccessProvider.where(pred: (AccessProvider => Boolean)) => Set<AccessProvider>

Description

Gets a Set of AccessProvider documents that match a provided predicate function.

AccessProvider documents are FQL versions of a database’s FSL access provider schema. AccessProvider documents have the AccessProvider type. See Access providers.

If AccessProvider.where() 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

pred

Predicate function

Yes

Anonymous predicate function that:

The method returns a Set of AccessProvider documents for which the predicate returns true.

Return value

Type Description

Set<AccessProvider>

Set of AccessProvider documents that match the predicate. If there are no matching documents, the Set is empty.

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!