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