Kevin McKelvin
Kevin McKelvin

Reputation: 3547

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?

Upvotes: 1

Views: 395

Answers (1)

Jesse Wolgamott
Jesse Wolgamott

Reputation: 40277

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.

Upvotes: 3

Related Questions