Multi-Tenant Structure without subdomains

default discord avatar
ericwaetke
last month

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)
  )
    Open the post
    Continue the discussion in Discord
    Like what we're doing?
    Star us on GitHub!

    Star

    Connect with the Payload Community on Discord

    Discord

    online

    Can't find what you're looking for?

    Get help straight from the Payload team with an Enterprise License.