Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7595157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:36:11+00:00 2026-05-30T21:36:11+00:00

Are there are any authorization gems/examples for multi-tenancy applications? I looked at CanCan and

  • 0

Are there are any authorization gems/examples for multi-tenancy applications?

I looked at CanCan and CanTango, but I wasn’t able to find what I am looking for.

My app has Account, User, Relationship model. The relationship model has a relationship_type column which determines authorization level. Its value can be owner, moderator, editor, perhaps more in the future. Users can own/moderate many accounts, and an account can have many owners/moderators.

All the examples I found describe a single tenant application, whereas my app’s authorization has to be scoped through the current account being viewed. A user can be a guest on one account and an owner of another, for example.

I’m starting to think my Relationship model is bad design and might have drawbacks, but I’m not sure what is a better alternative.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T21:36:13+00:00Added an answer on May 30, 2026 at 9:36 pm

    CanCan can indeed handle this because it lets you define arbitrary ruls. Your ability file might look like this:

    def initialize(user)
    
      can :read, BlogPost do |blog_post|
        blog_post.account == user.account and user.relationship.in?([:owner, :moderator])
      end
    
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are a few very good authorization gems, like cancan and declarative_authorization. But here's
Are there any recommended libraries, patterns or examples on how to implement Prefetching and/or
Is there any way to overload the > (greater than) operator, to be able
Is there any security/authorization/role for asp.net that is simpler and easier to implement than
I'm creating a DAL for use in multiple applications, but I'm not providing any
Is there any best practice data model for authentication/authorization scheme?
Is there any library in Ruby that generates the Signature, 'X-PAYPAL-AUTHORIZATION' header that is
Would there be any problems calling an HTTPS page (e.g. a credit card authorisation
Is there any functional difference in Python between a try statement and an if
Is there any way in Notepad++ (or even with another tool) to change the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.