decidim-reporting_proposals 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/lint.yml +1 -1
- data/.github/workflows/test_integration.yml +3 -3
- data/.github/workflows/test_unit.yml +2 -2
- data/.ruby-version +1 -1
- data/.simplecov +14 -9
- data/Gemfile.lock +2 -2
- data/app/controllers/concerns/decidim/proposals/admin/valuation_assignments_controller_override.rb +22 -0
- data/app/controllers/concerns/decidim/reporting_proposals/admin/proposals_controller_override.rb +2 -0
- data/app/permissions/concerns/decidim/reporting_proposals/admin/permissions_override.rb +73 -0
- data/lib/decidim/reporting_proposals/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 557fb713574d707b2c60bbfad4178058d4b8e38864ecd7f23efc7430d32cef0a
|
4
|
+
data.tar.gz: 2344db1ea4e1bc83c0f62bdcdd1401121912580c88dfc9b65656a95f983a1c2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1784b775ece69f3858daa07d14606ed68c19937de374d8501ab51ac24df8572063fb3bdd04979081fc5b81b1e9037839fe5f8b0b72fe199a23c9526819d80d1
|
7
|
+
data.tar.gz: 40e89f2934794e3c3b74831b55721e3f6441dd27a5f642b34ba5ae64edba5c2fba6b88baaddb24b96f6b56c25a0641c81aec33f6a6e482bbee164895db713f9e
|
data/.github/workflows/lint.yml
CHANGED
@@ -8,8 +8,8 @@ on:
|
|
8
8
|
|
9
9
|
env:
|
10
10
|
CI: "true"
|
11
|
-
|
12
|
-
RUBY_VERSION: 3.0.
|
11
|
+
SIMPLECOV: "true"
|
12
|
+
RUBY_VERSION: 3.0.6
|
13
13
|
NODE_VERSION: 16.9.1
|
14
14
|
RAILS_ENV: test
|
15
15
|
DATABASE_USERNAME: postgres
|
@@ -68,7 +68,7 @@ jobs:
|
|
68
68
|
|
69
69
|
test:
|
70
70
|
name: Integration Tests
|
71
|
-
runs-on: ubuntu-
|
71
|
+
runs-on: ubuntu-latest
|
72
72
|
needs: build
|
73
73
|
strategy:
|
74
74
|
matrix:
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.0.
|
1
|
+
3.0.6
|
data/.simplecov
CHANGED
@@ -1,13 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
if ENV["SIMPLECOV"]
|
4
|
+
SimpleCov.start do
|
5
|
+
# We ignore some of the files because they are never tested
|
6
|
+
add_filter "/config/"
|
7
|
+
add_filter "/db/"
|
8
|
+
add_filter "lib/decidim/reporting_proposals/version.rb"
|
9
|
+
add_filter "/spec"
|
10
|
+
end
|
5
11
|
|
6
|
-
|
7
|
-
add_filter "lib/decidim/reporting_proposals/component.rb"
|
8
|
-
add_filter "/spec"
|
9
|
-
end
|
10
|
-
|
11
|
-
SimpleCov.command_name ENV.fetch("COMMAND_NAME", nil) || File.basename(Dir.pwd)
|
12
|
+
SimpleCov.merge_timeout 1800
|
12
13
|
|
13
|
-
|
14
|
+
if ENV["CI"]
|
15
|
+
require "simplecov-cobertura"
|
16
|
+
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
|
17
|
+
end
|
18
|
+
end
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
decidim-reporting_proposals (0.5.
|
4
|
+
decidim-reporting_proposals (0.5.2)
|
5
5
|
decidim-admin (>= 0.27.0, < 0.28)
|
6
6
|
decidim-core (>= 0.27.0, < 0.28)
|
7
7
|
decidim-participatory_processes (>= 0.27.0, < 0.28)
|
@@ -873,7 +873,7 @@ DEPENDENCIES
|
|
873
873
|
web-console
|
874
874
|
|
875
875
|
RUBY VERSION
|
876
|
-
ruby 3.0.
|
876
|
+
ruby 3.0.6p216
|
877
877
|
|
878
878
|
BUNDLED WITH
|
879
879
|
2.3.20
|
data/app/controllers/concerns/decidim/proposals/admin/valuation_assignments_controller_override.rb
CHANGED
@@ -23,6 +23,28 @@ module Decidim
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
+
def destroy
|
27
|
+
@form = form(Admin::ValuationAssignmentForm).from_params(destroy_params)
|
28
|
+
|
29
|
+
enforce_permission_to :unassign_from_valuator, :proposals, valuator: @form.valuator_user
|
30
|
+
|
31
|
+
Admin::UnassignProposalsFromValuator.call(@form) do
|
32
|
+
on(:ok) do |_proposal|
|
33
|
+
flash.keep[:notice] = I18n.t("valuation_assignments.delete.success", scope: "decidim.proposals.admin")
|
34
|
+
if current_user == @form.valuator_user
|
35
|
+
redirect_to EngineRouter.admin_proxy(current_component).root_path
|
36
|
+
else
|
37
|
+
redirect_back fallback_location: EngineRouter.admin_proxy(current_component).root_path
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
on(:invalid) do
|
42
|
+
flash.keep[:alert] = I18n.t("valuation_assignments.delete.invalid", scope: "decidim.proposals.admin")
|
43
|
+
redirect_back fallback_location: EngineRouter.admin_proxy(current_component).root_path
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
26
48
|
def after_add_evaluator_url
|
27
49
|
return request.referer if request.referer.present? && request.referer =~ %r{manage/proposals/[0-9]+}
|
28
50
|
|
data/app/controllers/concerns/decidim/reporting_proposals/admin/proposals_controller_override.rb
CHANGED
@@ -10,6 +10,8 @@ module Decidim
|
|
10
10
|
included do
|
11
11
|
helper_method :reporting_proposal?, :proposals, :query, :form_presenter, :proposal, :proposal_ids
|
12
12
|
def show
|
13
|
+
enforce_permission_to :show, :proposal, proposal: proposal
|
14
|
+
|
13
15
|
@notes_form = form(Decidim::Proposals::Admin::ProposalNoteForm).instance
|
14
16
|
@answer_form = form(Decidim::Proposals::Admin::ProposalAnswerForm).from_model(proposal)
|
15
17
|
@photo_form = form(Decidim::ReportingProposals::Admin::ProposalPhotoForm).instance
|
@@ -7,8 +7,81 @@ module Decidim
|
|
7
7
|
extend ActiveSupport::Concern
|
8
8
|
|
9
9
|
included do
|
10
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
11
|
+
def permissions
|
12
|
+
# The public part needs to be implemented yet
|
13
|
+
return permission_action if permission_action.scope != :admin
|
14
|
+
|
15
|
+
# Valuators can only perform these actions
|
16
|
+
if user_is_valuator?
|
17
|
+
if valuator_assigned_to_proposal?
|
18
|
+
can_create_proposal_note?
|
19
|
+
can_create_proposal_answer?
|
20
|
+
allow! if action_is_show_on_proposal?
|
21
|
+
elsif action_is_show_on_proposal?
|
22
|
+
disallow!
|
23
|
+
end
|
24
|
+
can_export_proposals?
|
25
|
+
valuator_can_unassign_valuator_from_proposals?
|
26
|
+
|
27
|
+
return permission_action
|
28
|
+
end
|
29
|
+
|
30
|
+
if create_permission_action?
|
31
|
+
can_create_proposal_note?
|
32
|
+
can_create_proposal_from_admin?
|
33
|
+
can_create_proposal_answer?
|
34
|
+
end
|
35
|
+
|
36
|
+
# Allow any admin user to view a proposal.
|
37
|
+
allow! if action_is_show_on_proposal?
|
38
|
+
|
39
|
+
# Admins can only edit official proposals if they are within the
|
40
|
+
# time limit.
|
41
|
+
allow! if permission_action.subject == :proposal && permission_action.action == :edit && admin_edition_is_available?
|
42
|
+
|
43
|
+
# Every user allowed by the space can update the category of the proposal
|
44
|
+
allow! if permission_action.subject == :proposal_category && permission_action.action == :update
|
45
|
+
|
46
|
+
# Every user allowed by the space can update the scope of the proposal
|
47
|
+
allow! if permission_action.subject == :proposal_scope && permission_action.action == :update
|
48
|
+
|
49
|
+
# Every user allowed by the space can import proposals from another_component
|
50
|
+
allow! if permission_action.subject == :proposals && permission_action.action == :import
|
51
|
+
|
52
|
+
# Every user allowed by the space can export proposals
|
53
|
+
can_export_proposals?
|
54
|
+
|
55
|
+
# Every user allowed by the space can merge proposals to another component
|
56
|
+
allow! if permission_action.subject == :proposals && permission_action.action == :merge
|
57
|
+
|
58
|
+
# Every user allowed by the space can split proposals to another component
|
59
|
+
allow! if permission_action.subject == :proposals && permission_action.action == :split
|
60
|
+
|
61
|
+
# Every user allowed by the space can assign proposals to a valuator
|
62
|
+
allow! if permission_action.subject == :proposals && permission_action.action == :assign_to_valuator
|
63
|
+
|
64
|
+
# Every user allowed by the space can unassign a valuator from proposals
|
65
|
+
can_unassign_valuator_from_proposals?
|
66
|
+
|
67
|
+
# Only admin users can publish many answers at once
|
68
|
+
toggle_allow(user.admin?) if permission_action.subject == :proposals && permission_action.action == :publish_answers
|
69
|
+
|
70
|
+
if permission_action.subject == :participatory_texts && participatory_texts_are_enabled? && permission_action.action == :manage
|
71
|
+
# Every user allowed by the space can manage (import, update and publish) participatory texts to proposals
|
72
|
+
allow!
|
73
|
+
end
|
74
|
+
|
75
|
+
permission_action
|
76
|
+
end
|
77
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
78
|
+
|
10
79
|
private
|
11
80
|
|
81
|
+
def action_is_show_on_proposal?
|
82
|
+
permission_action.subject == :proposal && permission_action.action == :show
|
83
|
+
end
|
84
|
+
|
12
85
|
def valuator_can_unassign_valuator_from_proposals?
|
13
86
|
can_unassign_valuator_from_proposals? if user == context.fetch(:valuator, nil)
|
14
87
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-reporting_proposals
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Vergés
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: decidim-admin
|