I am trying to figure out how I can perform authorization on my Rails 3 application. I was using CanCan, but I needed to get a little more complex than one user role.
My application has a User Model, Project Model and a Project Members Model. There is a Has Many Through relationship setup between those models. Below is the current schema….
Users
– First Name
– Last Name
– Email
Projects
– Name
– active
Project Members
– user_id
– project_id
– role
When a user logs into the site they are prompted to select a project from a select menu. The options in the select menu are created from
current_users.departments.where(:active
=> true)
After they hit submit a session variable is set for session[:department_id]. What I need to find is a way to pull the role id for the user and project and lock down certain things based on the that role.
Thanks,
Kyle
I was able to take care of this with CanCan and with the help of Ryan B.