Authorization in Rails 3 dependent on variables (not only user and current resource) -


I use cancan and I know about the declarative authority, but it seems they depend on roles. Do not give chance to custom variables.

Model:

  • Domain (blah.qwe.com, wer.qwe.com, ert.qwe.com) - I need them

  • Roles (each role only works in its domain)

    For example, I have a user , He is the owner of Blah .qwe.com domain, but he is a simple user in wer.qwe.ru and he is restricted to ert.qwe.com and can not do anything.

    @current_domain is loaded in the first_filter (current_domain method) is loaded by devise in the application controller and current_user. What is the solution to depend on currently requested resources (such as KickNan), current_users and current_domain (and perhaps with other first loader variables) authorization? Does the Canon have a solution or should I modify it or write my own custom authorization system?

    Did you check? You can include whatever you want from the request in the capability calculation.

Comments