CanCan不允许操作,但允许html?

布鲁诺

出于某种原因,对于未登录的用户,此代码显示html,但单击删除后,CanCan将不允许该操作。

  <% if can? :destroy, @boat %>
    <%= link_to "", boat, method: :delete, data: { confirm: "You sure?" } %>
  <% end %>

如何防止HTML显示?

  def initialize(user)
       user ||= User.new
       if user.admin? || user.email = '[email protected]'
         can :manage, :all
       elsif user.manager?
         can :read, Boat
         can [:create, :read, :update], User
       else
         can :read, Boat
         can :create, User      
       end
  end
布鲁诺

该应用程序即使在注销后仍能检测到我的电子邮件,因此为我提供了管理员特权!

不知道这是怎么回事...

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章