简体   繁体   English

如何使用rails限制对已安装的机架应用程序的访问?

[英]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 我在我的rails routes.rb文件中安装了fnordmetrics作为机架应用程序

In my Rails app, I have Devise handling authentication. 在我的Rails应用程序中,我有Devise处理身份验证。

How can I restrict access to the fnordmetrics rack app to only AdminUsers who have logged into the site? 如何将对fnordmetrics机架应用程序的访问限制为仅登录到该站点的AdminUsers

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. 注意:没试过,所以ymmv,但我认为这样可行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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