首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >关于rails declarative_authorization的帮助

关于rails declarative_authorization的帮助
EN

Stack Overflow用户
提问于 2011-03-24 00:28:41
回答 1查看 174关注 0票数 1

我根本不能强制执行这个规则……它允许任何人执行此操作。

这是我的规则

代码语言:javascript
复制
role :student do
    has_permission_on :relationships do 
      to :index
      if_attribute :student_id=> is {user.student.id}
    end
  end

下面是我的控制器操作

代码语言:javascript
复制
class RelationshipsController < ApplicationController

filter_resource_access :nested_in => :students

 def index
   @guardians = @student.guardians  
  end

我知道我的设置是正确的,因为这条规则运行良好

代码语言:javascript
复制
has_permission_on :students do 
      to :show
      if_attribute :id => is {user.student.id}
    end

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

请帮帮忙

EN

回答 1

Stack Overflow用户

发布于 2012-01-27 04:23:02

这很难测试,但是试试这个:

代码语言:javascript
复制
if_attribute :id=> is {user.student.id}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5408513

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档