1

我作为最后的手段来到这里,尝试了一切。它只是不起作用。所以这里。

这是我的授权码:

role :department_admin do
#Department has many users through designations  
  has_permission_on [:departments], :to => [:manage] do
    if_attribute :designations => contains {user.designation}
  end
  has_permission_on :users, :to => [:read]
  has_permission_on :users, :to => [:create, :update, :destroy] do
    if_permitted_to :manage, :department
  end

我的部门控制器代码:

filter_resource_access
#and the rest

在 users_controller 中:

filter_resource_access :nested_in => :departments
# and the rest

我正在尝试遵循 declarative_authorization github页面上给出的示例应用程序中使用的模式,但徒劳无功。

因此,当我尝试创建新用户时,使用此配置

我明白了

Couldn't find Department without an ID

任何抬头或提示都可以真正提供帮助。

4

0 回答 0