Skip to Content
⚠️Active Development Notice: TimeTiles is under active development. Information may be placeholder content or not up-to-date.

web


web / lib/services/access-control

lib/services/access-control

Provides shared utilities for access control and permissions.

This module centralizes the logic for determining what catalogs, datasets, and events a user can access based on their authentication status and ownership relationships. It’s used by Payload collection access control and API routes to ensure consistent permission checks.

Interfaces

AccessibleCatalogIds

Properties

publicCatalogIds

publicCatalogIds: number[]

ownedCatalogIds

ownedCatalogIds: number[]

allAccessibleIds

allAccessibleIds: number[]

Functions

getAccessibleCatalogIds()

getAccessibleCatalogIds(payload, user?): Promise<AccessibleCatalogIds>

Get catalog IDs that are accessible to the user.

Returns three sets of IDs:

  • publicCatalogIds: Catalogs marked as public
  • ownedCatalogIds: Catalogs created by the user
  • allAccessibleIds: Combined list of all accessible catalogs

Parameters

payload

BasePayload

Payload CMS instance

user?

Current user (optional)

null | User

Returns

Promise<AccessibleCatalogIds>

Object containing public, owned, and all accessible catalog IDs


getAllAccessibleCatalogIds()

getAllAccessibleCatalogIds(payload, user?): Promise<number[]>

Get all accessible catalog IDs for a user (simplified version).

This is a convenience method that returns only the combined list of accessible catalog IDs, useful for simple permission checks.

Parameters

payload

BasePayload

Payload CMS instance

user?

Current user (optional)

null | User

Returns

Promise<number[]>

Array of accessible catalog IDs

Last updated on