decidim-file_authorization_handler 0.30.1.3 → 0.31.6.1

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: 5300c259d13967c0aeae37a9efa24fc1c6b49cae5ed8d488a16cbae74a95b44b
4
- data.tar.gz: 43c12dc6425fa9e1608f95effd41d1ca67495a0206eca6e820c758c5b3e5b6f8
3
+ metadata.gz: 94f5b784d3c2b3056f62b7675f565cf9c697eb6cee0e48a5ddb67de43a44317b
4
+ data.tar.gz: c622e0561eabfe6267258c4cf31131c35cc8171274fbcf2f28cb4105ada2ff5a
5
5
  SHA512:
6
- metadata.gz: 4a9c656fdd6d3cfc19c74b2379a8bb8a7691d9a7562b31f7609990673c6ee51c14d2dbfa440a6c8fe4e035c0a7a766e41981ddeb93e2cc986d9c571259dc1326
7
- data.tar.gz: 2c2bd57ab8f753831f833d5765b17ef59ade68f2573f80b8f207da9ee69d4faaa400a39621f1ceb5fd3d9f5134900e6388a326d2af2a911b291799ced553104f
6
+ metadata.gz: 12b90762a42d545049b9bb34d53a04f6d3849e7896da9fd45e09578b2e3b30b18d140855a0bf1fe48f4e221f7a46480aacbcbc10bbef92fc6a5ff0ecef829a4f
7
+ data.tar.gz: 3455c7254cb35b833cd8c92373decd9563ac7713fe806927cbf1932fe06d44e9940e1ea81161012c2fae425fcb9fc1ae8bc09b90c20de3be2238df3a12cd71b1
data/README.md CHANGED
@@ -22,18 +22,6 @@ uploaded.
22
22
  Uploading the file to a temporary storage system and processing it in
23
23
  background is kept out of the scope for the first release.
24
24
 
25
- ### Ephemeral authorization handler
26
-
27
- The optional ephemeral authorization workflow can be enabled by setting the
28
- `ENABLE_EPHEMERAL_FILE_AUTHORIZATION_HANDLER` environment variable to `true`:
29
-
30
- ```bash
31
- ENABLE_EPHEMERAL_FILE_AUTHORIZATION_HANDLER=true
32
- ```
33
-
34
- The regular `file_authorization_handler` workflow is always available.
35
- 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.
36
-
37
25
  ### CSV file format
38
26
 
39
27
  The CSV file format is not configurable, but is extendable. The plugin expects a comma separated
@@ -9,6 +9,11 @@ module Decidim
9
9
  @status = Status.new(current_organization)
10
10
  end
11
11
 
12
+ def new
13
+ enforce_permission_to :create, :authorization
14
+ @status = Status.new(current_organization)
15
+ end
16
+
12
17
  def create
13
18
  enforce_permission_to :create, :authorization
14
19
  if params[:file]
@@ -27,7 +27,7 @@ module Decidim
27
27
  return "" if id_document.blank?
28
28
 
29
29
  Digest::SHA256.hexdigest(
30
- "#{id_document}-#{Rails.application.secrets.secret_key_base}"
30
+ "#{id_document}-#{ENV.fetch("SECRET_KEY_BASE", nil)}"
31
31
  )
32
32
  end
33
33
 
@@ -49,7 +49,7 @@ class FileAuthorizationHandler < Decidim::AuthorizationHandler
49
49
  def unique_id
50
50
  return nil unless organization
51
51
 
52
- Digest::SHA256.hexdigest("#{census_for_user&.id_document}-#{organization.id}-#{Rails.application.secrets.secret_key_base}")
52
+ Digest::SHA256.hexdigest("#{census_for_user&.id_document}-#{organization.id}-#{ENV.fetch("SECRET_KEY_BASE", nil)}")
53
53
  end
54
54
 
55
55
  def census_for_user
@@ -0,0 +1,26 @@
1
+ <% add_decidim_page_title(t("admin.new.title", scope: "decidim.file_authorization_handler")) %>
2
+ <div class="item_show__header">
3
+ <h2 class="item_show__header-title">
4
+ <%= t("admin.new.title", scope: "decidim.file_authorization_handler") %>
5
+ </h2>
6
+ </div>
7
+ <div class="card-section">
8
+ <div class="row column">
9
+ <%= render partial: "upload_info" %>
10
+ </div>
11
+
12
+ <div class="row column">
13
+ <%= form_tag censuses_path, multipart: true, class: "form" do %>
14
+ <div class="font-semibold">
15
+ <%= label_tag :name, t("admin.new.file", scope: "decidim.file_authorization_handler") %>
16
+ <%= file_field_tag :file, accept: ".csv" %>
17
+ </div>
18
+
19
+ <div class="item__edit-sticky">
20
+ <div class="item__edit-sticky-container">
21
+ <%= submit_tag t("admin.new.submit", scope: "decidim.file_authorization_handler"), class: "button button__sm button__secondary" %>
22
+ </div>
23
+ </div>
24
+ <% end %>
25
+ </div>
26
+ </div>
@@ -1,44 +1,26 @@
1
1
  <% add_decidim_page_title(t("admin.show.title", scope: "decidim.file_authorization_handler")) %>
2
2
 
3
3
  <div class="card">
4
+ <div class="item_show__header item_show__header--with-action-options">
5
+ <h1 class="item_show__header-title">
6
+ <%= t("admin.show.title", scope: "decidim.file_authorization_handler") %>
7
+ <%= link_to t("admin.show.import_csv", scope: "decidim.file_authorization_handler"), new_censuses_path, class: "button button__sm button__transparent-secondary" %>
8
+ <% if @status.count > 0 %>
9
+ <%= link_to t("admin.destroy.title", scope: "decidim.file_authorization_handler"),
10
+ censuses_path,
11
+ method: :delete,
12
+ class: "button button__sm button__secondary alert hollow tiny button--title destroy",
13
+ data: { confirm: t("admin.destroy.confirm", scope: "decidim.file_authorization_handler") } %>
14
+ <% end %>
15
+ </h1>
16
+ </div>
4
17
  <div class="card-section p-4">
5
- <div class="item_show__header">
6
- <h1 class="item_show__header-title">
7
- <%= t("admin.show.title", scope: "decidim.file_authorization_handler") %>
8
- <% if @status.count > 0 %>
9
- <%= link_to t('decidim.file_authorization_handler.admin.destroy.title'),
10
- censuses_path,
11
- method: :delete,
12
- class: 'button button__sm button__secondary alert hollow tiny button--title destroy',
13
- data: { confirm: t('decidim.file_authorization_handler.admin.destroy.confirm') } %>
14
- <% end %>
15
- </h1>
16
- </div>
17
18
  <% if @status.count > 0 %>
18
- <p><%= t('decidim.file_authorization_handler.admin.show.data', count: @status.count,
19
+ <p><%= t("admin.show.data", scope: "decidim.file_authorization_handler", count: @status.count,
19
20
  due_date: l(@status.last_import_at, format: :long)) %>
20
21
  </p>
21
22
  <% else %>
22
- <p><%= t('admin.show.empty', scope: 'decidim.file_authorization_handler') %></p>
23
+ <p><%= t("admin.show.empty", scope: "decidim.file_authorization_handler") %></p>
23
24
  <% end %>
24
25
  </div>
25
-
26
- <div id="wrapper-action-view">
27
- <div class="card-section p-4">
28
- <div class="item_show__header">
29
-
30
- <h1 class="item_show__header-title">
31
- <%= t("admin.new.title", scope: "decidim.file_authorization_handler") %><div class="card-section p-4">
32
- </h1>
33
- </div>
34
-
35
- <%= render "upload_info" %>
36
-
37
- <%= form_tag censuses_path, multipart: true, class: 'form' do %>
38
- <%= label_tag :name, t('admin.new.file', scope: 'decidim.file_authorization_handler') %>
39
- <%= file_field_tag :file, accept: ".csv" %>
40
- <%= submit_tag t('admin.new.submit', scope: 'decidim.file_authorization_handler'), class: 'button button__sm button__secondary hollow tiny button--title' %>
41
- <% end %>
42
- </div>
43
- </div>
44
26
  </div>
@@ -12,12 +12,6 @@ ca:
12
12
  year: Any
13
13
  decidim:
14
14
  authorization_handlers:
15
- ephemeral_file_authorization_handler:
16
- explanation: Autoritza el teu compte d'usuari contra el cens de la Organització
17
- fields:
18
- birthdate: Data de naixement
19
- name: Cens Organització
20
- type: CSV
21
15
  file_authorization_handler:
22
16
  name: Cens Organització
23
17
  explanation: Autoritza el teu compte d'usuari contra el cens de la Organització
@@ -45,8 +39,9 @@ ca:
45
39
  census: Pujar cens
46
40
  show:
47
41
  title: Dades del cens carregat
42
+ import_csv: Importa un CSV
48
43
  data: Hi ha un total de %{count} registres carregats. La última càrrega va ser el dia %{due_date}
49
- empty: Encara no hi ha dades censals carregades. Utilitza el següent formulari per importar-lo utilitzant un fitxer CSV.
44
+ empty: Encara no hi ha dades censals carregades. Utilitza el botó "Importa un CSV" de dalt per importar un fitxer CSV.
50
45
  new:
51
46
  title: Pujar un nou cens
52
47
  file: Arxiu excel .csv amb les dades del cens
@@ -12,12 +12,6 @@ en:
12
12
  year: Year
13
13
  decidim:
14
14
  authorization_handlers:
15
- ephemeral_file_authorization_handler:
16
- explanation: Authorize your user account against Organization's Census
17
- fields:
18
- birthdate: Birthdate
19
- name: Organization's Census
20
- type: CSV
21
15
  file_authorization_handler:
22
16
  name: Organization's Census
23
17
  explanation: Authorize your user account against Organization's Census
@@ -45,8 +39,9 @@ en:
45
39
  census: Upload census
46
40
  show:
47
41
  title: Current census data
42
+ import_csv: Import CSV
48
43
  data: There are %{count} records loaded in total. Last upload date was on %{due_date}
49
- empty: There are no census data. Use the form below to import it using a CSV file.
44
+ empty: There are no census data. Use the "Import CSV" button above to import it using a CSV file.
50
45
  new:
51
46
  title: Upload a new census
52
47
  file: Excel .csv file with census data
@@ -12,12 +12,6 @@ es:
12
12
  year: Año
13
13
  decidim:
14
14
  authorization_handlers:
15
- ephemeral_file_authorization_handler:
16
- explanation: Autoriza tu cuenta de usuario contra el Censo de la Organización
17
- fields:
18
- birthdate: Fecha de nacimiento
19
- name: Censo de la Organización
20
- type: CSV
21
15
  file_authorization_handler:
22
16
  name: Censo de la Organización
23
17
  explanation: Autoriza tu cuenta de usuario contra el Censo de la Organización
@@ -25,7 +19,7 @@ es:
25
19
  fields:
26
20
  birthdate: Fecha de nacimiento
27
21
  file_authorization_handler:
28
- upload_file:
22
+ upload_info:
29
23
  format: 'Debe ser un fichero generado por excel y exportado en formato CSV con dos columnas:'
30
24
  errors:
31
25
  messages:
@@ -45,8 +39,9 @@ es:
45
39
  census: Subir censo
46
40
  show:
47
41
  title: Datos de censo actuales
42
+ import_csv: Importar CSV
48
43
  data: Hay un total de %{count} registros cargados. La última carga fue el día %{due_date}
49
- empty: No hay datos censales. Usa el formulario a continuación para importar usando un fichero CSV.
44
+ empty: No hay datos censales. Usa el botón "Importar CSV" de arriba para importar un fichero CSV.
50
45
  new:
51
46
  title: Subir un nuevo censo
52
47
  file: Archivo excel .csv con los datos del censo
@@ -6,7 +6,7 @@ module Decidim
6
6
  isolate_namespace Decidim::FileAuthorizationHandler::Admin
7
7
 
8
8
  routes do
9
- resource :censuses, only: [:show, :create, :destroy]
9
+ resource :censuses, only: [:show, :new, :create, :destroy]
10
10
  end
11
11
 
12
12
  initializer "decidim_file_authorization.add_admin_menu" do
@@ -10,17 +10,6 @@ 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
24
13
  end
25
14
  end
26
15
  end
@@ -2,11 +2,11 @@
2
2
 
3
3
  module Decidim
4
4
  module FileAuthorizationHandler
5
- DECIDIM_VERSION = "0.30.1"
5
+ DECIDIM_VERSION = "0.31.6"
6
6
 
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}.3".freeze
10
+ VERSION = "#{DECIDIM_VERSION}.1".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.30.1.3
4
+ version: 0.31.6.1
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-27 00:00:00.000000000 Z
13
+ date: 2026-08-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: decidim
@@ -18,42 +18,42 @@ dependencies:
18
18
  requirements:
19
19
  - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: 0.30.1
21
+ version: 0.31.6
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - "~>"
27
27
  - !ruby/object:Gem::Version
28
- version: 0.30.1
28
+ version: 0.31.6
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: decidim-admin
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - "~>"
34
34
  - !ruby/object:Gem::Version
35
- version: 0.30.1
35
+ version: 0.31.6
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: 0.30.1
42
+ version: 0.31.6
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: decidim-dev
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: 0.30.1
49
+ version: 0.31.6
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: 0.30.1
56
+ version: 0.31.6
57
57
  description: Census uploads via csv files
58
58
  email:
59
59
  - hola@marsbased.com
@@ -72,9 +72,9 @@ 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
76
75
  - app/services/file_authorization_handler.rb
77
76
  - app/views/decidim/file_authorization_handler/admin/censuses/_upload_info.html.erb
77
+ - app/views/decidim/file_authorization_handler/admin/censuses/new.html.erb
78
78
  - app/views/decidim/file_authorization_handler/admin/censuses/show.html.erb
79
79
  - app/views/layouts/file_authorization_handler/application.html.erb
80
80
  - config/locales/ca.yml
@@ -1,18 +0,0 @@
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