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