decidim-file_authorization_handler 0.31.6.2 → 0.31.6.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f9bfe24911c0472f08d4b8801c889913bc2faab0fbda5eaf678b9af28d6216e
4
- data.tar.gz: f433053c3edb20160f3d3a793bc4b8db22fa4b3ac48f94c6dc1234ff058fe7de
3
+ metadata.gz: 2fde3cf7231be2ff3ac85ab43795028461a08c2bcde9697fb1ba924df92f252e
4
+ data.tar.gz: e6000774d125dddd928869d21c2f038510fe450c966274d7f7285caa379a4620
5
5
  SHA512:
6
- metadata.gz: fc59d1bc16eb4d823ae78f69434885199a4403f1235ca05918d3fc7b109760189c90e840f3f8c4ff4770939c220fb2ff0a56f05047820e25e10cdf268d121574
7
- data.tar.gz: 40b6248af89c9cce82e8078dc45815538d7c7a209566b06da90fe92498f45037be1a2a60ac5f195e2deb8f6dcf76cfb7f88f4de2972f5a1637ebfecb4012ce77
6
+ metadata.gz: 4f0a1aaf9e9066104e7d11960c19896e3dbee1a7c908bc50343c52930c2fa524c6e90149126d952b486e309d50a0191bdb1cff17ab7065c1e7f0b091d7d17653
7
+ data.tar.gz: ef1a7e004a53d7464aef6e0d82f27db2406bcfceffaa6170190ba4526fa2381943f19e5ccbea1d6bff43b313fd90a7fb493cd747bcf3befe6786619fad561793
data/README.md CHANGED
@@ -17,10 +17,20 @@ It has an admin controller to upload CSV files with the information. When
17
17
  importing files all records are inserted and the duplicates are removed in a
18
18
  background job for performance reasons.
19
19
 
20
- To keep the plugin simple the uploaded file is processed when the file is
21
- uploaded.
22
- Uploading the file to a temporary storage system and processing it in
23
- background is kept out of the scope for the first release.
20
+ To keep the plugin simple the uploaded file is processed when the file is uploaded.
21
+ Uploading the file to a temporary storage system and processing it in background is kept out of the scope for the first release.
22
+
23
+ ### Ephemeral authorization handler
24
+
25
+ The optional ephemeral authorization workflow can be enabled by setting the
26
+ `ENABLE_EPHEMERAL_FILE_AUTHORIZATION_HANDLER` environment variable to `true`:
27
+
28
+ ```bash
29
+ ENABLE_EPHEMERAL_FILE_AUTHORIZATION_HANDLER=true
30
+ ```
31
+
32
+ The regular `file_authorization_handler` workflow is always available.
33
+ When `ENABLE_EPHEMERAL_FILE_AUTHORIZATION_HANDLER=true`, the `ephemeral_file_authorization_handler` workflow is also registered. Ephemeral authorizations expire after one hour and can be renewed every five minutes. The option is disabled by default.
24
34
 
25
35
  ### CSV file format
26
36
 
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ # A subclass of FileAuthorizationHandler for ephemeral verification workflows.
4
+ # It excludes tos_agreement from form_attributes because the verifications view
5
+ # already renders it as a proper checkbox via the _tos_acceptance_field partial.
6
+ #
7
+ # The class name matches the workflow registration name (:ephemeral_file_authorization_handler)
8
+ # so that handler_name is consistent across the hidden field, the authorization record,
9
+ # and the permission check.
10
+ class EphemeralFileAuthorizationHandler < FileAuthorizationHandler
11
+ def form_attributes
12
+ attributes.except(*%w(id user tos_agreement)).keys
13
+ end
14
+
15
+ def handler_name
16
+ +"ephemeral_file_authorization_handler"
17
+ end
18
+ end
@@ -140,6 +140,7 @@ ignore_missing:
140
140
  # - 'errors.messages.{accepted,blank,invalid,too_short,too_long}'
141
141
  # - '{devise,simple_form}.*'
142
142
  - '{activemodel,census_authorization}.*'
143
+ - 'decidim.authorization_handlers.*'
143
144
 
144
145
  ## Consider these keys used:
145
146
  ignore_unused:
@@ -150,6 +151,7 @@ ignore_unused:
150
151
  # - 'simple_form.{error_notification,required}.:'
151
152
  - '{activemodel,census_authorization}.*'
152
153
  - 'decidim.authorization_handlers.file_authorization_handler.*'
154
+ - 'decidim.authorization_handlers.ephemeral_file_authorization_handler.*'
153
155
  - 'decidim.file_authorization_handler.*'
154
156
  - 'decidim.verifications.authorizations.first_login.actions.file_authorization_handler'
155
157
 
@@ -13,6 +13,12 @@ ca:
13
13
  year: Any
14
14
  decidim:
15
15
  authorization_handlers:
16
+ ephemeral_file_authorization_handler:
17
+ explanation: Autoritza el teu compte d'usuari contra el cens de la Organització
18
+ fields:
19
+ birthdate: Data de naixement
20
+ name: Cens Organització
21
+ type: CSV
16
22
  file_authorization_handler:
17
23
  explanation: Autoritza el teu compte d'usuari contra el cens de la Organització
18
24
  fields:
@@ -40,7 +46,7 @@ ca:
40
46
  data: Hi ha un total de %{count} registres carregats. La última càrrega va ser el dia %{due_date}
41
47
  empty: Encara no hi ha dades censals carregades. Utilitza el següent formulari per importar-lo utilitzant un fitxer CSV.
42
48
  import_csv: Importa CSV
43
- title: Dades del cens carregat
49
+ title: Dades del cens carregades
44
50
  errors:
45
51
  messages:
46
52
  not_censed: No hem pogut trobar el teu document d'identitat amb aquesta data de naixement al padró municipal. Si les dades són correctes i el problema persisteix, siusplau, posa't en contacte amb un administrador.
@@ -13,6 +13,12 @@ en:
13
13
  year: Year
14
14
  decidim:
15
15
  authorization_handlers:
16
+ ephemeral_file_authorization_handler:
17
+ explanation: Authorize your user account against Organization's Census
18
+ fields:
19
+ birthdate: Birthdate
20
+ name: Organization's Census
21
+ type: CSV
16
22
  file_authorization_handler:
17
23
  explanation: Authorize your user account against Organization's Census
18
24
  fields:
@@ -13,6 +13,12 @@ es:
13
13
  year: Año
14
14
  decidim:
15
15
  authorization_handlers:
16
+ ephemeral_file_authorization_handler:
17
+ explanation: Autoriza tu cuenta de usuario contra el Censo de la Organización
18
+ fields:
19
+ birthdate: Fecha de nacimiento
20
+ name: Censo de la Organización
21
+ type: CSV
16
22
  file_authorization_handler:
17
23
  explanation: Autoriza tu cuenta de usuario contra el Censo de la Organización
18
24
  fields:
@@ -10,6 +10,17 @@ module Decidim
10
10
  Decidim::Verifications.register_workflow(:file_authorization_handler) do |workflow|
11
11
  workflow.form = "FileAuthorizationHandler"
12
12
  end
13
+
14
+ next unless ENV.fetch("ENABLE_EPHEMERAL_FILE_AUTHORIZATION_HANDLER", "false") == "true"
15
+
16
+ # Enable Ephemeral Verification
17
+ Decidim::Verifications.register_workflow(:ephemeral_file_authorization_handler) do |workflow|
18
+ workflow.ephemeral = true
19
+ workflow.form = "EphemeralFileAuthorizationHandler"
20
+ workflow.expires_in = 1.hour
21
+ workflow.renewable = true
22
+ workflow.time_between_renewals = 5.minutes
23
+ end
13
24
  end
14
25
  end
15
26
  end
@@ -7,6 +7,6 @@ module Decidim
7
7
  # Uses the latest matching Decidim version for
8
8
  # - major, minor and patch
9
9
  # - the optional extra number is related to this module's patches
10
- VERSION = "#{DECIDIM_VERSION}.2".freeze
10
+ VERSION = "#{DECIDIM_VERSION}.3".freeze
11
11
  end
12
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-file_authorization_handler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.31.6.2
4
+ version: 0.31.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Gómez
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2026-08-05 00:00:00.000000000 Z
13
+ date: 2026-08-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: decidim
@@ -72,6 +72,7 @@ files:
72
72
  - app/models/decidim/file_authorization_handler/csv_data.rb
73
73
  - app/models/decidim/file_authorization_handler/status.rb
74
74
  - app/permissions/decidim/file_authorization_handler/admin/permissions.rb
75
+ - app/services/ephemeral_file_authorization_handler.rb
75
76
  - app/services/file_authorization_handler.rb
76
77
  - app/views/decidim/file_authorization_handler/admin/censuses/_upload_info.html.erb
77
78
  - app/views/decidim/file_authorization_handler/admin/censuses/new.html.erb