decidim-direct_verifications 0.22 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +32 -3
- data/app/assets/config/direct_verifications_admin_manifest.css +3 -0
- data/app/assets/stylesheets/decidim/direct_verifications/authorizations.scss +17 -0
- data/app/commands/decidim/direct_verifications/verification/create_import.rb +50 -0
- data/app/controllers/decidim/direct_verifications/verification/admin/authorizations_controller.rb +40 -0
- data/app/controllers/decidim/direct_verifications/verification/admin/direct_verifications_controller.rb +22 -20
- data/app/controllers/decidim/direct_verifications/verification/admin/imports_controller.rb +55 -0
- data/app/forms/decidim/direct_verifications/registration_form.rb +8 -0
- data/app/forms/decidim/direct_verifications/verification/create_import_form.rb +43 -0
- data/app/jobs/decidim/direct_verifications/authorize_users_job.rb +34 -0
- data/app/jobs/decidim/direct_verifications/base_import_job.rb +38 -0
- data/app/jobs/decidim/direct_verifications/register_users_job.rb +19 -0
- data/app/jobs/decidim/direct_verifications/revoke_users_job.rb +17 -0
- data/app/mailers/decidim/direct_verifications/import_mailer.rb +27 -0
- data/app/mailers/decidim/direct_verifications/stats.rb +23 -0
- data/app/views/decidim/direct_verifications/import_mailer/finished_processing.html.erb +7 -0
- data/app/views/decidim/direct_verifications/import_mailer/finished_processing.text.erb +7 -0
- data/app/views/decidim/direct_verifications/verification/admin/authorizations/index.html.erb +42 -0
- data/app/views/decidim/direct_verifications/verification/admin/direct_verifications/index.html.erb +4 -3
- data/app/views/decidim/direct_verifications/verification/admin/imports/new.html.erb +50 -0
- data/config/initializers/mail_previews.rb +5 -0
- data/config/locales/ca.yml +56 -27
- data/config/locales/cs.yml +77 -0
- data/config/locales/en.yml +44 -13
- data/config/locales/es.yml +56 -28
- data/config/locales/fr.yml +80 -0
- data/lib/decidim/direct_verifications/authorize_user.rb +64 -0
- data/lib/decidim/direct_verifications/instrumenter.rb +58 -0
- data/lib/decidim/direct_verifications/parsers/base_parser.rb +37 -0
- data/lib/decidim/direct_verifications/parsers/metadata_parser.rb +54 -0
- data/lib/decidim/direct_verifications/parsers/name_parser.rb +40 -0
- data/lib/decidim/direct_verifications/parsers.rb +11 -0
- data/lib/decidim/direct_verifications/register_user.rb +54 -0
- data/lib/decidim/direct_verifications/revoke_user.rb +45 -0
- data/lib/decidim/direct_verifications/tests/factories.rb +11 -0
- data/lib/decidim/direct_verifications/tests/verification_controller_examples.rb +13 -8
- data/lib/decidim/direct_verifications/user_processor.rb +17 -101
- data/lib/decidim/direct_verifications/user_stats.rb +5 -5
- data/lib/decidim/direct_verifications/verification/admin_engine.rb +6 -1
- data/lib/decidim/direct_verifications/version.rb +3 -3
- data/lib/decidim/direct_verifications.rb +24 -1
- metadata +37 -9
- data/lib/decidim/direct_verifications/config.rb +0 -23
@@ -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_include_tag "decidim/direct_verifications/verification/admin/direct_verifications_admin" %>
|
data/config/locales/ca.yml
CHANGED
@@ -11,54 +11,83 @@ ca:
|
|
11
11
|
admin:
|
12
12
|
direct_verifications:
|
13
13
|
help:
|
14
|
-
- 'Permet la introducció massiva
|
15
|
-
- Registrar-
|
16
|
-
- Verificar-
|
17
|
-
- Revocar la verificació
|
14
|
+
- 'Permet la introducció massiva de participants per tal de:'
|
15
|
+
- Registrar-les directament a la organització amb l'enviament d'invitacions
|
16
|
+
- Verificar-les amb qualsevol mètode de verificació actiu
|
17
|
+
- Revocar la verificació amb qualsevol mètode de verificació actiu
|
18
18
|
direct_verifications:
|
19
|
-
explanation: Verificació manual per
|
19
|
+
explanation: Verificació manual per part de les administradores de l'organització
|
20
20
|
name: Verificació directa
|
21
21
|
direct_verifications:
|
22
22
|
verification:
|
23
23
|
admin:
|
24
|
+
authorizations:
|
25
|
+
index:
|
26
|
+
created_at: Data de creació
|
27
|
+
metadata: Metadades
|
28
|
+
name: Nom
|
29
|
+
new_import: Nova importació
|
30
|
+
title: Autoritzacions
|
31
|
+
user_name: Nom de la participant
|
24
32
|
direct_verifications:
|
25
33
|
create:
|
26
|
-
authorized: S'han verificat correctament %{authorized}
|
34
|
+
authorized: S'han verificat correctament %{authorized} participants utilitzant
|
27
35
|
[%{handler}] (%{count} detectats, %{errors} errors)
|
28
|
-
info: S'han detectat %{count}
|
29
|
-
|
36
|
+
info: S'han detectat %{count} participants, de les quals %{registered} estan
|
37
|
+
registrades, %{authorized} autoritzades utilitzant [%{handler}] (%{unconfirmed}
|
30
38
|
sense confirmar)
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
39
|
+
missing_header: Si us plau, proporcioneu una fila d'encapçalament
|
40
|
+
registered: S'han registrat correctament %{registered} participants (%{count}
|
41
|
+
detectades, %{errors} errors)
|
42
|
+
revoked: S'ha revocat correctament la verificació de %{revoked} participants
|
43
|
+
utilitzant [%{handler}] (%{count} detectades, %{errors} errors)
|
35
44
|
gdpr_disclaimer: Feu-ho sota la vostra responsabilitat. Recordeu que heu
|
36
|
-
de tenir el consentiment explícit
|
45
|
+
de tenir el consentiment explícit de les vostres participants per a registrar-les.
|
37
46
|
En cas contrari, estareu infringint la regulació GDPR als països de
|
38
47
|
la UE.
|
48
|
+
imports:
|
49
|
+
create:
|
50
|
+
error: No s'ha pogut importar el fitxer
|
51
|
+
success: S'ha importat el fitxer. Rebràs un email quan totes les participants hagin estat importades.
|
52
|
+
mailer:
|
53
|
+
authorized: "%{successful} participants han estat verificades utilitzant
|
54
|
+
[%{handler}] (%{count} detectades, %{errors} errors)"
|
55
|
+
info: "%{count} participants detectades, de les quals %{registered} estan registrades,
|
56
|
+
%{authorized} autoritzades utilitzant [%{handler}] (%{unconfirmed} sense confirmar)"
|
57
|
+
registered: "%{successful} participants han estat registrades (%{count}
|
58
|
+
detectades, %{errors} errors) "
|
59
|
+
revoked: S'ha revocat correctament la verificació de %{successful} participants utilitzant
|
60
|
+
[%{handler}] (%{count} detectades, %{errors} errors)
|
61
|
+
subject: Resultats de la importació
|
62
|
+
new:
|
63
|
+
file: Fitxer CSV amb dades de participants
|
64
|
+
info: Importa un fitxer CSV file amb una participant per línia copiant el format de l'exemple següent
|
65
|
+
submit: Pujar fitxer
|
39
66
|
index:
|
40
|
-
|
41
|
-
|
67
|
+
authorizations: Participants autoritzades
|
68
|
+
stats: Estadístiques de les participants
|
69
|
+
title: Inscriu i autoritza participants
|
42
70
|
new:
|
43
71
|
authorization_handler: Mètode de verificació
|
44
|
-
authorize: Autoritza
|
45
|
-
check: Comprova l'estat
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
72
|
+
authorize: Autoritza les participants
|
73
|
+
check: Comprova l'estat de les participants
|
74
|
+
info_html: Pots <a href=%{link}>importar un fitxer CSV</a> o introduir els emails
|
75
|
+
aquí, un per línia. Si els emails estan precedits
|
76
|
+
per un text, aquest s'interpretarà com el nom de la participant
|
77
|
+
register: Registra les participants a la plataforma (si existeixen s'ignoraran)
|
78
|
+
revoke: Revoca l'autorització de les participants
|
50
79
|
submit: Envia i processa el llistat
|
51
|
-
textarea:
|
80
|
+
textarea: Llistat d'emails
|
52
81
|
stats:
|
53
82
|
index:
|
54
|
-
authorized:
|
55
|
-
authorized_unconfirmed:
|
83
|
+
authorized: Verificades
|
84
|
+
authorized_unconfirmed: Verificades però no confirmades
|
56
85
|
global: "- Qualsevol mètode de verificació -"
|
57
|
-
registered:
|
58
|
-
unconfirmed: No
|
86
|
+
registered: Registrades
|
87
|
+
unconfirmed: No confirmades
|
59
88
|
authorizations:
|
60
89
|
new:
|
61
|
-
no_action: Aquest mètode requereix que
|
90
|
+
no_action: Aquest mètode requereix que una administradora us verifiqui
|
62
91
|
verifications:
|
63
92
|
authorizations:
|
64
93
|
first_login:
|
@@ -0,0 +1,77 @@
|
|
1
|
+
---
|
2
|
+
cs:
|
3
|
+
decidim:
|
4
|
+
admin:
|
5
|
+
models:
|
6
|
+
user:
|
7
|
+
fields:
|
8
|
+
roles:
|
9
|
+
participant: Účastník
|
10
|
+
authorization_handlers:
|
11
|
+
admin:
|
12
|
+
direct_verifications:
|
13
|
+
help:
|
14
|
+
- 'Umožňuje masivní zavedení uživatelů:'
|
15
|
+
- Přímá registrace v organizaci a odeslání pozvánek
|
16
|
+
- Ověřit je pomocí jakékoliv metody aktivního ověření
|
17
|
+
- Zrušit jejich ověření pomocí jakékoli metody aktivního ověření
|
18
|
+
direct_verifications:
|
19
|
+
explanation: Ruční ověření správcem organizace
|
20
|
+
name: Přímé ověření
|
21
|
+
direct_verifications:
|
22
|
+
verification:
|
23
|
+
admin:
|
24
|
+
authorizations:
|
25
|
+
index:
|
26
|
+
created_at: Vytvořeno v
|
27
|
+
metadata: Metadata
|
28
|
+
name: Název
|
29
|
+
new_import: Nový import
|
30
|
+
title: Autorizace
|
31
|
+
user_name: Uživatelské jméno
|
32
|
+
direct_verifications:
|
33
|
+
create:
|
34
|
+
authorized: "%{authorized} uživatelů bylo úspěšně ověřeno pomocí [%{handler}]
|
35
|
+
(%{count} detekováno, %{errors} chyb)"
|
36
|
+
info: Zjištěno %{count} uživatelů, z nichž %{registered} jsou registrováni,
|
37
|
+
%{authorized} autorizováni pomocí [%{handler}] (%{unconfirmed} nepotvrzeno)
|
38
|
+
registered: "%{registered} uživatelů bylo úspěšně zaregistrováno (%{count}
|
39
|
+
detekováno, %{errors} chyb) "
|
40
|
+
revoked: Ověření od %{revoked} uživatelů bylo zrušeno pomocí [%{handler}]
|
41
|
+
(%{count} detekováno, %{errors} chyb)
|
42
|
+
gdpr_disclaimer: Udělejte to v rámci vaší odpovědnosti. Nezapomeňte, že
|
43
|
+
potřebujete mít výslovný souhlas svých uživatelů, abyste je mohli zaregistrovat.
|
44
|
+
V opačném případě můžete porušovat nařízení o GDPR v zemích EU.
|
45
|
+
index:
|
46
|
+
authorizations: Autorizovaní uživatelé
|
47
|
+
stats: Statistiky uživatelů
|
48
|
+
title: Registrovat a autorizovat uživatele
|
49
|
+
new:
|
50
|
+
authorization_handler: Ověřovací metoda
|
51
|
+
authorize: Autorizovat uživatele
|
52
|
+
check: Zkontrolovat stav uživatelů
|
53
|
+
info: Zadejte e-maily zde, jeden na řádek. Pokud e-mailům předchází text,
|
54
|
+
bude interpretován jako jméno uživatele
|
55
|
+
register: Registrovat uživatele na platformě (pokud existují, budou ignorováni)
|
56
|
+
revoke: Zrušit autorizaci od uživatelů
|
57
|
+
submit: Odeslat a zpracovat seznam
|
58
|
+
textarea: Seznam e-mailů
|
59
|
+
stats:
|
60
|
+
index:
|
61
|
+
authorized: Autorizováno
|
62
|
+
authorized_unconfirmed: Autorizováno, ale nepotvrzeno
|
63
|
+
global: "- Jakákoli metoda ověřování -"
|
64
|
+
registered: Registrován
|
65
|
+
unconfirmed: Nepotvrzeno
|
66
|
+
authorizations:
|
67
|
+
new:
|
68
|
+
no_action: Tato metoda vyžaduje administrátora, který vás ověřuje
|
69
|
+
verifications:
|
70
|
+
authorizations:
|
71
|
+
first_login:
|
72
|
+
actions:
|
73
|
+
direct_verifications: Přímé ověření
|
74
|
+
devise:
|
75
|
+
mailer:
|
76
|
+
direct_invite:
|
77
|
+
subject: Pokyny pro pozvání
|
data/config/locales/en.yml
CHANGED
@@ -11,7 +11,7 @@ en:
|
|
11
11
|
admin:
|
12
12
|
direct_verifications:
|
13
13
|
help:
|
14
|
-
- 'Allows the massive introduction of
|
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}
|
34
|
+
authorized: "%{authorized} participants have been successfully verified using
|
27
35
|
[%{handler}] (%{count} detected, %{errors} errors)"
|
28
|
-
info: "%{count}
|
36
|
+
info: "%{count} participants detected, of which %{registered} are registered,
|
29
37
|
%{authorized} authorized using [%{handler}] (%{unconfirmed} unconfirmed)"
|
30
|
-
|
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}
|
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
|
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
|
69
|
+
title: Register and authorize participants
|
40
70
|
new:
|
41
71
|
authorization_handler: Verification method
|
42
|
-
authorize: Authorize
|
43
|
-
check: Check
|
44
|
-
|
45
|
-
by a text, it will be
|
46
|
-
|
47
|
-
|
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:
|
data/config/locales/es.yml
CHANGED
@@ -11,54 +11,82 @@ es:
|
|
11
11
|
admin:
|
12
12
|
direct_verifications:
|
13
13
|
help:
|
14
|
-
- 'Permite la introducción masiva
|
15
|
-
-
|
16
|
-
-
|
17
|
-
- Revocar la verificación
|
14
|
+
- 'Permite la introducción masiva de participantes con el fin de:'
|
15
|
+
- Registrarlas directamente en la organización con el envío de invitaciones
|
16
|
+
- Verificarlas con cualquier método de verificación activo
|
17
|
+
- Revocar la verificación con cualquier método de verificación activo
|
18
18
|
direct_verifications:
|
19
|
-
explanation: Verificación manual por parte de
|
19
|
+
explanation: Verificación manual por parte de las administradoras de la organización
|
20
20
|
name: Verificación directa
|
21
21
|
direct_verifications:
|
22
22
|
verification:
|
23
23
|
admin:
|
24
|
+
authorizations:
|
25
|
+
index:
|
26
|
+
created_at: Creado el
|
27
|
+
metadata: Metadatos
|
28
|
+
name: Nombre
|
29
|
+
new_import: Nueva importación
|
30
|
+
title: Autorizaciones
|
31
|
+
user_name: Nombre de la participante
|
24
32
|
direct_verifications:
|
25
33
|
create:
|
26
|
-
authorized: Se han verificado correctamente %{authorized}
|
27
|
-
[%{handler}] (%{count}
|
28
|
-
info: Se han detectado %{count}
|
29
|
-
están
|
34
|
+
authorized: Se han verificado correctamente %{authorized} participantes usando
|
35
|
+
[%{handler}] (%{count} detectadas, %{errors} errores)
|
36
|
+
info: Se han detectado %{count} participantes, de las cuales %{registered}
|
37
|
+
están registradas, %{authorized} autorizadas usando [%{handler}] (%{unconfirmed}
|
30
38
|
sin confirmar)
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
39
|
+
missing_header: Por favor, proporciona una fila de encabezamiento
|
40
|
+
registered: Se han registrado correctamente %{registered} participantes (%{count}
|
41
|
+
detectadas, %{errors} errores)
|
42
|
+
revoked: Se ha revocado correctamente la verificación de %{revoked} participantes
|
43
|
+
usando [%{handler}] (%{count} detectadas, %{errors} errores)
|
44
|
+
gdpr_disclaimer: Haz esto bajo tu responsabilidad. Recuerda que debes
|
45
|
+
contar con el consentimiento explícito de las participantes para poder registrarlas.
|
46
|
+
De lo contrario, estarás infringiendo la regulación GDPR en los países
|
38
47
|
de la UE.
|
48
|
+
imports:
|
49
|
+
create:
|
50
|
+
error: Ha habido un error al importar el archivo.
|
51
|
+
success: Se ha importado el archivo. Recibirás un email cuando todas las participantes hayan sido importadas.
|
52
|
+
mailer:
|
53
|
+
authorized: "%{successful} participantes han sido verificadas usando
|
54
|
+
[%{handler}] (%{count} detectades, %{errors} errores)"
|
55
|
+
info: "%{count} participantes detectadas, de las cuales %{registered} están registradas,
|
56
|
+
%{authorized} autorizadas usando [%{handler}] (%{unconfirmed} sin confirmar)"
|
57
|
+
registered: "%{successful} participantes han sido registradas (%{count}
|
58
|
+
detectadas, %{errors} errores) "
|
59
|
+
revoked: Se ha revocado correctamente la verificación de %{successful} participantes usando
|
60
|
+
[%{handler}] (%{count} detectadas, %{errors} errores)
|
61
|
+
subject: Resultados de la importación
|
62
|
+
new:
|
63
|
+
file: Archivo CSV con datos de participantes
|
64
|
+
info: Importa un archivo CSV con una participante por línea copiando el formato del siguiente ejemplo
|
65
|
+
submit: Subir archivo
|
39
66
|
index:
|
40
|
-
|
41
|
-
|
67
|
+
authorizations: Participantes autorizadas
|
68
|
+
stats: Estadísticas de participantes
|
69
|
+
title: Inscribe y autoriza participantes
|
42
70
|
new:
|
43
71
|
authorization_handler: Método de verificación
|
44
|
-
authorize: Autoriza
|
45
|
-
check: Comprueba el estado de
|
46
|
-
|
47
|
-
por un texto, se interpretará como el nombre
|
48
|
-
register: Registra
|
49
|
-
revoke: Revoca la autorización de
|
72
|
+
authorize: Autoriza las participantes
|
73
|
+
check: Comprueba el estado de las participantes
|
74
|
+
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
|
75
|
+
por un texto, éste se interpretará como el nombre de la participante
|
76
|
+
register: Registra las participantes a la plataforma (si existen se ignorarán)
|
77
|
+
revoke: Revoca la autorización de las participantes
|
50
78
|
submit: Envía y procesa el listado
|
51
79
|
textarea: Lista de emails
|
52
80
|
stats:
|
53
81
|
index:
|
54
|
-
authorized:
|
55
|
-
authorized_unconfirmed:
|
82
|
+
authorized: Verificadas
|
83
|
+
authorized_unconfirmed: Verificadas pero sin confirmar
|
56
84
|
global: "- Cualquier método de verificación -"
|
57
|
-
registered:
|
85
|
+
registered: Registradas
|
58
86
|
unconfirmed: Sin confirmar
|
59
87
|
authorizations:
|
60
88
|
new:
|
61
|
-
no_action: Este método requiere que
|
89
|
+
no_action: Este método requiere que una administradora os verifique
|
62
90
|
verifications:
|
63
91
|
authorizations:
|
64
92
|
first_login:
|
@@ -0,0 +1,80 @@
|
|
1
|
+
---
|
2
|
+
fr:
|
3
|
+
decidim:
|
4
|
+
admin:
|
5
|
+
models:
|
6
|
+
user:
|
7
|
+
fields:
|
8
|
+
roles:
|
9
|
+
participant: Participant
|
10
|
+
authorization_handlers:
|
11
|
+
admin:
|
12
|
+
direct_verifications:
|
13
|
+
help:
|
14
|
+
- 'Permet l''introduction massive des utilisateurs afin de :'
|
15
|
+
- Inscription directe au sein de l'organisation et envoie des invitations
|
16
|
+
- Vérifiez-les avec n'importe quelle méthode de vérification active
|
17
|
+
- Révoquer leur vérification dans toute méthode de vérification active
|
18
|
+
direct_verifications:
|
19
|
+
explanation: Vérification manuelle par les administrateurs de l'organisation
|
20
|
+
name: Vérification directe
|
21
|
+
direct_verifications:
|
22
|
+
verification:
|
23
|
+
admin:
|
24
|
+
authorizations:
|
25
|
+
index:
|
26
|
+
created_at: Créé à
|
27
|
+
metadata: Métadonnées
|
28
|
+
name: Nom
|
29
|
+
new_import: Nouvel import
|
30
|
+
title: Autorisations
|
31
|
+
user_name: Nom de l'utilisateur
|
32
|
+
direct_verifications:
|
33
|
+
create:
|
34
|
+
authorized: "%{authorized} utilisateurs ont été vérifiés avec succès
|
35
|
+
en utilisant [%{handler}] (%{count} détectés, %{errors} erreurs)"
|
36
|
+
info: "%{count} utilisateurs détectés, dont %{registered} sont enregistrés,
|
37
|
+
%{authorized} autorisés à utiliser [%{handler}] (%{unconfirmed} non
|
38
|
+
confirmés)"
|
39
|
+
registered: "%{registered} utilisateurs ont été enregistrés avec succès
|
40
|
+
(%{count} détectés, %{errors} erreurs) "
|
41
|
+
revoked: La vérification de %{revoked} utilisateurs ont été révoqués
|
42
|
+
en utilisant [%{handler}] (%{count} détectés, %{errors} erreurs)
|
43
|
+
gdpr_disclaimer: Faites-le sous votre responsabilité. N'oubliez pas que
|
44
|
+
vous devez avoir le consentement explicite de vos utilisateurs afin
|
45
|
+
de les enregistrer. Dans le cas contraire, vous enfreindrez le règlement
|
46
|
+
du RGPD dans les pays de l'UE.
|
47
|
+
index:
|
48
|
+
authorizations: Utilisateurs autorisés
|
49
|
+
stats: Statistiques des utilisateurs
|
50
|
+
title: Inscription et autorisation des utilisateurs
|
51
|
+
new:
|
52
|
+
authorization_handler: Méthode de vérification
|
53
|
+
authorize: Utilisateurs autorisés
|
54
|
+
check: Vérifier le statut des utilisateurs
|
55
|
+
info: Entrez les e-mails ici, un par ligne. Si les e-mails sont précédés
|
56
|
+
d'un texte, il sera interprété comme le nom de l'utilisateur
|
57
|
+
register: Inscrire des utilisateurs sur la plateforme (si ils existent,
|
58
|
+
ils seront ignorés)
|
59
|
+
revoke: Révoquer l'autorisation des utilisateurs
|
60
|
+
submit: Envoyer et traiter la liste
|
61
|
+
textarea: Liste d'emails
|
62
|
+
stats:
|
63
|
+
index:
|
64
|
+
authorized: Autorisé
|
65
|
+
authorized_unconfirmed: Autorisé mais non confirmé
|
66
|
+
global: "- N'importe quelle méthode de vérification -"
|
67
|
+
registered: Inscrits
|
68
|
+
unconfirmed: Non confirmé
|
69
|
+
authorizations:
|
70
|
+
new:
|
71
|
+
no_action: Cette méthode nécessite un administrateur qui vous vérifie
|
72
|
+
verifications:
|
73
|
+
authorizations:
|
74
|
+
first_login:
|
75
|
+
actions:
|
76
|
+
direct_verifications: Vérification directe
|
77
|
+
devise:
|
78
|
+
mailer:
|
79
|
+
direct_invite:
|
80
|
+
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
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module DirectVerifications
|
5
|
+
class Instrumenter
|
6
|
+
def initialize(current_user)
|
7
|
+
@current_user = current_user
|
8
|
+
@errors = { registered: Set.new, authorized: Set.new, revoked: Set.new }
|
9
|
+
@processed = { registered: Set.new, authorized: Set.new, revoked: Set.new }
|
10
|
+
end
|
11
|
+
|
12
|
+
def add_processed(type, email)
|
13
|
+
@processed[type] << email
|
14
|
+
end
|
15
|
+
|
16
|
+
def add_error(type, email)
|
17
|
+
@errors[type] << email
|
18
|
+
end
|
19
|
+
|
20
|
+
def processed_count(key)
|
21
|
+
processed[key].size
|
22
|
+
end
|
23
|
+
|
24
|
+
def errors_count(key)
|
25
|
+
errors[key].size
|
26
|
+
end
|
27
|
+
|
28
|
+
def emails_count(key)
|
29
|
+
@processed[key].size + @errors[key].size
|
30
|
+
end
|
31
|
+
|
32
|
+
def track(event, email, user = nil)
|
33
|
+
if user
|
34
|
+
add_processed event, email
|
35
|
+
log_action user
|
36
|
+
else
|
37
|
+
add_error event, email
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
attr_reader :current_user, :processed, :errors
|
44
|
+
|
45
|
+
def log_action(user)
|
46
|
+
Decidim.traceability.perform_action!(
|
47
|
+
"invite",
|
48
|
+
user,
|
49
|
+
current_user,
|
50
|
+
extra: {
|
51
|
+
invited_user_role: "participant",
|
52
|
+
invited_user_id: user.id
|
53
|
+
}
|
54
|
+
)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|