gpt4 book ai didi

ruby-on-rails-3 - 康康 - "can :manage, all"。我无法通过设计访问所有 rails 3 应用程序

转载 作者:行者123 更新时间:2023-12-04 20:20:34 24 4
gpt4 key购买 nike

我在应用程序 Controller 中使用“检查授权”,因此每个操作都需要许可。我首先授予我 super 管理员 :=] 管理所有权限。我认为管理所有可以让我在不命名资源的情况下访问整个应用程序。

用户模型:

  def role?(role)
roles.include? role.to_s
end

应用 Controller :
check_authorization

康康能力模型:
  def initialize(user)
if user.role? :superadmin
can :manage, :all
end
end

错误信息:
This action failed the check_authorization because it does not authorize_resource. Add skip_authorization_check to bypass this check.

谢谢你。

最佳答案

据我所知,您需要调用 authorize_resource在您的 Controller 中作为前置过滤器,以便此操作。

关于ruby-on-rails-3 - 康康 - "can :manage, all"。我无法通过设计访问所有 rails 3 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7019124/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com