UNPKG

@lucidcms/core

Version:

The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.

1 lines 949 B
{"version":3,"file":"tenants.mjs","names":[],"sources":["../../../src/utils/helpers/tenants.ts"],"sourcesContent":["import type { Config } from \"../../types/config.js\";\n\n/**\n * Multi-tenancy is opt-in: it is enabled when one or more tenants are configured.\n */\nexport const multiTenancyEnabled = (config: Config) =>\n\tconfig.tenants.length > 0;\n\nexport const getTenantConfig = (config: Config, key: string) =>\n\tconfig.tenants.find((tenant) => tenant.key === key);\n\nexport const tenantAccessAllowed = (\n\ttenantKeys: string[] | undefined,\n\ttenantKey: string | null | undefined,\n) => {\n\tif (tenantKeys === undefined || tenantKeys.length === 0) return true;\n\tif (tenantKey == null) return true;\n\treturn tenantKeys.includes(tenantKey);\n};\n"],"mappings":"AAKA,MAAa,EAAuB,GACnC,EAAO,QAAQ,OAAS,EAEZ,GAAmB,EAAgB,IAC/C,EAAO,QAAQ,KAAM,GAAW,EAAO,MAAQ,CAAG,EAEtC,GACZ,EACA,IAEI,IAAe,IAAA,IAAa,EAAW,SAAW,GAClD,GAAa,MACV,EAAW,SAAS,CAAS"}