Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个本地网络服务正在运行,它需要将数据发布到 Rails 以更新和添加记录。我应该如何在我的 CanCan/Devise 身份验证/授权中使用它?有没有办法允许仅本地主机访问授权,或创建与其他服务的持久会话?
谢谢!
如果您想在本地授予访问权限,
# application_controller.rb def current_ability @current_ability ||= Ability.new(current_user, request.local?) end # ability.rb class Ability include CanCan::Ability def initialize(user, local) can(:manage, :all) if local ... end end