decidim-direct_verifications 0.22 → 1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +33 -3
  3. data/app/commands/decidim/direct_verifications/verification/create_import.rb +59 -0
  4. data/app/controllers/decidim/direct_verifications/verification/admin/authorizations_controller.rb +42 -0
  5. data/app/controllers/decidim/direct_verifications/verification/admin/direct_verifications_controller.rb +22 -20
  6. data/app/controllers/decidim/direct_verifications/verification/admin/imports_controller.rb +55 -0
  7. data/app/forms/decidim/direct_verifications/registration_form.rb +8 -0
  8. data/app/forms/decidim/direct_verifications/verification/create_import_form.rb +43 -0
  9. data/app/jobs/decidim/direct_verifications/authorize_users_job.rb +36 -0
  10. data/app/jobs/decidim/direct_verifications/base_import_job.rb +54 -0
  11. data/app/jobs/decidim/direct_verifications/register_users_job.rb +20 -0
  12. data/app/jobs/decidim/direct_verifications/revoke_users_job.rb +18 -0
  13. data/app/mailers/decidim/direct_verifications/import_mailer.rb +27 -0
  14. data/app/mailers/decidim/direct_verifications/stats.rb +23 -0
  15. data/app/packs/entrypoints/decidim_direct_verifications.js +4 -0
  16. data/app/packs/entrypoints/decidim_direct_verifications.scss +1 -0
  17. data/app/packs/src/decidim/direct_verifications/admin/checkboxes.js +7 -0
  18. data/app/packs/stylesheets/decidim/direct_verifications/admin/authorizations.scss +17 -0
  19. data/app/views/decidim/direct_verifications/import_mailer/finished_processing.html.erb +7 -0
  20. data/app/views/decidim/direct_verifications/import_mailer/finished_processing.text.erb +7 -0
  21. data/app/views/decidim/direct_verifications/verification/admin/authorizations/index.html.erb +43 -0
  22. data/app/views/decidim/direct_verifications/verification/admin/direct_verifications/index.html.erb +5 -4
  23. data/app/views/decidim/direct_verifications/verification/admin/imports/new.html.erb +50 -0
  24. data/config/assets.rb +24 -0
  25. data/config/initializers/mail_previews.rb +5 -0
  26. data/config/locales/ca.yml +47 -33
  27. data/config/locales/cs.yml +84 -0
  28. data/config/locales/en.yml +44 -13
  29. data/config/locales/es.yml +45 -31
  30. data/config/locales/fr.yml +84 -0
  31. data/lib/decidim/direct_verifications/authorize_user.rb +64 -0
  32. data/lib/decidim/direct_verifications/instrumenter.rb +58 -0
  33. data/lib/decidim/direct_verifications/parsers/base_parser.rb +37 -0
  34. data/lib/decidim/direct_verifications/parsers/metadata_parser.rb +48 -0
  35. data/lib/decidim/direct_verifications/parsers/name_parser.rb +40 -0
  36. data/lib/decidim/direct_verifications/parsers.rb +11 -0
  37. data/lib/decidim/direct_verifications/register_user.rb +54 -0
  38. data/lib/decidim/direct_verifications/revoke_user.rb +45 -0
  39. data/lib/decidim/direct_verifications/tests/factories.rb +11 -0
  40. data/lib/decidim/direct_verifications/tests/verification_controller_examples.rb +13 -8
  41. data/lib/decidim/direct_verifications/user_processor.rb +17 -101
  42. data/lib/decidim/direct_verifications/user_stats.rb +5 -5
  43. data/lib/decidim/direct_verifications/verification/admin_engine.rb +4 -2
  44. data/lib/decidim/direct_verifications/version.rb +3 -3
  45. data/lib/decidim/direct_verifications.rb +24 -1
  46. data/package.json +192 -0
  47. metadata +41 -11
  48. data/app/assets/config/direct_verifications_admin_manifest.js +0 -1
  49. data/app/assets/javascripts/decidim/direct_verifications/verification/admin/direct_verifications_admin.js.es6 +0 -7
  50. data/lib/decidim/direct_verifications/config.rb +0 -23
@@ -3,13 +3,14 @@
3
3
  <h2 class="card-title">
4
4
  <%= t("admin.index.title", scope: "decidim.direct_verifications.verification") %>
5
5
  <%= link_to t("admin.index.stats", scope: "decidim.direct_verifications.verification"), stats_path, class: "button tiny button--title" %>
6
+ <%= link_to t("admin.index.authorizations", scope: "decidim.direct_verifications.verification"), authorizations_path, class: "button tiny button--title" %>
6
7
  </h2>
7
8
  </div>
8
9
  <div class="card-section">
9
- <p><%= t("decidim.direct_verifications.verification.admin.new.info") %></p>
10
+ <p><%= t("decidim.direct_verifications.verification.admin.new.info_html", link: new_import_path) %></p>
10
11
  <%= form_tag direct_verifications_path, multipart: true, class: "form" do %>
11
- <%= label_tag :userlist, t("admin.new.textarea", scope: "decidim.direct_verifications.verification") %>
12
- <%= text_area_tag :userlist, @userslist, rows: 10 %>
12
+ <%= label_tag :userslist, t("admin.new.textarea", scope: "decidim.direct_verifications.verification") %>
13
+ <%= text_area_tag :userslist, @userslist, rows: 10 %>
13
14
  <label>
14
15
  <%= check_box_tag :register %>
15
16
  <%= t("admin.new.register", scope: "decidim.direct_verifications.verification") %>
@@ -41,4 +42,4 @@
41
42
  </div>
42
43
  </div>
43
44
 
44
- <%= javascript_include_tag "decidim/direct_verifications/verification/admin/direct_verifications_admin" %>
45
+ <%= javascript_pack_tag "decidim_direct_verifications" %>
@@ -0,0 +1,50 @@
1
+ <div class="card">
2
+ <div class="card-divider">
3
+ <h2 class="card-title">
4
+ <%= t("admin.index.title", scope: "decidim.direct_verifications.verification") %>
5
+ <%= link_to t("admin.index.stats", scope: "decidim.direct_verifications.verification"), stats_path, class: "button tiny button--title" %>
6
+ <%= link_to t("admin.index.authorizations", scope: "decidim.direct_verifications.verification"), authorizations_path, class: "button tiny button--title" %>
7
+ </h2>
8
+ </div>
9
+ <div class="card-section">
10
+ <p><%= t("decidim.direct_verifications.verification.admin.imports.new.info") %></p>
11
+ <pre class="code-block">
12
+ <strong>email, name, membership_phone, membership_type, membership_weight</strong>
13
+ ava@example.com, Ava Hawkins, +3476318371, consumer, 1
14
+ ewan@example.com, Ewan Cooper, +34653565765, worker, 1
15
+ tilly@example.com, Tilly Jones, +34653565761, collaborator, 0.67
16
+ ...
17
+ </pre>
18
+
19
+ <%= decidim_form_for(@form, url: imports_path, html: { class: "form" }) do |form| %>
20
+ <label>
21
+ <%= check_box_tag :register %>
22
+ <%= t("admin.new.register", scope: "decidim.direct_verifications.verification") %>
23
+ <div data-alert class="callout alert hide">
24
+ <%= t("admin.direct_verifications.gdpr_disclaimer", scope: "decidim.direct_verifications.verification") %>
25
+ </div>
26
+ </label>
27
+ <label>
28
+ <%= radio_button_tag :authorize, "in" %>
29
+ <%= t("admin.new.authorize", scope: "decidim.direct_verifications.verification") %>
30
+ </label>
31
+ <label>
32
+ <%= radio_button_tag :authorize, "out" %>
33
+ <%= t("admin.new.revoke", scope: "decidim.direct_verifications.verification") %>
34
+ </label>
35
+ <label>
36
+ <%= radio_button_tag :authorize, "check", true %>
37
+ <%= t("admin.new.check", scope: "decidim.direct_verifications.verification") %>
38
+ </label>
39
+
40
+ <%= label_tag :authorization_handler, t("admin.new.authorization_handler", scope: "decidim.direct_verifications.verification") %>
41
+ <%= select_tag :authorization_handler, options_for_select(workflows, current_authorization_handler) %>
42
+
43
+ <%= form.file_field :file, label: t(".file") %>
44
+ <%= form.submit t(".submit"), class: "button" %>
45
+ <% end %>
46
+
47
+ </div>
48
+ </div>
49
+
50
+ <%= javascript_pack_tag "decidim_direct_verifications" %>
data/config/assets.rb ADDED
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is located at `config/assets.rb` of your module.
4
+
5
+ # Define the base path of your module. Please note that `Rails.root` may not be
6
+ # used because we are not inside the Rails environment when this file is loaded.
7
+ base_path = File.expand_path("..", __dir__)
8
+
9
+ # Register an additional load path for webpack. All the assets within these
10
+ # directories will be available for inclusion within the Decidim assets. For
11
+ # example, if you have `app/packs/src/decidim/foo.js`, you can include that file
12
+ # in your JavaScript entrypoints (or other JavaScript files within Decidim)
13
+ # using `import "src/decidim/foo"` after you have registered the additional path
14
+ # as follows.
15
+ Decidim::Webpacker.register_path("#{base_path}/app/packs")
16
+
17
+ # Register the entrypoints for your module. These entrypoints can be included
18
+ # within your application using `javascript_pack_tag` and if you include any
19
+ # SCSS files within the entrypoints, they become available for inclusion using
20
+ # `stylesheet_pack_tag`.
21
+ Decidim::Webpacker.register_entrypoints(
22
+ decidim_direct_verifications: "#{base_path}/app/packs/entrypoints/decidim_direct_verifications.js",
23
+ decidim_direct_verifications_css: "#{base_path}/app/packs/entrypoints/decidim_direct_verifications.scss"
24
+ )
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ Rails.application.configure do
4
+ config.action_mailer.preview_path = Decidim::DirectVerifications::Verification::Engine.root.join("spec/mailers")
5
+ end
@@ -1,4 +1,3 @@
1
- ---
2
1
  ca:
3
2
  decidim:
4
3
  admin:
@@ -11,54 +10,69 @@ ca:
11
10
  admin:
12
11
  direct_verifications:
13
12
  help:
14
- - 'Permet la introducció massiva d''usuaris per tal de:'
15
- - Registrar-los directament a la organització amb l'enviament d'invitacions
16
- - Verificar-los en qualsevol mètode de verificació actiu
17
- - Revocar la verificació en qualsevol mètode de verificació actiu
13
+ - 'Permet la introducció massiva de participants per tal de:'
14
+ - Registrar-les directament a la organització amb l'enviament d'invitacions
15
+ - Verificar-les amb qualsevol mètode de verificació actiu
16
+ - Revocar la verificació amb qualsevol mètode de verificació actiu
18
17
  direct_verifications:
19
- explanation: Verificació manual per par dels administradors de l'organització
18
+ explanation: Verificació manual per part de les administradores de l'organització
20
19
  name: Verificació directa
21
20
  direct_verifications:
22
21
  verification:
23
22
  admin:
23
+ authorizations:
24
+ index:
25
+ created_at: Data de creació
26
+ metadata: Metadades
27
+ name: Nom
28
+ new_import: Nova importació
29
+ title: Autoritzacions
30
+ user_name: Nom de la participant
24
31
  direct_verifications:
25
32
  create:
26
- authorized: S'han verificat correctament %{authorized} usuaris utilitzant
27
- [%{handler}] (%{count} detectats, %{errors} errors)
28
- info: S'han detectat %{count} usuaris, dels quals %{registered} estan
29
- registrats, %{authorized} autoritzats utilitzant [%{handler}] (%{unconfirmed}
30
- sense confirmar)
31
- registered: S'han registrat correctament %{registered} usuaris (%{count}
32
- detectats, %{errors} errors)
33
- revoked: S'ha revocat correctament la verificació de %{revoked} usuaris
34
- utilitzant [%{handler}] (%{count} detectats, %{errors} errors)
35
- gdpr_disclaimer: Feu-ho sota la vostra responsabilitat. Recordeu que heu
36
- de tenir el consentiment explícit dels vostres usuaris per registrar-los.
37
- En cas contrari, estareu infringint la regulació GDPR als països de
38
- la UE.
33
+ authorized: "S'han verificat correctament %{authorized} participants utilitzant [%{handler}] (%{count} detectats, %{errors} errors)"
34
+ info: "S'han detectat %{count} participants, de les quals %{registered} estan registrades, %{authorized} autoritzades utilitzant [%{handler}] (%{unconfirmed} sense confirmar)"
35
+ missing_header: Si us plau, proporcioneu una fila d'encapçalament
36
+ registered: "S'han registrat correctament %{registered} participants (%{count} detectades, %{errors} errors)"
37
+ revoked: S'ha revocat correctament la verificació de %{revoked} participants utilitzant [%{handler}] (%{count} detectades, %{errors} errors)
38
+ gdpr_disclaimer: Feu-ho sota la vostra responsabilitat. Recordeu que heu de tenir el consentiment explícit de les vostres participants per a registrar-les. En cas contrari, estareu infringint la regulació GDPR als països de la UE.
39
+ imports:
40
+ create:
41
+ error: No s'ha pogut importar el fitxer
42
+ success: S'ha importat el fitxer. Rebràs un email quan totes les participants hagin estat importades.
43
+ mailer:
44
+ authorized: "%{successful} participants han estat verificades utilitzant [%{handler}] (%{count} detectades, %{errors} errors)"
45
+ info: "%{count} participants detectades, de les quals %{registered} estan registrades, %{authorized} autoritzades utilitzant [%{handler}] (%{unconfirmed} sense confirmar)"
46
+ registered: "%{successful} participants han estat registrades (%{count} detectades, %{errors} errors) "
47
+ revoked: S'ha revocat correctament la verificació de %{successful} participants utilitzant [%{handler}] (%{count} detectades, %{errors} errors)
48
+ subject: Resultats de la importació
49
+ new:
50
+ file: Fitxer CSV amb dades de participants
51
+ info: Importa un fitxer CSV file amb una participant per línia copiant el format de l'exemple següent
52
+ submit: Pujar fitxer
39
53
  index:
40
- stats: Estadístiques d'usuaris
41
- title: Inscriu i autoritza usuaris
54
+ authorizations: Participants autoritzades
55
+ stats: Estadístiques de les participants
56
+ title: Inscriu i autoritza participants
42
57
  new:
43
58
  authorization_handler: Mètode de verificació
44
- authorize: Autoritza els usuaris
45
- check: Comprova l'estat dels usuaris
46
- info: Introdueix aquí els emails, un per línia. Si els emails estan precedits
47
- per un text, s'interpretarà com el nom de l'usuari
48
- register: Registra els usuaris a la plataforma (si existeixen s'ignoraran)
49
- revoke: Revoca l'autorització dels usuaris
59
+ authorize: Autoritza les participants
60
+ check: Comprova l'estat de les participants
61
+ info_html: Pots <a href=%{link}>importar un fitxer CSV</a> o introduir els emails aquí, un per línia. Si els emails estan precedits per un text, aquest s'interpretarà com el nom de la participant
62
+ register: Registra les participants a la plataforma (si existeixen s'ignoraran)
63
+ revoke: Revoca l'autorització de les participants
50
64
  submit: Envia i processa el llistat
51
- textarea: Llista d''emails
65
+ textarea: Llistat d'emails
52
66
  stats:
53
67
  index:
54
- authorized: Verificats
55
- authorized_unconfirmed: Verificats però no confirmats
68
+ authorized: Verificades
69
+ authorized_unconfirmed: Verificades però no confirmades
56
70
  global: "- Qualsevol mètode de verificació -"
57
- registered: Registrats
58
- unconfirmed: No confirmats
71
+ registered: Registrades
72
+ unconfirmed: No confirmades
59
73
  authorizations:
60
74
  new:
61
- no_action: Aquest mètode requereix que un administrador us verifiqui
75
+ no_action: Aquest mètode requereix que una administradora us verifiqui
62
76
  verifications:
63
77
  authorizations:
64
78
  first_login:
@@ -0,0 +1,84 @@
1
+ cs:
2
+ decidim:
3
+ admin:
4
+ models:
5
+ user:
6
+ fields:
7
+ roles:
8
+ participant: Účastník
9
+ authorization_handlers:
10
+ admin:
11
+ direct_verifications:
12
+ help:
13
+ - 'Umožňuje masivní zavedení uživatelů:'
14
+ - Přímá registrace v organizaci a odeslání pozvánek
15
+ - Ověřit je pomocí jakékoliv metody aktivního ověření
16
+ - Zrušit jejich ověření pomocí jakékoli metody aktivního ověření
17
+ direct_verifications:
18
+ explanation: Ruční ověření správcem organizace
19
+ name: Přímé ověření
20
+ direct_verifications:
21
+ verification:
22
+ admin:
23
+ authorizations:
24
+ index:
25
+ created_at: Vytvořeno v
26
+ metadata: Metadata
27
+ name: Název
28
+ new_import: Nový import
29
+ title: Autorizace
30
+ user_name: Uživatelské jméno
31
+ direct_verifications:
32
+ create:
33
+ authorized: "%{authorized} uživatelů bylo úspěšně ověřeno pomocí [%{handler}] (%{count} detekováno, %{errors} chyb)"
34
+ info: "Zjištěno %{count} uživatelů, z nichž %{registered} jsou registrováni, %{authorized} autorizováni pomocí [%{handler}] (%{unconfirmed} nepotvrzeno)"
35
+ missing_header: Zadejte řádek záhlaví
36
+ registered: "%{registered} uživatelů bylo úspěšně zaregistrováno (%{count} detekováno, %{errors} chyb) "
37
+ revoked: Ověření od %{revoked} uživatelů bylo zrušeno pomocí [%{handler}] (%{count} detekováno, %{errors} chyb)
38
+ gdpr_disclaimer: Udělejte to v rámci vaší odpovědnosti. Nezapomeňte, že potřebujete mít výslovný souhlas svých uživatelů, abyste je mohli zaregistrovat. V opačném případě můžete porušovat nařízení o GDPR v zemích EU.
39
+ imports:
40
+ create:
41
+ error: Při importu souboru došlo k chybě
42
+ success: Soubor byl úspěšně nahrán. Až budou importováni všichni účastníci, pošleme vám e-mail.
43
+ mailer:
44
+ authorized: "%{successful} účastníků bylo úspěšně ověřeno pomocí [%{handler}] (%{count} detekováno, %{errors} chyby)"
45
+ info: "%{count} účastníků detekováno, z toho %{registered} jsou registrováni, %{authorized} povoleno pomocí [%{handler}] (%{unconfirmed} nepotvrzeno)"
46
+ registered: "%{successful} účastníků bylo úspěšně registrováno (%{count} detekováno, %{errors} chyb) "
47
+ revoked: Ověření od %{successful} účastníků bylo zrušeno pomocí [%{handler}] (%{count} detekováno, %{errors} chyby)
48
+ subject: Výsledky importu souboru
49
+ new:
50
+ file: Soubor CSV s daty účastníků
51
+ info: Importovat CSV soubor s účastníkem na řádku, který zkopíruje formát z příkladu
52
+ submit: Nahrát soubor
53
+ index:
54
+ authorizations: Autorizovaní uživatelé
55
+ stats: Statistiky uživatelů
56
+ title: Registrovat a autorizovat uživatele
57
+ new:
58
+ authorization_handler: Ověřovací metoda
59
+ authorize: Autorizovat uživatele
60
+ check: Zkontrolovat stav uživatelů
61
+ info_html: Můžete <a href=%{link}>importovat CSV</a> nebo zde zadat e-maily, jedno na řádek. Pokud e-mailům předchází text, bude interpretován jako jméno účastníka.
62
+ register: Registrovat uživatele na platformě (pokud existují, budou ignorováni)
63
+ revoke: Zrušit autorizaci od uživatelů
64
+ submit: Odeslat a zpracovat seznam
65
+ textarea: Seznam e-mailů
66
+ stats:
67
+ index:
68
+ authorized: Autorizováno
69
+ authorized_unconfirmed: Autorizováno, ale nepotvrzeno
70
+ global: "- Jakákoli metoda ověřování -"
71
+ registered: Registrován
72
+ unconfirmed: Nepotvrzeno
73
+ authorizations:
74
+ new:
75
+ no_action: Tato metoda vyžaduje administrátora, který vás ověřuje
76
+ verifications:
77
+ authorizations:
78
+ first_login:
79
+ actions:
80
+ direct_verifications: Přímé ověření
81
+ devise:
82
+ mailer:
83
+ direct_invite:
84
+ subject: Pokyny pro pozvání
@@ -11,7 +11,7 @@ en:
11
11
  admin:
12
12
  direct_verifications:
13
13
  help:
14
- - 'Allows the massive introduction of users in order to:'
14
+ - 'Allows the massive introduction of participants in order to:'
15
15
  - Direct register in the organization and sends invitations
16
16
  - Verify them in any active verification method
17
17
  - Revoke their verification in any active verification method
@@ -21,30 +21,61 @@ en:
21
21
  direct_verifications:
22
22
  verification:
23
23
  admin:
24
+ authorizations:
25
+ index:
26
+ created_at: Created at
27
+ metadata: Metadata
28
+ name: Name
29
+ new_import: New import
30
+ title: Authorizations
31
+ user_name: Participant name
24
32
  direct_verifications:
25
33
  create:
26
- authorized: "%{authorized} users have been successfully verified using
34
+ authorized: "%{authorized} participants have been successfully verified using
27
35
  [%{handler}] (%{count} detected, %{errors} errors)"
28
- info: "%{count} users detected, of which %{registered} are registered,
36
+ info: "%{count} participants detected, of which %{registered} are registered,
29
37
  %{authorized} authorized using [%{handler}] (%{unconfirmed} unconfirmed)"
30
- registered: "%{registered} users have been successfully registered (%{count}
38
+ missing_header: Please, provide a header row
39
+ registered: "%{registered} participants have been successfully registered (%{count}
31
40
  detected, %{errors} errors) "
32
- revoked: Verification from %{revoked} users have been revoked using
41
+ revoked: Verification from %{revoked} participants have been revoked using
33
42
  [%{handler}] (%{count} detected, %{errors} errors)
34
43
  gdpr_disclaimer: Do this under your responsibility. Remember that you
35
- need to have explicit consent from your users in order to register them.
44
+ need to have explicit consent from your participants in order to register them.
36
45
  Otherwise you will be infringing the GDPR regulation in EU countries.
46
+ imports:
47
+ create:
48
+ error: There was an error importing the file
49
+ success: File successfully uploaded. We'll email you when all participants
50
+ are imported.
51
+ mailer:
52
+ authorized: "%{successful} participants have been successfully verified using
53
+ [%{handler}] (%{count} detected, %{errors} errors)"
54
+ info: "%{count} participants detected, of which %{registered} are registered,
55
+ %{authorized} authorized using [%{handler}] (%{unconfirmed} unconfirmed)"
56
+ registered: "%{successful} participants have been successfully registered (%{count}
57
+ detected, %{errors} errors) "
58
+ revoked: Verification from %{successful} participants have been revoked using
59
+ [%{handler}] (%{count} detected, %{errors} errors)
60
+ subject: File import results
61
+ new:
62
+ file: CSV file with participants data
63
+ info: Import a CSV file with a participant entry per line copying the format
64
+ from the example below
65
+ submit: Upload file
37
66
  index:
67
+ authorizations: Authorized participants
38
68
  stats: User stats
39
- title: Register and authorize users
69
+ title: Register and authorize participants
40
70
  new:
41
71
  authorization_handler: Verification method
42
- authorize: Authorize users
43
- check: Check users status
44
- info: Enter the emails here, one per line. If the emails are preceded
45
- by a text, it will be interpreted as the user's name
46
- register: Register users in the platform (if they exist they will be ignored)
47
- revoke: Revoke authorization from users
72
+ authorize: Authorize participants
73
+ check: Check participants status
74
+ info_html: You can <a href=%{link}>import a CSV</a> or enter the emails
75
+ here, one per line. If the emails are preceded by a text, it will be
76
+ interpreted as the participant's name.
77
+ register: Register participants in the platform (if they exist they will be ignored)
78
+ revoke: Revoke authorization from participants
48
79
  submit: Send and process the list
49
80
  textarea: Emails list
50
81
  stats:
@@ -1,4 +1,3 @@
1
- ---
2
1
  es:
3
2
  decidim:
4
3
  admin:
@@ -11,54 +10,69 @@ es:
11
10
  admin:
12
11
  direct_verifications:
13
12
  help:
14
- - 'Permite la introducción masiva d usuarios con el fin de:'
15
- - Registrarlos directamente a la organización con el envío de invitaciones
16
- - Verificarlos en cualquier método de verificación activo
17
- - Revocar la verificación en cualquier método de verificación activo
13
+ - 'Permite la introducción masiva de participantes con el fin de:'
14
+ - Registrarlas directamente en la organización con el envío de invitaciones
15
+ - Verificarlas con cualquier método de verificación activo
16
+ - Revocar la verificación con cualquier método de verificación activo
18
17
  direct_verifications:
19
- explanation: Verificación manual por parte de los administradores de la organización
18
+ explanation: Verificación manual por parte de las administradoras de la organización
20
19
  name: Verificación directa
21
20
  direct_verifications:
22
21
  verification:
23
22
  admin:
23
+ authorizations:
24
+ index:
25
+ created_at: Creado el
26
+ metadata: Metadatos
27
+ name: Nombre
28
+ new_import: Nueva importación
29
+ title: Autorizaciones
30
+ user_name: Nombre de la participante
24
31
  direct_verifications:
25
32
  create:
26
- authorized: Se han verificado correctamente %{authorized} usuarios usando
27
- [%{handler}] (%{count} detectados, %{errors} errores)
28
- info: Se han detectado %{count} usuarios, de los cuales %{registered}
29
- están registrados, %{authorized} autorizados usando [%{handler}] (%{unconfirmed}
30
- sin confirmar)
31
- registered: Se han registrado correctamente %{registered} usuarios (%{count}
32
- detectados, %{errors} errores)
33
- revoked: Se ha revocado correctament la verificación de %{revoked} usuarios
34
- usando [%{handler}] (%{count} detectados, %{errors} errores)
35
- gdpr_disclaimer: Haga esto bajo su responsabilidad. Recuerde que debe
36
- contar con el consentimiento explícito de sus usuarios para poder registrarlos.
37
- De lo contrario, estará infringiendo la regulación GDPR en los países
38
- de la UE.
33
+ authorized: "Se han verificado correctamente %{authorized} participantes usando [%{handler}] (%{count} detectadas, %{errors} errores)"
34
+ info: "Se han detectado %{count} participantes, de las cuales %{registered} están registradas, %{authorized} autorizadas usando [%{handler}] (%{unconfirmed} sin confirmar)"
35
+ missing_header: Por favor, proporciona una fila de encabezamiento
36
+ registered: "Se han registrado correctamente %{registered} participantes (%{count} detectadas, %{errors} errores)"
37
+ revoked: Se ha revocado correctamente la verificación de %{revoked} participantes usando [%{handler}] (%{count} detectadas, %{errors} errores)
38
+ gdpr_disclaimer: Haz esto bajo tu responsabilidad. Recuerda que debes contar con el consentimiento explícito de las participantes para poder registrarlas. De lo contrario, estarás infringiendo la regulación GDPR en los países de la UE.
39
+ imports:
40
+ create:
41
+ error: Ha habido un error al importar el archivo.
42
+ success: Se ha importado el archivo. Recibirás un email cuando todas las participantes hayan sido importadas.
43
+ mailer:
44
+ authorized: "%{successful} participantes han sido verificadas usando [%{handler}] (%{count} detectades, %{errors} errores)"
45
+ info: "%{count} participantes detectadas, de las cuales %{registered} están registradas, %{authorized} autorizadas usando [%{handler}] (%{unconfirmed} sin confirmar)"
46
+ registered: "%{successful} participantes han sido registradas (%{count} detectadas, %{errors} errores) "
47
+ revoked: Se ha revocado correctamente la verificación de %{successful} participantes usando [%{handler}] (%{count} detectadas, %{errors} errores)
48
+ subject: Resultados de la importación
49
+ new:
50
+ file: Archivo CSV con datos de participantes
51
+ info: Importa un archivo CSV con una participante por línea copiando el formato del siguiente ejemplo
52
+ submit: Subir archivo
39
53
  index:
40
- stats: Estadísticas de usuarios
41
- title: Inscribe y autoriza usuarios
54
+ authorizations: Participantes autorizadas
55
+ stats: Estadísticas de participantes
56
+ title: Inscribe y autoriza participantes
42
57
  new:
43
58
  authorization_handler: Método de verificación
44
- authorize: Autoriza los usuarios
45
- check: Comprueba el estado de los usuarios
46
- info: Introduce aquí los emails, uno por linea. Si los emails están precedidos
47
- por un texto, se interpretará como el nombre del usuario
48
- register: Registra los usuarios a la plataforma (si existen se ignorarán)
49
- revoke: Revoca la autorización de los usuarios
59
+ authorize: Autoriza las participantes
60
+ check: Comprueba el estado de las participantes
61
+ info_html: Puedes <a href=%{link}>importar un fichero CSV</a> o introducir aquí los emails, uno por linea. Si los emails están precedidos por un texto, éste se interpretará como el nombre de la participante
62
+ register: Registra las participantes a la plataforma (si existen se ignorarán)
63
+ revoke: Revoca la autorización de las participantes
50
64
  submit: Envía y procesa el listado
51
65
  textarea: Lista de emails
52
66
  stats:
53
67
  index:
54
- authorized: Verificados
55
- authorized_unconfirmed: Verificados pero sin confirmar
68
+ authorized: Verificadas
69
+ authorized_unconfirmed: Verificadas pero sin confirmar
56
70
  global: "- Cualquier método de verificación -"
57
- registered: Registrados
71
+ registered: Registradas
58
72
  unconfirmed: Sin confirmar
59
73
  authorizations:
60
74
  new:
61
- no_action: Este método requiere que un administrador os verifique
75
+ no_action: Este método requiere que una administradora os verifique
62
76
  verifications:
63
77
  authorizations:
64
78
  first_login:
@@ -0,0 +1,84 @@
1
+ fr:
2
+ decidim:
3
+ admin:
4
+ models:
5
+ user:
6
+ fields:
7
+ roles:
8
+ participant: Participant
9
+ authorization_handlers:
10
+ admin:
11
+ direct_verifications:
12
+ help:
13
+ - 'Permet l''introduction massive des utilisateurs afin de :'
14
+ - Inscription directe au sein de l'organisation et envoie des invitations
15
+ - Vérifiez-les avec n'importe quelle méthode de vérification active
16
+ - Révoquer leur vérification dans toute méthode de vérification active
17
+ direct_verifications:
18
+ explanation: Vérification manuelle par les administrateurs de l'organisation
19
+ name: Vérification directe
20
+ direct_verifications:
21
+ verification:
22
+ admin:
23
+ authorizations:
24
+ index:
25
+ created_at: Créé à
26
+ metadata: Métadonnées
27
+ name: Nom
28
+ new_import: Nouvel import
29
+ title: Autorisations
30
+ user_name: Nom de l'utilisateur
31
+ direct_verifications:
32
+ create:
33
+ authorized: "%{authorized} utilisateurs ont été vérifiés avec succès en utilisant [%{handler}] (%{count} détectés, %{errors} erreurs)"
34
+ info: "%{count} utilisateurs détectés, dont %{registered} sont enregistrés, %{authorized} autorisés à utiliser [%{handler}] (%{unconfirmed} non confirmés)"
35
+ missing_header: Please, provide a header row
36
+ registered: "%{registered} utilisateurs ont été enregistrés avec succès (%{count} détectés, %{errors} erreurs) "
37
+ revoked: La vérification de %{revoked} utilisateurs ont été révoqués en utilisant [%{handler}] (%{count} détectés, %{errors} erreurs)
38
+ gdpr_disclaimer: Faites-le sous votre responsabilité. N'oubliez pas que vous devez avoir le consentement explicite de vos utilisateurs afin de les enregistrer. Dans le cas contraire, vous enfreindrez le règlement du RGPD dans les pays de l'UE.
39
+ imports:
40
+ create:
41
+ error: There was an error importing the file
42
+ success: File successfully uploaded. We'll email you when all participants are imported.
43
+ mailer:
44
+ authorized: "%{successful} participants have been successfully verified using [%{handler}] (%{count} detected, %{errors} errors)"
45
+ info: "%{count} participants detected, of which %{registered} are registered, %{authorized} authorized using [%{handler}] (%{unconfirmed} unconfirmed)"
46
+ registered: "%{successful} participants have been successfully registered (%{count} detected, %{errors} errors) "
47
+ revoked: Verification from %{successful} participants have been revoked using [%{handler}] (%{count} detected, %{errors} errors)
48
+ subject: File import results
49
+ new:
50
+ file: CSV file with participants data
51
+ info: Import a CSV file with a participant entry per line copying the format from the example below
52
+ submit: Upload file
53
+ index:
54
+ authorizations: Utilisateurs autorisés
55
+ stats: Statistiques des utilisateurs
56
+ title: Inscription et autorisation des utilisateurs
57
+ new:
58
+ authorization_handler: Méthode de vérification
59
+ authorize: Utilisateurs autorisés
60
+ check: Vérifier le statut des utilisateurs
61
+ info_html: You can <a href=%{link}>import a CSV</a> or enter the emails here, one per line. If the emails are preceded by a text, it will be interpreted as the participant's name.
62
+ register: Inscrire des utilisateurs sur la plateforme (si ils existent, ils seront ignorés)
63
+ revoke: Révoquer l'autorisation des utilisateurs
64
+ submit: Envoyer et traiter la liste
65
+ textarea: Liste d'emails
66
+ stats:
67
+ index:
68
+ authorized: Autorisé
69
+ authorized_unconfirmed: Autorisé mais non confirmé
70
+ global: "- N'importe quelle méthode de vérification -"
71
+ registered: Inscrits
72
+ unconfirmed: Non confirmé
73
+ authorizations:
74
+ new:
75
+ no_action: Cette méthode nécessite un administrateur qui vous vérifie
76
+ verifications:
77
+ authorizations:
78
+ first_login:
79
+ actions:
80
+ direct_verifications: Vérification directe
81
+ devise:
82
+ mailer:
83
+ direct_invite:
84
+ subject: Instructions d'invitation
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module DirectVerifications
5
+ class AuthorizeUser
6
+ # rubocop:disable Metrics/ParameterLists
7
+ def initialize(email, data, session, organization, instrumenter, authorization_handler)
8
+ @email = email
9
+ @data = data
10
+ @session = session
11
+ @organization = organization
12
+ @instrumenter = instrumenter
13
+ @authorization_handler = authorization_handler
14
+ end
15
+ # rubocop:enable Metrics/ParameterLists
16
+
17
+ def call
18
+ unless user
19
+ instrumenter.add_error :authorized, email
20
+ return
21
+ end
22
+
23
+ return unless valid_authorization?
24
+
25
+ Verification::ConfirmUserAuthorization.call(authorization, form, session) do
26
+ on(:ok) do
27
+ instrumenter.add_processed :authorized, email
28
+ end
29
+ on(:invalid) do
30
+ instrumenter.add_error :authorized, email
31
+ end
32
+ end
33
+ end
34
+
35
+ private
36
+
37
+ attr_reader :email, :data, :session, :organization, :instrumenter, :authorization_handler
38
+
39
+ def valid_authorization?
40
+ !authorization.granted? || authorization.expired?
41
+ end
42
+
43
+ def user
44
+ @user ||= User.find_by(email: email, decidim_organization_id: organization.id)
45
+ end
46
+
47
+ def authorization
48
+ @authorization ||=
49
+ begin
50
+ auth = Authorization.find_or_initialize_by(
51
+ user: user,
52
+ name: authorization_handler
53
+ )
54
+ auth.metadata = data
55
+ auth
56
+ end
57
+ end
58
+
59
+ def form
60
+ Verification::DirectVerificationsForm.new(email: user.email, name: user.name)
61
+ end
62
+ end
63
+ end
64
+ end