Add load_and_authorize_resource to videos controller

This commit is contained in:
taitus
2022-09-09 16:45:09 +02:00
parent b17b03099c
commit 99495a21d2
3 changed files with 5 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
class Admin::Poll::Questions::Answers::VideosController < Admin::Poll::BaseController
load_resource :answer, class: "::Poll::Question::Answer"
load_resource class: "::Poll::Question::Answer::Video", through: :answer
load_and_authorize_resource :answer, class: "::Poll::Question::Answer"
load_and_authorize_resource class: "::Poll::Question::Answer::Video", through: :answer
def index
end

View File

@@ -91,6 +91,7 @@ module Abilities
can [:read, :create, :update], Poll::Question
can :destroy, Poll::Question
can :manage, Poll::Question::Answer
can :manage, Poll::Question::Answer::Video
can :manage, SiteCustomization::Page
can :manage, SiteCustomization::Image

View File

@@ -116,6 +116,8 @@ describe Abilities::Administrator do
it { should be_able_to(:manage, Poll::Question::Answer) }
it { should be_able_to(:manage, Poll::Question::Answer::Video) }
it { is_expected.to be_able_to :manage, Dashboard::AdministratorTask }
it { is_expected.to be_able_to :manage, dashboard_administrator_task }