繁体   English   中英

帮助railsclarativeative_authorization

[英]Help with rails declarative_authorization

我根本无法执行此规则...它允许任何人执行此操作。

这是我的规则

role :student do
    has_permission_on :relationships do 
      to :index
      if_attribute :student_id=> is {user.student.id}
    end
  end

这是我的控制器动作

class RelationshipsController < ApplicationController

filter_resource_access :nested_in => :students

 def index
   @guardians = @student.guardians  
  end

我知道我已正确设置它,因为此规则正常运行

has_permission_on :students do 
      to :show
      if_attribute :id => is {user.student.id}
    end

我的规则定义中的错误在哪里?

请帮忙

很难测试,但是尝试一下:

if_attribute :id=> is {user.student.id}

暂无
暂无

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

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