ruby on rails - Resque, Devise and admin authentication -


By using rescue and device, I have roles for user such as:

  User.first .org # = & gt; Admin User.last.role # = & gt; Regularly   

I want to set up an authentication for Resque, so, I have it inside config / routes.rb:

  Namespace: Admin Mount Rescue :: Server.New, AT = & gt; "/ Rescue", as in: = & gt; : Resque end   

And, of course, it is accessible to all log users.

Is there a way to use a role from a user? It should be accessible only by users with 'Administrator' role

Thank you very much.

Use a path interrupt in your routes.rb file: < / P>

  resque_constraint = lambda do | Request | Request.env ['warden']. Certified? And request.env ['warden']. User.admin? End hurdle resque_constraint mount resque :: server, at: = on & gt; "/ Admin / resque" end   

Look at this and comments Hope it helps you.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -