All threads / Global User for Multi-Tenancy with Local Tenant Users

Ask A Question

Notifications

You’re not receiving notifications from this thread.

Global User for Multi-Tenancy with Local Tenant Users

Amie Fudge asked in Rails

I'm watching the rails tutorial on the apartment gem and am curious how to manage my Users, which I've already created through Devise and implemented User Roles.

Essentially, I want one Super User to have access to all tenants (that would be me). One Tenant User who logs in globally and gets switched to his/her tenant (this person would be my customer) and then all other Users to be within the Tenant subdomain. (i.e. staff and customers of the Tenant Owner). I want the Tenant Owner to manage their own users within their subdomain but not have access to any other users.

Do I have to create another User class? Devise is not my friend and I'd hate to muck around with that any more than I have to. Creating a parent without Devise would be the ideal way for me to go but I still want the Devise authenticaton that I've already implemented on the User class. Asking too much?

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 33,399+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.