Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Multi-Tenant Structure without subdomains

default discord avatar
ericwaetke10 months ago

Hi all,



I’d like to create a multi-tenant cms

without

the tenants having different subdomains or domains.



So all tenants log into cms.abc.com, and then they see their own entries. Is that even possible with the official tutorial?



I cloned the tutorial-repo and changed a bit. For example deleted the "domains" from the seed file. And without further configuration my approach does not seem to work, as all tenant users are "unauthorized" to access the default url



How could I change it so all users can log in at the same url?



Oh and somewhat relevant to this, is it possible to add Globals for tenants? So the user of abc.com can set their global, and bcd.com can set their information in the same global.



Update in case someone has the same issue:


The Login wasn’t possible anymore, as the utility

isSuperOrTenantAdmin

checked only one tenant, as it riginally filtered all tenants from the domain. You need to change the tenantWithUser check to something like this:



const tenantWithUser = user?.tenants?.find(({ tenant: userTenant }) =>
    foundTenants.docs.some(({ id }) => id === userTenant?.id)
  )
    Star on GitHub

    Star

    Chat on Discord

    Discord

    online

    Can't find what you're looking for?

    Get dedicated engineering support directly from the Payload team..