Files
klz-cables.com/.pnpm-store/v10/files/58/b92a7a3a8ce1d1510e104cfd327c713e6e503ce32bc1e1f318f6603ceb7bdcf1a7d2b180196df56a534e1851db6f20352f927399680de082076894f8eb9d96
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

52 lines
2.6 KiB
Plaintext

import type { BlockPermissions, CollectionPermission, GlobalPermission } from '../../auth/types.js';
import type { SanitizedCollectionConfig, TypeWithID } from '../../collections/config/types.js';
import type { SanitizedGlobalConfig } from '../../globals/config/types.js';
import type { BlockSlug, DefaultDocumentIDType } from '../../index.js';
import type { AllOperations, JsonObject, PayloadRequest } from '../../types/index.js';
export type BlockReferencesPermissions = Record<BlockSlug, BlockPermissions | Promise<BlockPermissions>>;
export type EntityDoc = JsonObject | TypeWithID;
type ReturnType<TEntityType extends 'collection' | 'global'> = TEntityType extends 'global' ? GlobalPermission : CollectionPermission;
type Args<TEntityType extends 'collection' | 'global'> = {
blockReferencesPermissions: BlockReferencesPermissions;
/**
* If the document data is passed, it will be used to check access instead of fetching the document from the database.
*/
data?: JsonObject;
entity: TEntityType extends 'collection' ? SanitizedCollectionConfig : SanitizedGlobalConfig;
entityType: TEntityType;
/**
* Operations to check access for
*/
operations: AllOperations[];
req: PayloadRequest;
} & ({
fetchData: false;
id?: never;
} | {
fetchData: true;
id: TEntityType extends 'collection' ? DefaultDocumentIDType : undefined;
});
/**
* Build up permissions object for an entity (collection or global).
* This is not run during any update and reflects the current state of the entity data => doc and data is the same.
*
* When `fetchData` is false:
* - returned `Where` are not run and evaluated as "does not have permission".
* - If req.data is passed: `data` and `doc` is passed to access functions.
* - If req.data is not passed: `data` and `doc` is not passed to access functions.
*
* When `fetchData` is true:
* - `Where` are run and evaluated as "has permission" or "does not have permission".
* - `data` and `doc` are always passed to access functions.
* - Error is thrown if `entityType` is 'collection' and `id` is not passed.
*
* In both cases:
* We cannot include siblingData or blockData here, as we do not have siblingData available once we reach block or array
* rows, as we're calculating schema permissions, which do not include individual rows.
* For consistency, it's thus better to never include the siblingData and blockData
*
* @internal
*/
export declare function getEntityPermissions<TEntityType extends 'collection' | 'global'>(args: Args<TEntityType>): Promise<ReturnType<TEntityType>>;
export {};
//# sourceMappingURL=getEntityPermissions.d.ts.map