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

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -