views:

89

answers:

2

Anyone have experience with this plugin? I have it installed but I have no idea how to implement it. How do I define the different roles?

A: 

There is quite a bit of documentation on the README: http://github.com/be9/acl9 Which part don't you understand?

Ryan Bigg
I dont see on there how you actually setup different role types..
Kevin Compton
Ryan Bigg
A: 

Their readme is in fact really good.

I just set it up and these are the steps:

  1. Create a model class called Role
  2. Create a migration for the roles table (see readme http://github.com/be9/acl9)
  3. Add acts_as_authorization_subject to your user model (assuming you have something like that already. Check out the authlogic plugin. There's an excellent railscast about authlogic (I think #160)
  4. Create a roles_users association table (for the exact migration, again, check out the readme)
  5. That's it. You done.

You can now assign roles to your user by current_user.has_role! :admin

You can check if a user has a certain role by calling e.g. current_user.has_role? :admin

There are lots of examples in the readme.

StefanS