views:

214

answers:

6

I am building a project management app and I am not sure which is the best/correct authentication model to implement given I am new to Rails (and programming in general). Here is what I am trying to do.

I want to be able to add a "client" to the application and then multiple projects to a client. I would like to be able to add users (that are essentially representatives of the client) to view that clients multiple projects but not other clients. I intend on having controllers for time tracking, notes, comments and images all to be associated with both clients and project of that client.

In addition, I would like to set up the account to control who is able to have one. I don't need the user to establish an account on their own.

Does that make sense?

+3  A: 

These (free) Railscasts should give you some food for thought. There are lots of great RubyGems/plugins out there for this sort of thing.

John Topley
+4  A: 

I believe what you are mentioning is called Authorization not Authentication, anyway:

I would suggest acl9 for authorization and authlogic for authentication.

khelll
Could you please elaborate on this answers. What are the reasons that you suggest acl9 and authlogic.
Jonas Söderström
+1  A: 

Restful Authentication is still the golden standard for user authentication in ruby on rails.

Kyle Boon
This became too old now... ppl moved to authlogic which is far better.
khelll
Clearance is also very good.
jonnii
+1  A: 

The Ruby Toolbox gives you an overview of tools and their popularity in the rails community (rated by watchers and forkers on GitHub). As you can see there, the suggested plugins restful_authentication and authlogic are almost on the same level.

auralbee
+1  A: 

I have used Authorization plug-in in the past and like it because it gives some nice meta methods such as:

  user.is_eligible_for_what   --> returns array of authorizable objects for which user has role "eligible"
  user.is_moderator_of? group --> returns true/false
  user.is_moderator_of group  --> sets user to have role "moderator" for object group.
  user.is_administrator       --> sets user to have role "administrator" not really tied to any object.

There's also a brand new RailsCast on CanCan.

Chirag Patel
A: 

I'd use AuthLogic for authentication (logging in users and making sure they are who they claim to be) and declarative_authorization for authorization (making sure they have access to resources). See Ryan Bates' excellent Railscasts on AuthLogic and restful_authentication for more info.

dvyjones