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?

Reply

You don't have to create another user class. this problem has nothing really to do with devise. Any authentication method will give you a user_id

Reply

Your blog is not only helpful, but it is also very creative. Thank you for being willing to share what you know with us. We'll always be grateful for what you've done here because I know you care a lot about us

Reply
Join the discussion
Create an account Log in

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

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

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