Allow administrators to run local census records importation

Allow only administrator users to run local census records importation
process
This commit is contained in:
Senén Rodero Rodríguez
2019-05-16 10:43:02 +02:00
committed by Javi Martín
parent d221198106
commit 0239efef9d
3 changed files with 5 additions and 0 deletions

View File

@@ -105,6 +105,7 @@ module Abilities
can [:edit, :update], DownloadSetting can [:edit, :update], DownloadSetting
can :manage, LocalCensusRecord can :manage, LocalCensusRecord
can [:create, :read], LocalCensusRecords::Import
end end
end end
end end

View File

@@ -97,4 +97,6 @@ describe Abilities::Administrator do
it { is_expected.to be_able_to :manage, dashboard_administrator_task } it { is_expected.to be_able_to :manage, dashboard_administrator_task }
it { should be_able_to(:manage, LocalCensusRecord) } it { should be_able_to(:manage, LocalCensusRecord) }
it { should be_able_to(:create, LocalCensusRecords::Import) }
it { should be_able_to(:show, LocalCensusRecords::Import) }
end end

View File

@@ -28,6 +28,8 @@ describe Abilities::Everyone do
it { should_not be_able_to(:manage, Dashboard::Action) } it { should_not be_able_to(:manage, Dashboard::Action) }
it { should_not be_able_to(:manage, LocalCensusRecord) } it { should_not be_able_to(:manage, LocalCensusRecord) }
it { should_not be_able_to(:create, LocalCensusRecords::Import) }
it { should_not be_able_to(:show, LocalCensusRecords::Import) }
context "when accessing poll results" do context "when accessing poll results" do
let(:results_enabled) { true } let(:results_enabled) { true }