Add load_and_authorize_resource to answers controller
This commit is contained in:
@@ -3,7 +3,7 @@ class Admin::Poll::Questions::AnswersController < Admin::Poll::BaseController
|
||||
include DocumentAttributes
|
||||
|
||||
load_and_authorize_resource :question, class: "::Poll::Question"
|
||||
load_resource class: "::Poll::Question::Answer",
|
||||
load_and_authorize_resource class: "::Poll::Question::Answer",
|
||||
through: :question,
|
||||
through_association: :question_answers,
|
||||
except: :documents
|
||||
|
||||
@@ -90,6 +90,7 @@ module Abilities
|
||||
can [:create, :destroy], ::Poll::OfficerAssignment
|
||||
can [:read, :create, :update], Poll::Question
|
||||
can :destroy, Poll::Question
|
||||
can :manage, Poll::Question::Answer
|
||||
|
||||
can :manage, SiteCustomization::Page
|
||||
can :manage, SiteCustomization::Image
|
||||
|
||||
@@ -114,6 +114,8 @@ describe Abilities::Administrator do
|
||||
it { should be_able_to(:create, Poll::Question) }
|
||||
it { should be_able_to(:update, Poll::Question) }
|
||||
|
||||
it { should be_able_to(:manage, Poll::Question::Answer) }
|
||||
|
||||
it { is_expected.to be_able_to :manage, Dashboard::AdministratorTask }
|
||||
it { is_expected.to be_able_to :manage, dashboard_administrator_task }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user