简体   繁体   中英

How do I restrict access to a mounted rack application using rails?

I have fnordmetrics mounted as a rack app in my rails routes.rb file

In my Rails app, I have Devise handling authentication.

How can I restrict access to the fnordmetrics rack app to only AdminUsers who have logged into the site?

You can normally restrict access to a route like this:

authenticated :user do
  resource :profile
end

So, you can try

authenticated :admin_user do
  mount #yadayadayada
end

Note: haven't tried, so ymmv, but I think this will work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM