我根本不能强制执行这个规则……它允许任何人执行此操作。
这是我的规则
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我的规则定义中的错误在哪里?
请帮帮忙
发布于 2012-01-27 04:23:02
这很难测试,但是试试这个:
if_attribute :id=> is {user.student.id}https://stackoverflow.com/questions/5408513
复制相似问题