1

このルールを強制することはできません...誰でもこのアクションを実行できます。

これが私のルールです

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

ルール定義のエラーはどこにありますか?

助けてください

4

1 に答える 1

0

テストするのは難しいですが、これを試してください:

if_attribute :id=> is {user.student.id}
于 2012-01-26T20:23:01.953 に答える