0

I'm still learning Rails, but faced with this project: Web solution should consist of three parts - the website, section for partners and admin panel. Section for partners and admin panel should be available as subdirectories (customer's requirement) like this:

somesite.com
somesite.com/partners/
somesite.com/admin/

I decided to make three separate applications with common models and business logic and deploy them in mentioned way using Passenger and Apache.

In the database should be two models: Admin (for administrators only) and User (quite fat model, common for users and partners, differs by is_partner field). Because those models are common to all three sites, I decided to put them in the Rails Engine, and then use appropriate model for each application. But now I have the issue of choosing the suitable authentication module.

Could you advice one? Should I try to use some already existing solution or I better have to implement my own authentication? Or may be my entire approach to this project is wrong from beginning?

Thank you.

Gris
  • 303
  • 1
  • 3
  • 10

1 Answers1

0

I would use one User model, since you won't need to duplicate any logic, and use three roles: user, partner, and admin, unless admins are drastically different from other users. For authentication, I would suggest Devise, which is the go-to authentication system for Rails. For authorization, I would suggest CanCan.

If you're looking for a pre-made admin interface, try RailsAdmin or ActiveAdmin. RailsAdmin is simple to use and easily configurable, but not too customizable, while ActiveAdmin is a little more difficult to use but more customizable. Both of them are integrated with devise.

Joe Kennedy
  • 9,365
  • 7
  • 41
  • 55
  • User and Admin are completely different models, so authentication module should use models from rails engine, but have separate configurations for each application. – Gris Feb 19 '14 at 20:22
  • Unfortunately, I can not use RailsAdmin or something similar, because "admin" interface - it's actually a full-featured web-application with a quite specific logic. – Gris Feb 19 '14 at 20:31