decidim-forms 0.31.4 → 0.31.5
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/app/controllers/decidim/forms/admin/concerns/has_questionnaire.rb +10 -2
- data/config/locales/ca-IT.yml +2 -2
- data/config/locales/ca.yml +2 -2
- data/config/locales/sk.yml +182 -0
- data/lib/decidim/forms/test/shared_examples/questionnaire_admin_access.rb +95 -0
- data/lib/decidim/forms/test/shared_examples/questionnaire_admin_controller_permissions.rb +41 -0
- data/lib/decidim/forms/version.rb +1 -1
- metadata +10 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 79dbab9a7ba141c7ee5f831bc84164491f3e239c4d8ad21990af8281089bc441
|
|
4
|
+
data.tar.gz: d32babe65138eb8306522956dbbea242bdf2bceafc1164f3f1a15b46266d7d33
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '0876dfb11a0c31998a5a9a76095b7c337655616159018885e12702851bf2eebc8d7fe1d87e22e7bb2a09c2a4caf20f697f9b93c9944aa94a1b77d85083ca6a23'
|
|
7
|
+
data.tar.gz: 042d69619df59a838e82628379e170fbe4d7af6edc315c40f36a3c774fe0430cc6cb3361137142d0803381fa82d1c07b464182291bfc841eee8cecdd70c8e756
|
|
@@ -34,7 +34,7 @@ module Decidim
|
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
def edit
|
|
37
|
-
enforce_permission_to(:update,
|
|
37
|
+
enforce_permission_to(:update, permission_subject, questionnaire:)
|
|
38
38
|
|
|
39
39
|
@form = form(Admin::QuestionnaireForm).from_model(questionnaire)
|
|
40
40
|
|
|
@@ -42,7 +42,7 @@ module Decidim
|
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
def update
|
|
45
|
-
enforce_permission_to(:update,
|
|
45
|
+
enforce_permission_to(:update, permission_subject, questionnaire:)
|
|
46
46
|
|
|
47
47
|
@form = form(Admin::QuestionnaireForm).from_params(params)
|
|
48
48
|
|
|
@@ -62,6 +62,8 @@ module Decidim
|
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
def edit_questions
|
|
65
|
+
enforce_permission_to(:update, permission_subject, questionnaire:)
|
|
66
|
+
|
|
65
67
|
@form = form(Admin::QuestionsForm).from_model(questionnaire)
|
|
66
68
|
|
|
67
69
|
render template: edit_questions_template
|
|
@@ -70,6 +72,8 @@ module Decidim
|
|
|
70
72
|
# i18n-tasks-use t("decidim.forms.admin.questionnaires.questions_form.update.success")
|
|
71
73
|
# i18n-tasks-use t("decidim.forms.admin.questionnaires.update.invalid")
|
|
72
74
|
def update_questions
|
|
75
|
+
enforce_permission_to(:update, permission_subject, questionnaire:)
|
|
76
|
+
|
|
73
77
|
@form = form(Admin::QuestionsForm).from_params(params)
|
|
74
78
|
Admin::UpdateQuestions.call(@form, questionnaire) do
|
|
75
79
|
on(:ok) do
|
|
@@ -181,6 +185,10 @@ module Decidim
|
|
|
181
185
|
[condition_type, I18n.t("decidim.forms.admin.questionnaires.display_condition.condition_types.#{condition_type}")]
|
|
182
186
|
end
|
|
183
187
|
end
|
|
188
|
+
|
|
189
|
+
def permission_subject
|
|
190
|
+
:questionnaire
|
|
191
|
+
end
|
|
184
192
|
end
|
|
185
193
|
end
|
|
186
194
|
end
|
data/config/locales/ca-IT.yml
CHANGED
|
@@ -188,10 +188,10 @@ ca-IT:
|
|
|
188
188
|
of_total_steps: de %{total_steps}
|
|
189
189
|
questionnaire_closed:
|
|
190
190
|
body: El formulari està tancat i no es pot respondre.
|
|
191
|
-
title:
|
|
191
|
+
title: Formulari tancat
|
|
192
192
|
questionnaire_for_private_users:
|
|
193
193
|
body: El formulari només està disponible per a participants privades
|
|
194
|
-
title:
|
|
194
|
+
title: Formulari tancat
|
|
195
195
|
questionnaire_js_disabled:
|
|
196
196
|
body: Algunes de les característiques d'aquest formulari es deshabilitaran. Per millorar la teva experiència, si us plau, habilita JavaScript al teu navegador.
|
|
197
197
|
title: JavaScript està desactivat
|
data/config/locales/ca.yml
CHANGED
|
@@ -188,10 +188,10 @@ ca:
|
|
|
188
188
|
of_total_steps: de %{total_steps}
|
|
189
189
|
questionnaire_closed:
|
|
190
190
|
body: El formulari està tancat i no es pot respondre.
|
|
191
|
-
title:
|
|
191
|
+
title: Formulari tancat
|
|
192
192
|
questionnaire_for_private_users:
|
|
193
193
|
body: El formulari només està disponible per a participants privades
|
|
194
|
-
title:
|
|
194
|
+
title: Formulari tancat
|
|
195
195
|
questionnaire_js_disabled:
|
|
196
196
|
body: Algunes de les característiques d'aquest formulari es deshabilitaran. Per millorar la teva experiència, si us plau, habilita JavaScript al teu navegador.
|
|
197
197
|
title: JavaScript està desactivat
|
data/config/locales/sk.yml
CHANGED
|
@@ -7,43 +7,225 @@ sk:
|
|
|
7
7
|
question_type: Typ
|
|
8
8
|
questionnaire_question:
|
|
9
9
|
mandatory: Povinné
|
|
10
|
+
max_characters: Limit znakov (ponechajte 0, ak bez limitu)
|
|
11
|
+
response:
|
|
12
|
+
body: Odpoveď
|
|
13
|
+
choices: Možnosti
|
|
14
|
+
selected_choices: Vybrané možnosti
|
|
15
|
+
errors:
|
|
16
|
+
models:
|
|
17
|
+
questionnaire:
|
|
18
|
+
request_invalid: Pri spracovaní požiadavky sa vyskytol problém. Skúste to znova.
|
|
19
|
+
response:
|
|
20
|
+
attributes:
|
|
21
|
+
add_documents:
|
|
22
|
+
needs_to_be_reattached: Je potrebné znova pripojiť
|
|
23
|
+
body:
|
|
24
|
+
too_long: je príliš dlhé
|
|
25
|
+
choices:
|
|
26
|
+
missing: nie sú úplné
|
|
27
|
+
too_many: Môžete si vybrať maximálne %{count}.
|
|
10
28
|
decidim:
|
|
29
|
+
download_your_data:
|
|
30
|
+
help:
|
|
31
|
+
responses:
|
|
32
|
+
id: Jedinečný identifikátor odpovede
|
|
33
|
+
question: Otázka, na ktorú sa odpovedalo
|
|
34
|
+
questionnaire: Dotazník, na ktorý sa odpovedalo
|
|
35
|
+
response: Odpoveď na otázku
|
|
36
|
+
user: Používateľ, ktorý odpovedal na dotazník
|
|
37
|
+
show:
|
|
38
|
+
responses: Export odpovedí
|
|
39
|
+
survey_user_responses: Odpovede používateľov v prieskume
|
|
11
40
|
forms:
|
|
12
41
|
admin:
|
|
13
42
|
models:
|
|
14
43
|
components:
|
|
44
|
+
allow_editing_responses: Povoliť registrovaným používateľom upravovať vlastné odpovede v prieskume
|
|
45
|
+
allow_responses: Povoliť odpovede
|
|
46
|
+
allow_unregistered: Povoliť neregistrovaným používateľom odpovedať na prieskum
|
|
47
|
+
allow_unregistered_help: Ak je táto možnosť aktívna, na odpovedanie na prieskum nebude potrebné prihlásenie. To môže viesť k nekvalitným alebo nespoľahlivým údajom a bude to zraniteľnejšie voči automatizovaným útokom. Používajte opatrne! Majte na pamäti, že účastník môže na ten istý prieskum odpovedať viackrát pomocou rôznych prehliadačov alebo funkcie „súkromné prehliadanie“ vo svojom webovom prehliadači.
|
|
48
|
+
announcement: Oznámenie
|
|
49
|
+
clean_after_publish: Vymazať odpovede pri zverejnení prieskumu
|
|
15
50
|
description: Popis
|
|
51
|
+
ends_at: Odpovede prijímané do
|
|
52
|
+
ends_at_help: Ponechajte prázdne, ak nie je určený konkrétny dátum
|
|
53
|
+
starts_at: Odpovede prijímané od
|
|
54
|
+
starts_at_help: Ponechajte prázdne, ak nie je určený konkrétny dátum
|
|
16
55
|
tos: Podmienky použitia
|
|
17
56
|
questionnaires:
|
|
57
|
+
actions:
|
|
58
|
+
back: Späť na odpovede
|
|
59
|
+
publish_responses: Zverejniť odpovede
|
|
60
|
+
show: Odpovede
|
|
61
|
+
display_condition:
|
|
62
|
+
condition_question: Otázka
|
|
63
|
+
condition_type: Podmienka
|
|
64
|
+
condition_types:
|
|
65
|
+
equal: Rovná sa
|
|
66
|
+
match: Obsahuje text
|
|
67
|
+
not_equal: Nerovná sa
|
|
68
|
+
not_responded: Nezodpovedané
|
|
69
|
+
responded: Zodpovedané
|
|
70
|
+
condition_value: Zahrnutý text
|
|
71
|
+
display_condition: Podmienka zobrazenia
|
|
72
|
+
mandatory: Táto podmienka musí byť splnená vždy bez ohľadu na stav iných podmienok
|
|
73
|
+
remove: Odstrániť
|
|
74
|
+
response_option: Možnosť odpovede
|
|
75
|
+
save_warning: Nezabudnite uložiť formulár pred konfiguráciou podmienok zobrazenia
|
|
76
|
+
select_condition_question: Vyberte otázku
|
|
77
|
+
select_condition_type: Vyberte typ podmienky
|
|
78
|
+
select_response_option: Vyberte možnosť odpovede
|
|
18
79
|
edit:
|
|
19
80
|
save: Uložiť
|
|
81
|
+
title: Upraviť dotazník
|
|
82
|
+
edit_questions:
|
|
83
|
+
add_question: Pridať otázku
|
|
84
|
+
add_separator: Pridať oddeľovač
|
|
85
|
+
add_title_and_description: Pridať názov a popis
|
|
86
|
+
save: Uložiť
|
|
87
|
+
title: Otázky
|
|
20
88
|
form:
|
|
21
89
|
add_question: Pridať otázku
|
|
90
|
+
collapse: Zbaliť všetky otázky
|
|
91
|
+
expand: Rozbaliť všetky otázky
|
|
92
|
+
preview: Náhľad
|
|
93
|
+
title: Upraviť formulár pre %{questionnaire_for}
|
|
22
94
|
matrix_row:
|
|
95
|
+
matrix_row: Riadok
|
|
23
96
|
remove: Odstrániť
|
|
24
97
|
statement: Prehlásenie
|
|
25
98
|
question:
|
|
99
|
+
add_display_condition: Pridať podmienku zobrazenia
|
|
100
|
+
add_display_condition_info: Uložte formulár pre konfiguráciu podmienok zobrazenia
|
|
101
|
+
add_matrix_row: Pridať riadok
|
|
102
|
+
add_response_option: Pridať možnosť odpovede
|
|
26
103
|
any: Akékoľvek
|
|
104
|
+
collapse: Zbaliť
|
|
27
105
|
description: Popis
|
|
106
|
+
expand: Rozbaliť
|
|
28
107
|
question: Otázka
|
|
29
108
|
remove: Odstrániť
|
|
30
109
|
statement: Prehlásenie
|
|
110
|
+
questions_form:
|
|
111
|
+
already_responded_warning: Na formulár už odpovedali niektorí používatelia, takže nemôžete upravovať jeho otázky.
|
|
112
|
+
collapse: Zbaliť všetky otázky
|
|
113
|
+
expand: Rozbaliť všetky otázky
|
|
114
|
+
unpublished_warning: Formulár nie je zverejnený. Môžete upraviť jeho otázky, ale týmto krokom sa vymažú aktuálne odpovede.
|
|
115
|
+
update:
|
|
116
|
+
success: Otázky prieskumu boli úspešne uložené.
|
|
117
|
+
response_option:
|
|
118
|
+
free_text: Voľný text
|
|
119
|
+
remove: Odstrániť
|
|
120
|
+
response_option: Možnosť odpovede
|
|
121
|
+
statement: Tvrdenie
|
|
122
|
+
responses:
|
|
123
|
+
actions:
|
|
124
|
+
back: Späť na odpovede
|
|
125
|
+
export: Exportovať
|
|
126
|
+
next: Ďalej ›
|
|
127
|
+
previous: "‹ Predchádzajúce"
|
|
128
|
+
show: Zobraziť odpovede
|
|
129
|
+
empty: Zatiaľ žiadne odpovede
|
|
130
|
+
export:
|
|
131
|
+
response:
|
|
132
|
+
title: 'Odpoveď č. %{number}'
|
|
133
|
+
export_response:
|
|
134
|
+
title: survey_user_responses_%{token}
|
|
135
|
+
index:
|
|
136
|
+
title: "Celkovo %{total} odpovedí"
|
|
137
|
+
show:
|
|
138
|
+
title: 'Odpoveď č. %{number}'
|
|
139
|
+
separator:
|
|
140
|
+
remove: Odstrániť
|
|
141
|
+
separator: Oddeľovač
|
|
142
|
+
title_and_description:
|
|
143
|
+
collapse: Zbaliť
|
|
144
|
+
description: Popis
|
|
145
|
+
expand: Rozbaliť
|
|
146
|
+
remove: Odstrániť
|
|
147
|
+
title: Názov
|
|
148
|
+
title_and_description: Názov a popis
|
|
31
149
|
update:
|
|
32
150
|
invalid: Vyskytol sa problém s ukladaním formulára.
|
|
151
|
+
success: Formulár bol úspešne uložený.
|
|
152
|
+
admin_log:
|
|
153
|
+
question:
|
|
154
|
+
publish_responses: "%{user_name} zverejnil/a odpovede na otázku %{resource_name} v priestore %{space_name}"
|
|
155
|
+
unpublish_responses: "%{user_name} zrušil/a zverejnenie odpovedí na otázku %{resource_name} v priestore %{space_name}"
|
|
156
|
+
questionnaire:
|
|
157
|
+
update: "%{user_name} aktualizoval/a dotazník %{resource_name}"
|
|
158
|
+
errors:
|
|
159
|
+
response:
|
|
160
|
+
body: Telo nemôže byť prázdne
|
|
161
|
+
images:
|
|
162
|
+
dimensions: "%{width} x %{height} px"
|
|
163
|
+
processors:
|
|
164
|
+
resize_and_pad: Veľkosť tohto obrázka sa zmení a doplní na %{dimensions}.
|
|
165
|
+
resize_to_fit: Veľkosť tohto obrázka sa zmení tak, aby sa zmestil do %{dimensions}.
|
|
33
166
|
question_types:
|
|
167
|
+
files: Súbory
|
|
168
|
+
long_response: Dlhá odpoveď
|
|
169
|
+
matrix_multiple: Matica (Viacero možností)
|
|
170
|
+
matrix_single: Matica (Jedna možnosť)
|
|
34
171
|
multiple_option: Viacero možností
|
|
172
|
+
short_response: Krátka odpoveď
|
|
35
173
|
single_option: Jedna možnosť
|
|
36
174
|
sorting: Zoradenie
|
|
175
|
+
title_and_description: Názov a popis
|
|
176
|
+
questionnaire_response_presenter:
|
|
177
|
+
download_attachment: Stiahnuť prílohu
|
|
37
178
|
questionnaires:
|
|
38
179
|
question:
|
|
39
180
|
max_choices: 'Maximum možností: %{n}'
|
|
181
|
+
response:
|
|
182
|
+
invalid: Pri odpovedaní na formulár sa vyskytol problém.
|
|
183
|
+
max_choices_alert: Je vybratých príliš veľa možností
|
|
184
|
+
success: Formulár bol úspešne vyplnený.
|
|
40
185
|
show:
|
|
186
|
+
current_step: Krok %{step}
|
|
187
|
+
empty: Pre tento formulár zatiaľ nie sú nakonfigurované žiadne otázky.
|
|
188
|
+
of_total_steps: z %{total_steps}
|
|
41
189
|
questionnaire_closed:
|
|
190
|
+
body: Formulár je uzavretý a nie je možné naň odpovedať.
|
|
42
191
|
title: Formulár je uzavretý.
|
|
43
192
|
questionnaire_for_private_users:
|
|
44
193
|
body: Formulár je otvorený len pre súkromných používateľov
|
|
45
194
|
title: Formulár je uzavretý.
|
|
195
|
+
questionnaire_js_disabled:
|
|
196
|
+
body: Niektoré funkcie tohto formulára budú vypnuté. Pre lepšiu skúsenosť si vo svojom prehliadači povoľte JavaScript.
|
|
197
|
+
title: JavaScript je vypnutý
|
|
198
|
+
questionnaire_not_published:
|
|
199
|
+
body: Tento formulár zatiaľ nie je zverejnený.
|
|
200
|
+
questionnaire_responded:
|
|
201
|
+
body: Na tento formulár ste už odpovedali.
|
|
202
|
+
title: Už ste odpovedali
|
|
203
|
+
questionnaire_responded_edit:
|
|
204
|
+
body: Na tento formulár ste už odpovedali. %{link}
|
|
205
|
+
edit: Upraviť vaše odpovede
|
|
206
|
+
response_questionnaire:
|
|
207
|
+
already_have_an_account?: Už máte účet?
|
|
208
|
+
are_you_new?: Nový používateľ?
|
|
209
|
+
sign_in_description: Prihláste sa, aby ste sa mohli zúčastniť prieskumu
|
|
210
|
+
sign_up_description: Vytvorte si účastnícky účet, aby ste sa mohli zúčastniť prieskumu
|
|
211
|
+
title: Odpovedať na formulár
|
|
46
212
|
tos_agreement: Účasťou súhlasíte s našimi Podmienkami použitia
|
|
47
213
|
step_navigation:
|
|
48
214
|
show:
|
|
215
|
+
are_you_sure_edit_guest: Ak chcete mať možnosť neskôr upraviť svoje odpovede, musíte sa prihlásiť alebo si vytvoriť účet.
|
|
216
|
+
are_you_sure_no_edit: Túto akciu nie je možné vrátiť späť a nebudete môcť upraviť svoje odpovede. Ste si istí?
|
|
217
|
+
back: Späť
|
|
218
|
+
continue: Pokračovať
|
|
219
|
+
disallowed: Nemáte povolenie upravovať svoje odpovede.
|
|
49
220
|
submit: Poslať
|
|
221
|
+
user_responses_serializer:
|
|
222
|
+
body: Odpoveď
|
|
223
|
+
completion: Dokončenie
|
|
224
|
+
created_at: Odpovedané dňa
|
|
225
|
+
id: ID odpovede
|
|
226
|
+
ip_hash: IP Hash
|
|
227
|
+
question: Otázka
|
|
228
|
+
registered: Registrovaný
|
|
229
|
+
session_token: Identifikátor používateľa
|
|
230
|
+
unregistered: Neregistrovaný
|
|
231
|
+
user_status: Stav používateľa
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
|
|
5
|
+
shared_examples_for "questionnaire admin access" do |denied_error:, allow_process_admin: true|
|
|
6
|
+
context "when the user is not an admin", driver: :rack_test do
|
|
7
|
+
let(:regular_user) { create(:user, :confirmed, organization:) }
|
|
8
|
+
let(:target_path) { manage_questions_path }
|
|
9
|
+
|
|
10
|
+
before do
|
|
11
|
+
login_as regular_user, scope: :user
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
before do
|
|
15
|
+
allow(Rails.application).to \
|
|
16
|
+
receive(:env_config).with(no_args).and_wrap_original do |m, *|
|
|
17
|
+
m.call.merge(
|
|
18
|
+
"action_dispatch.show_exceptions" => true,
|
|
19
|
+
"action_dispatch.show_detailed_exceptions" => false
|
|
20
|
+
)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
visit target_path
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it "leads to an error" do
|
|
27
|
+
denied_response = case denied_error
|
|
28
|
+
when 403
|
|
29
|
+
page.status_code == 403 || page.has_content?("You are not authorized to perform this action")
|
|
30
|
+
when 404
|
|
31
|
+
page.status_code == 404 || page.has_content?("The page you are looking for cannot be found")
|
|
32
|
+
else
|
|
33
|
+
raise ArgumentError, "unsupported denied_error: #{denied_error.inspect}. Use 403 or 404"
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
expect(denied_response).to be(true)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
if allow_process_admin
|
|
41
|
+
context "when the user is a process admin" do
|
|
42
|
+
let(:process_admin) { create(:process_admin, :confirmed, participatory_process:) }
|
|
43
|
+
|
|
44
|
+
it "allows access to the questionnaire" do
|
|
45
|
+
login_as process_admin, scope: :user
|
|
46
|
+
visit manage_questions_path
|
|
47
|
+
|
|
48
|
+
expect(page).to have_current_path(manage_questions_path)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
else
|
|
52
|
+
context "when the user is a process admin", driver: :rack_test do
|
|
53
|
+
let(:participatory_process) { create(:participatory_process, organization:) }
|
|
54
|
+
let(:process_admin) { create(:process_admin, :confirmed, participatory_process:) }
|
|
55
|
+
|
|
56
|
+
before do
|
|
57
|
+
login_as process_admin, scope: :user
|
|
58
|
+
|
|
59
|
+
allow(Rails.application).to \
|
|
60
|
+
receive(:env_config).with(no_args).and_wrap_original do |m, *|
|
|
61
|
+
m.call.merge(
|
|
62
|
+
"action_dispatch.show_exceptions" => true,
|
|
63
|
+
"action_dispatch.show_detailed_exceptions" => false
|
|
64
|
+
)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
visit manage_questions_path
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
it "denies access to the questionnaire" do
|
|
71
|
+
denied_response = case denied_error
|
|
72
|
+
when 403
|
|
73
|
+
page.status_code == 403 || page.has_content?("You are not authorized to perform this action")
|
|
74
|
+
when 404
|
|
75
|
+
page.status_code == 404 || page.has_content?("The page you are looking for cannot be found")
|
|
76
|
+
else
|
|
77
|
+
raise ArgumentError, "unsupported denied_error: #{denied_error.inspect}. Use 403 or 404"
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
expect(denied_response).to be(true)
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
context "when the user is an admin" do
|
|
86
|
+
let(:admin) { create(:user, :admin, :confirmed, organization:) }
|
|
87
|
+
|
|
88
|
+
it "allows access to the questionnaire" do
|
|
89
|
+
login_as admin, scope: :user
|
|
90
|
+
visit manage_questions_path
|
|
91
|
+
|
|
92
|
+
expect(page).to have_current_path(manage_questions_path)
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
|
|
5
|
+
shared_examples_for "questionnaire admin controller permissions" do
|
|
6
|
+
describe "GET #edit" do
|
|
7
|
+
let(:action) { :edit }
|
|
8
|
+
|
|
9
|
+
it "enforces permission to update the questionnaire" do
|
|
10
|
+
expect(controller).to receive(:enforce_permission_to).with(:update, permission_subject, questionnaire:)
|
|
11
|
+
get action
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
describe "PATCH #update" do
|
|
16
|
+
let(:action) { :update }
|
|
17
|
+
|
|
18
|
+
it "enforces permission to update the questionnaire" do
|
|
19
|
+
expect(controller).to receive(:enforce_permission_to).with(:update, permission_subject, questionnaire:)
|
|
20
|
+
patch action, params: { questionnaire: {} }
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
describe "GET #edit_questions" do
|
|
25
|
+
let(:action) { :edit_questions }
|
|
26
|
+
|
|
27
|
+
it "enforces permission to update the questionnaire" do
|
|
28
|
+
expect(controller).to receive(:enforce_permission_to).with(:update, permission_subject, questionnaire:)
|
|
29
|
+
get action
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
describe "PATCH #update_questions" do
|
|
34
|
+
let(:action) { :update_questions }
|
|
35
|
+
|
|
36
|
+
it "enforces permission to update the questionnaire" do
|
|
37
|
+
expect(controller).to receive(:enforce_permission_to).with(:update, permission_subject, questionnaire:)
|
|
38
|
+
patch action, params: { questions: {} }
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: decidim-forms
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.31.
|
|
4
|
+
version: 0.31.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Josep Jaume Rey Peroy
|
|
@@ -11,7 +11,7 @@ authors:
|
|
|
11
11
|
autorequire:
|
|
12
12
|
bindir: bin
|
|
13
13
|
cert_chain: []
|
|
14
|
-
date: 2026-
|
|
14
|
+
date: 2026-05-12 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: decidim-core
|
|
@@ -19,42 +19,42 @@ dependencies:
|
|
|
19
19
|
requirements:
|
|
20
20
|
- - '='
|
|
21
21
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: 0.31.
|
|
22
|
+
version: 0.31.5
|
|
23
23
|
type: :runtime
|
|
24
24
|
prerelease: false
|
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
26
|
requirements:
|
|
27
27
|
- - '='
|
|
28
28
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: 0.31.
|
|
29
|
+
version: 0.31.5
|
|
30
30
|
- !ruby/object:Gem::Dependency
|
|
31
31
|
name: decidim-admin
|
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
|
33
33
|
requirements:
|
|
34
34
|
- - '='
|
|
35
35
|
- !ruby/object:Gem::Version
|
|
36
|
-
version: 0.31.
|
|
36
|
+
version: 0.31.5
|
|
37
37
|
type: :development
|
|
38
38
|
prerelease: false
|
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
|
40
40
|
requirements:
|
|
41
41
|
- - '='
|
|
42
42
|
- !ruby/object:Gem::Version
|
|
43
|
-
version: 0.31.
|
|
43
|
+
version: 0.31.5
|
|
44
44
|
- !ruby/object:Gem::Dependency
|
|
45
45
|
name: decidim-dev
|
|
46
46
|
requirement: !ruby/object:Gem::Requirement
|
|
47
47
|
requirements:
|
|
48
48
|
- - '='
|
|
49
49
|
- !ruby/object:Gem::Version
|
|
50
|
-
version: 0.31.
|
|
50
|
+
version: 0.31.5
|
|
51
51
|
type: :development
|
|
52
52
|
prerelease: false
|
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
|
54
54
|
requirements:
|
|
55
55
|
- - '='
|
|
56
56
|
- !ruby/object:Gem::Version
|
|
57
|
-
version: 0.31.
|
|
57
|
+
version: 0.31.5
|
|
58
58
|
description: A forms gem for decidim.
|
|
59
59
|
email:
|
|
60
60
|
- josepjaume@gmail.com
|
|
@@ -287,6 +287,8 @@ files:
|
|
|
287
287
|
- lib/decidim/forms/test/shared_examples/manage_questionnaires/draggable_behavior.rb
|
|
288
288
|
- lib/decidim/forms/test/shared_examples/manage_questionnaires/update_display_conditions.rb
|
|
289
289
|
- lib/decidim/forms/test/shared_examples/manage_questionnaires/update_questions.rb
|
|
290
|
+
- lib/decidim/forms/test/shared_examples/questionnaire_admin_access.rb
|
|
291
|
+
- lib/decidim/forms/test/shared_examples/questionnaire_admin_controller_permissions.rb
|
|
290
292
|
- lib/decidim/forms/user_responses_serializer.rb
|
|
291
293
|
- lib/decidim/forms/version.rb
|
|
292
294
|
homepage: https://decidim.org
|