vmeretail / multi-tenancy-bundle

A multi tenancy bundle for Symfony 2 apps
25 stars 11 forks source link

Add alternative URL strategy #25

Closed StephenGillCoop closed 9 years ago

StephenGillCoop commented 10 years ago

I'd like users of the multi tenant bundle to have a choice of URLs. Either:

  1. tenant.app.com, or
  2. go.app.com.

The bundle copes with item 1 at the moment, but for number 2 I'd like an option that the app could only be accessible from go.app.com ('go' could be anything). The user would be presented with a login page, and once logged in it would load into the tenant they used last, using a new field stored against the user called 'currentTenant'.

This field 'currentTenant' would be updated everytime the user changes 'active' tenant from the dropdown list (assuming they have permission to view more than one tenant).

Every request would, instead of looking at hostname, look at the currentTenant field and inject that instead, in order to return the correct data.

Its important that the developer of the app implementing this bundle can choose to implement option 1 or option 2, so they choose which way they want users to login to their app.

pmartelletti commented 9 years ago

So: