Rails - Roles or Inheritance? -


I started writing an app using declarative_authorization (), but now I am thinking that this is the right way.

In my app, I was giving some users a "customer" role, some "administrator" role, and some "superadmin" role. It was working fine, but now I realized that I need some fields on specific models for "customer"

super admin = admin editor

admin = customer editor < / P>

Customer = Additional Features like "Avatar"

At this time I started making a customer model that inherited from the user. In that case, however, the customer will always be the "customer" role and only customers will have this role. It seemed a bit awkward.

I think I'm looking for a little guidance for this scenario.

Can you further increase the differences between administrators and user roles?

Edit as per your update : Personally, I do not think a customer role is required, as long as the authenticated user has a lower privileged category. For any such work, I need a logged-in user, which you do not want to be a guest, and all those tasks require admin / superuser roles that you do not want to be a regular user, I think In many models or STI, it is also unnecessary.

If there is a special case for your app that I do not remember, please tell me! ;)


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -