decidim-direct_verifications 1.1 → 1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +23 -0
- data/app/controllers/concerns/decidim/direct_verifications/admin/needs_verification_snippets.rb +61 -0
- data/app/controllers/decidim/direct_verifications/verification/admin/application_controller.rb +15 -0
- data/app/controllers/decidim/direct_verifications/verification/admin/authorizations_controller.rb +1 -1
- data/app/controllers/decidim/direct_verifications/verification/admin/direct_verifications_controller.rb +1 -1
- data/app/controllers/decidim/direct_verifications/verification/admin/imports_controller.rb +1 -1
- data/app/controllers/decidim/direct_verifications/verification/admin/stats_controller.rb +2 -2
- data/app/controllers/decidim/direct_verifications/verification/admin/user_authorizations_controller.rb +64 -0
- data/app/packs/entrypoints/decidim_direct_verifications_participants.js +1 -0
- data/app/packs/src/decidim/direct_verifications/admin/checkboxes.js +0 -2
- data/app/packs/src/decidim/direct_verifications/admin/participants.js +88 -0
- data/app/permissions/decidim/direct_verifications/admin/permissions.rb +19 -0
- data/app/views/decidim/direct_verifications/verification/admin/stats/index.html.erb +3 -1
- data/app/views/decidim/direct_verifications/verification/admin/user_authorizations/show.html.erb +27 -0
- data/config/assets.rb +1 -0
- data/config/locales/en.yml +35 -17
- data/lib/decidim/direct_verifications/verification/admin.rb +2 -0
- data/lib/decidim/direct_verifications/verification/admin_engine.rb +7 -0
- data/lib/decidim/direct_verifications/version.rb +2 -2
- data/lib/decidim/direct_verifications.rb +6 -0
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7a348b9504d3371592edd997c1af5847b05b3fa060a155de266c13ad3385b1c
|
4
|
+
data.tar.gz: 6d21de70c4ae4b1d40b2ab27514f90cdeccbaaf309eae82f0eb9671f1b597355
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efa9e4d88b715b7a1255bdf2890e0f9f0f34b52b2cf3f02cc211954eec9b53b43c75a3373a456c7d71a23ba9920f6b3c9ec47f5fe3476cfc23564b7c4897159e
|
7
|
+
data.tar.gz: 2825c1c7d5bb1230c242a019288d76fd4d42ae69770fa5cbe5f91a9492c4de0c96a7e36dc012195cd65f0301243792a6dd5f9ea7a8584b995b174de9a5ada695
|
data/README.md
CHANGED
@@ -55,6 +55,28 @@ Decidim::DirectVerifications.configure do |config|
|
|
55
55
|
end
|
56
56
|
```
|
57
57
|
|
58
|
+
### Direct managements of user's authorizations
|
59
|
+
|
60
|
+
This plugin also provides a place for admins to see and manage (if configured) existing verifications for any user.
|
61
|
+
Admins can go to the "Participants" admin page and see a new management button, when clicked it shows a modal window with all the authorizations that this user has granted as well as the missing ones. If Direct Verfication is configured to manage that verification (through the `manage_workflows` config var) it can be granted or revoke just by clicking a button.
|
62
|
+
|
63
|
+
![Participants mods](examples/participants.png)
|
64
|
+
|
65
|
+
![Participants modal management](examples/authorization-modal.png)
|
66
|
+
|
67
|
+
This behavior can be disabled by disabling in a initializer the config var `participants_modal`.
|
68
|
+
|
69
|
+
**`config/initializers/decidim_verifications.rb`:**
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
# frozen_string_literal: true
|
73
|
+
|
74
|
+
Decidim::DirectVerifications.configure do |config|
|
75
|
+
# Disable participants direct verifications management
|
76
|
+
config.participants_modal = false
|
77
|
+
end
|
78
|
+
```
|
79
|
+
|
58
80
|
## Installation
|
59
81
|
|
60
82
|
Add this line to your application's Gemfile:
|
@@ -73,6 +95,7 @@ Depending on your Decidim version, you might want to specify the version to ensu
|
|
73
95
|
|
74
96
|
| Direct Verifications version | Compatible Decidim versions |
|
75
97
|
|---|---|
|
98
|
+
| 1.2 | >= 0.25.x |
|
76
99
|
| 1.1 | >= 0.25.x |
|
77
100
|
| 1.0 | >= 0.23.x |
|
78
101
|
| 0.22.x | 0.22.x |
|
data/app/controllers/concerns/decidim/direct_verifications/admin/needs_verification_snippets.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/concern"
|
4
|
+
|
5
|
+
module Decidim
|
6
|
+
module DirectVerifications
|
7
|
+
module Admin
|
8
|
+
module NeedsVerificationSnippets
|
9
|
+
extend ActiveSupport::Concern
|
10
|
+
|
11
|
+
included do
|
12
|
+
helper_method :snippets
|
13
|
+
end
|
14
|
+
|
15
|
+
def snippets
|
16
|
+
return @snippets if @snippets
|
17
|
+
|
18
|
+
@snippets = Decidim::Snippets.new
|
19
|
+
return @snippets if Decidim::DirectVerifications.participants_modal.blank?
|
20
|
+
|
21
|
+
@snippets.add(:direct_verifications, "<script>DirectVerificationsConfig = #{direct_verifications_config.to_json}</script>")
|
22
|
+
@snippets.add(:direct_verifications, ActionController::Base.helpers.javascript_pack_tag("decidim_direct_verifications_participants"))
|
23
|
+
@snippets.add(:head, @snippets.for(:direct_verifications))
|
24
|
+
|
25
|
+
@snippets
|
26
|
+
end
|
27
|
+
|
28
|
+
def direct_verifications_config
|
29
|
+
{
|
30
|
+
buttonTitle: I18n.t("decidim.direct_verifications.participants.modal.button_title", locale: detect_current_locale),
|
31
|
+
modalTitle: I18n.t("decidim.direct_verifications.participants.modal.modal_title", locale: detect_current_locale),
|
32
|
+
closeModalLabel: I18n.t("decidim.direct_verifications.participants.modal.close_modal_label", locale: detect_current_locale),
|
33
|
+
statsLabel: I18n.t("decidim.direct_verifications.verification.admin.index.stats", locale: detect_current_locale),
|
34
|
+
userVerificationsPath: Decidim::DirectVerifications::Verification::AdminEngine.routes.url_helpers.user_authorization_path("-ID-"),
|
35
|
+
statsPath: Decidim::DirectVerifications::Verification::AdminEngine.routes.url_helpers.stats_path,
|
36
|
+
verifications: direct_verifications_verifications
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
def direct_verifications_verifications
|
41
|
+
@direct_verifications_verifications ||= Decidim::Authorization.where(name: current_organization.available_authorizations)
|
42
|
+
.where.not(granted_at: nil)
|
43
|
+
.where(decidim_user_id: filtered_collection).map do |auth|
|
44
|
+
{
|
45
|
+
id: auth.id,
|
46
|
+
userId: auth.decidim_user_id,
|
47
|
+
name: auth.name,
|
48
|
+
title: I18n.t("decidim.authorization_handlers.#{auth.name}.name", locale: detect_current_locale, default: auth.name),
|
49
|
+
createdAt: auth.created_at,
|
50
|
+
updatedAt: auth.updated_at
|
51
|
+
}
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def detect_current_locale
|
56
|
+
params[:locale] || session[:user_locale] || locale
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/app/controllers/decidim/direct_verifications/verification/admin/application_controller.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module DirectVerifications
|
5
|
+
module Verification
|
6
|
+
module Admin
|
7
|
+
class ApplicationController < Decidim::Admin::ApplicationController
|
8
|
+
def permission_class_chain
|
9
|
+
[::Decidim::DirectVerifications::Admin::Permissions] + super
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -4,7 +4,7 @@ module Decidim
|
|
4
4
|
module DirectVerifications
|
5
5
|
module Verification
|
6
6
|
module Admin
|
7
|
-
class DirectVerificationsController <
|
7
|
+
class DirectVerificationsController < ApplicationController
|
8
8
|
include NeedsPermission
|
9
9
|
helper_method :workflows, :current_authorization_handler
|
10
10
|
|
@@ -4,7 +4,7 @@ module Decidim
|
|
4
4
|
module DirectVerifications
|
5
5
|
module Verification
|
6
6
|
module Admin
|
7
|
-
class ImportsController <
|
7
|
+
class ImportsController < ApplicationController
|
8
8
|
layout "decidim/admin/users"
|
9
9
|
helper_method :workflows, :current_authorization_handler
|
10
10
|
|
@@ -4,10 +4,10 @@ module Decidim
|
|
4
4
|
module DirectVerifications
|
5
5
|
module Verification
|
6
6
|
module Admin
|
7
|
-
class StatsController <
|
7
|
+
class StatsController < ApplicationController
|
8
8
|
include NeedsPermission
|
9
9
|
|
10
|
-
layout "decidim/admin/users"
|
10
|
+
layout -> { request.xhr? ? false : "decidim/admin/users" }
|
11
11
|
|
12
12
|
def index
|
13
13
|
enforce_permission_to :index, :authorization
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module DirectVerifications
|
5
|
+
module Verification
|
6
|
+
module Admin
|
7
|
+
class UserAuthorizationsController < ApplicationController
|
8
|
+
include NeedsPermission
|
9
|
+
layout false
|
10
|
+
|
11
|
+
helper_method :user, :authorizations, :authorization_for, :managed?
|
12
|
+
|
13
|
+
def show
|
14
|
+
enforce_permission_to :index, :authorization
|
15
|
+
end
|
16
|
+
|
17
|
+
def update
|
18
|
+
enforce_permission_to :create, :direct_authorization, name: params[:name]
|
19
|
+
handler = OpenStruct.new(handler_name: params[:name], user: user, unique_id: nil, metadata: {})
|
20
|
+
if Decidim::Authorization.create_or_update_from(handler)
|
21
|
+
flash[:notice] = t(".success", name: auth_name)
|
22
|
+
else
|
23
|
+
flash[:alert] = t(".error", name: auth_name)
|
24
|
+
end
|
25
|
+
redirect_to decidim_admin.officializations_path
|
26
|
+
end
|
27
|
+
|
28
|
+
def destroy
|
29
|
+
enforce_permission_to :destroy, :direct_authorization, name: params[:name]
|
30
|
+
begin
|
31
|
+
authorization_for(params[:name]).destroy!
|
32
|
+
flash[:notice] = t(".success", name: auth_name)
|
33
|
+
rescue StandardError => e
|
34
|
+
flash[:alert] = t(".error", name: auth_name, error: e.message)
|
35
|
+
end
|
36
|
+
redirect_to decidim_admin.officializations_path
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def user
|
42
|
+
@user ||= Decidim::User.find_by(id: params[:id])
|
43
|
+
end
|
44
|
+
|
45
|
+
def authorizations
|
46
|
+
@authorizations ||= Decidim::Authorization.where(decidim_user_id: user.id)
|
47
|
+
end
|
48
|
+
|
49
|
+
def authorization_for(name)
|
50
|
+
authorizations.find_by(name: name)
|
51
|
+
end
|
52
|
+
|
53
|
+
def managed?(name)
|
54
|
+
Decidim::DirectVerifications.manage_workflows.include? name
|
55
|
+
end
|
56
|
+
|
57
|
+
def auth_name
|
58
|
+
t("decidim.authorization_handlers.#{params[:name]}.name", default: params[:name])
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
import "src/decidim/direct_verifications/admin/participants.js"
|
@@ -0,0 +1,88 @@
|
|
1
|
+
class VerificationUI {
|
2
|
+
constructor($table, config) {
|
3
|
+
this.$table = $table;
|
4
|
+
this.svgPath = $table.find("use[href]:first").attr("href").split("#")[0];
|
5
|
+
this.icon = "icon-key";
|
6
|
+
this.config = config;
|
7
|
+
this.$table.on("click", ".show-verifications-modal", (e) => this.toggleModal(e));
|
8
|
+
this.addModal();
|
9
|
+
}
|
10
|
+
|
11
|
+
addModal() {
|
12
|
+
this.$modal = $(`<div class="reveal" id="show-verifications-modal" data-reveal>
|
13
|
+
<div class="reveal__header">
|
14
|
+
<h3 class="reveal__title">${this.config.modalTitle}</h3>
|
15
|
+
<button class="close-button" data-close aria-label="${this.config.closeModalLabel}"
|
16
|
+
type="button">
|
17
|
+
<span aria-hidden="true">×</span>
|
18
|
+
</button>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<div class="row">
|
22
|
+
<div class="columns medium-4 medium-centered modal-body">
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
</div>`);
|
26
|
+
this.$table.after(this.$modal);
|
27
|
+
this.$title = $("#user-groups .card-title:first");
|
28
|
+
this.$modalBody = this.$modal.find(".modal-body");
|
29
|
+
this.reveal = new Foundation.Reveal(this.$modal);
|
30
|
+
}
|
31
|
+
|
32
|
+
drawButtons() {
|
33
|
+
this.$table.find("tbody tr").each((idx, tr) => {
|
34
|
+
const $lastTd = $(tr).find("td:last");
|
35
|
+
|
36
|
+
$lastTd.prepend(`<a class="action-icon action-icon action-icon show-verifications-modal" title="${this.config.buttonTitle}" href="#open-show-verifications-modal"><span class="has-tip ${this.getTrStatus(tr)}"><svg aria-label="${this.config.buttonTitle}" role="img" class="icon--ban icon">
|
37
|
+
<title>${this.config.buttonTitle}</title>
|
38
|
+
<use href="${this.svgPath}#${this.icon}"></use>
|
39
|
+
</svg></span></a>`);
|
40
|
+
});
|
41
|
+
}
|
42
|
+
|
43
|
+
addStatsTitle() {
|
44
|
+
// Add upper link to verification stats
|
45
|
+
const $a = $(`<a class="button tiny button--title" href="${this.config.statsPath}">${this.config.statsLabel}</a>`);
|
46
|
+
$a.on("click", (e) => {
|
47
|
+
e.preventDefault();
|
48
|
+
this.loadUrl($a.attr("href"), true);
|
49
|
+
});
|
50
|
+
this.$title.append($a);
|
51
|
+
}
|
52
|
+
|
53
|
+
getTrStatus(tr) {
|
54
|
+
return this.getUserVerifications($(tr).data("user-id")).length
|
55
|
+
? "alert"
|
56
|
+
: "";
|
57
|
+
}
|
58
|
+
|
59
|
+
getVerification(id) {
|
60
|
+
return this.config.verifications.find((auth) => auth.id == id);
|
61
|
+
}
|
62
|
+
|
63
|
+
getUserVerifications(userId) {
|
64
|
+
return this.config.verifications.filter((auth) => auth.userId == userId);
|
65
|
+
}
|
66
|
+
|
67
|
+
toggleModal(e) {
|
68
|
+
const userId = $(e.target).closest("tr").data("user-id");
|
69
|
+
this.loadUrl(this.config.userVerificationsPath.replace("-ID-", userId));
|
70
|
+
}
|
71
|
+
|
72
|
+
loadUrl(url, large = false) {
|
73
|
+
this.$modal.removeClass("large");
|
74
|
+
if (large) {
|
75
|
+
this.$modal.addClass("large");
|
76
|
+
}
|
77
|
+
this.$modalBody.html('<span class="loading-spinner"></span>');
|
78
|
+
this.$modalBody.load(url);
|
79
|
+
this.$modal.foundation("toggle");
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
$(() => {
|
84
|
+
const ui = new VerificationUI($("#user-groups table.table-list"), DirectVerificationsConfig);
|
85
|
+
// Draw the icon buttons for checking verification statuses
|
86
|
+
ui.drawButtons();
|
87
|
+
ui.addStatsTitle();
|
88
|
+
});
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module DirectVerifications
|
5
|
+
module Admin
|
6
|
+
class Permissions < Decidim::DefaultPermissions
|
7
|
+
def permissions
|
8
|
+
return permission_action if permission_action.scope != :admin
|
9
|
+
return permission_action unless user
|
10
|
+
return permission_action unless user.admin?
|
11
|
+
|
12
|
+
toggle_allow(Decidim::DirectVerifications.manage_workflows.map(&:to_s).include?(context.fetch(:name).to_s)) if permission_action.subject == :direct_authorization
|
13
|
+
|
14
|
+
permission_action
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -2,7 +2,9 @@
|
|
2
2
|
<div class="card-divider">
|
3
3
|
<h2 class="card-title">
|
4
4
|
<%= t("admin.index.stats", scope: "decidim.direct_verifications.verification") %>
|
5
|
-
|
5
|
+
<% unless request.xhr? %>
|
6
|
+
<%= link_to t("admin.index.title", scope: "decidim.direct_verifications.verification"), direct_verifications_path, class: "button tiny button--title" %>
|
7
|
+
<% end %>
|
6
8
|
</h2>
|
7
9
|
</div>
|
8
10
|
<div class="card-section">
|
data/app/views/decidim/direct_verifications/verification/admin/user_authorizations/show.html.erb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
<strong><%= user.name %>:</strong>
|
2
|
+
<table class="table-list">
|
3
|
+
<tbody>
|
4
|
+
<% current_organization.available_authorizations.each do |name| %>
|
5
|
+
<% authorization = authorization_for(name) %>
|
6
|
+
<tr>
|
7
|
+
<td><%= I18n.t("decidim.authorization_handlers.#{name}.name", default: name) %></td>
|
8
|
+
<td>
|
9
|
+
<% if authorization&.granted? %>
|
10
|
+
<span class="label success"><%= t ".granted" %></span>
|
11
|
+
<% else %>
|
12
|
+
<span class="label alert"><%= t ".not_granted" %></span>
|
13
|
+
<% end %>
|
14
|
+
</td>
|
15
|
+
<td class="table-list__actions">
|
16
|
+
<% if managed?(name) %>
|
17
|
+
<% if authorization&.granted? %>
|
18
|
+
<%= icon_link_to "circle-x", user_authorization_path(user, name: name), t(".revoke"), method: :delete, role: "img", aria_label: t(".revoke") %>
|
19
|
+
<% else %>
|
20
|
+
<%= icon_link_to "circle-check", user_authorization_path(user, name: name), t(".grant"), method: :patch, role: "img", aria_label: t(".grant") %>
|
21
|
+
<% end %>
|
22
|
+
<% end %>
|
23
|
+
</td>
|
24
|
+
</tr>
|
25
|
+
<% end %>
|
26
|
+
</tbody>
|
27
|
+
</table>
|
data/config/assets.rb
CHANGED
@@ -20,5 +20,6 @@ Decidim::Webpacker.register_path("#{base_path}/app/packs")
|
|
20
20
|
# `stylesheet_pack_tag`.
|
21
21
|
Decidim::Webpacker.register_entrypoints(
|
22
22
|
decidim_direct_verifications: "#{base_path}/app/packs/entrypoints/decidim_direct_verifications.js",
|
23
|
+
decidim_direct_verifications_participants: "#{base_path}/app/packs/entrypoints/decidim_direct_verifications_participants.js",
|
23
24
|
decidim_direct_verifications_css: "#{base_path}/app/packs/entrypoints/decidim_direct_verifications.scss"
|
24
25
|
)
|
data/config/locales/en.yml
CHANGED
@@ -19,6 +19,11 @@ en:
|
|
19
19
|
explanation: Manual verification by the administrators of the organization
|
20
20
|
name: Direct verification
|
21
21
|
direct_verifications:
|
22
|
+
participants:
|
23
|
+
modal:
|
24
|
+
button_title: See authorizations
|
25
|
+
modal_close_button: Close
|
26
|
+
modal_title: Available authorizations
|
22
27
|
verification:
|
23
28
|
admin:
|
24
29
|
authorizations:
|
@@ -31,37 +36,37 @@ en:
|
|
31
36
|
user_name: Participant name
|
32
37
|
direct_verifications:
|
33
38
|
create:
|
34
|
-
authorized: "%{authorized} participants have been successfully verified
|
35
|
-
[%{handler}] (%{count} detected, %{errors} errors)"
|
39
|
+
authorized: "%{authorized} participants have been successfully verified
|
40
|
+
using [%{handler}] (%{count} detected, %{errors} errors)"
|
36
41
|
info: "%{count} participants detected, of which %{registered} are registered,
|
37
42
|
%{authorized} authorized using [%{handler}] (%{unconfirmed} unconfirmed)"
|
38
43
|
missing_header: Please, provide a header row
|
39
|
-
registered: "%{registered} participants have been successfully registered
|
40
|
-
detected, %{errors} errors) "
|
41
|
-
revoked: Verification from %{revoked} participants have been revoked
|
42
|
-
[%{handler}] (%{count} detected, %{errors} errors)
|
44
|
+
registered: "%{registered} participants have been successfully registered
|
45
|
+
(%{count} detected, %{errors} errors) "
|
46
|
+
revoked: Verification from %{revoked} participants have been revoked
|
47
|
+
using [%{handler}] (%{count} detected, %{errors} errors)
|
43
48
|
gdpr_disclaimer: Do this under your responsibility. Remember that you
|
44
|
-
need to have explicit consent from your participants in order to register
|
45
|
-
Otherwise you will be infringing the GDPR regulation in EU countries.
|
49
|
+
need to have explicit consent from your participants in order to register
|
50
|
+
them. Otherwise you will be infringing the GDPR regulation in EU countries.
|
46
51
|
imports:
|
47
52
|
create:
|
48
53
|
error: There was an error importing the file
|
49
54
|
success: File successfully uploaded. We'll email you when all participants
|
50
55
|
are imported.
|
51
56
|
mailer:
|
52
|
-
authorized: "%{successful} participants have been successfully verified
|
53
|
-
[%{handler}] (%{count} detected, %{errors} errors)"
|
57
|
+
authorized: "%{successful} participants have been successfully verified
|
58
|
+
using [%{handler}] (%{count} detected, %{errors} errors)"
|
54
59
|
info: "%{count} participants detected, of which %{registered} are registered,
|
55
60
|
%{authorized} authorized using [%{handler}] (%{unconfirmed} unconfirmed)"
|
56
|
-
registered: "%{successful} participants have been successfully registered
|
57
|
-
detected, %{errors} errors) "
|
58
|
-
revoked: Verification from %{successful} participants have been revoked
|
59
|
-
[%{handler}] (%{count} detected, %{errors} errors)
|
61
|
+
registered: "%{successful} participants have been successfully registered
|
62
|
+
(%{count} detected, %{errors} errors) "
|
63
|
+
revoked: Verification from %{successful} participants have been revoked
|
64
|
+
using [%{handler}] (%{count} detected, %{errors} errors)
|
60
65
|
subject: File import results
|
61
66
|
new:
|
62
67
|
file: CSV file with participants data
|
63
|
-
info: Import a CSV file with a participant entry per line copying the
|
64
|
-
from the example below
|
68
|
+
info: Import a CSV file with a participant entry per line copying the
|
69
|
+
format from the example below
|
65
70
|
submit: Upload file
|
66
71
|
index:
|
67
72
|
authorizations: Authorized participants
|
@@ -74,7 +79,8 @@ en:
|
|
74
79
|
info_html: You can <a href=%{link}>import a CSV</a> or enter the emails
|
75
80
|
here, one per line. If the emails are preceded by a text, it will be
|
76
81
|
interpreted as the participant's name.
|
77
|
-
register: Register participants in the platform (if they exist they will
|
82
|
+
register: Register participants in the platform (if they exist they will
|
83
|
+
be ignored)
|
78
84
|
revoke: Revoke authorization from participants
|
79
85
|
submit: Send and process the list
|
80
86
|
textarea: Emails list
|
@@ -85,6 +91,18 @@ en:
|
|
85
91
|
global: "- Any verification method -"
|
86
92
|
registered: Registered
|
87
93
|
unconfirmed: Unconfirmed
|
94
|
+
user_authorizations:
|
95
|
+
destroy:
|
96
|
+
error: Error while trying to delete the authorization %{name} (%{message})
|
97
|
+
success: Authorization %{name} deleted successfully
|
98
|
+
show:
|
99
|
+
grant: Authorize user with this method
|
100
|
+
granted: Granted
|
101
|
+
not_granted: Not granted
|
102
|
+
revoke: Revoke the authorization
|
103
|
+
update:
|
104
|
+
error: Error while trying to authorize the user using %{name}
|
105
|
+
success: User authorized successfully using %{name}
|
88
106
|
authorizations:
|
89
107
|
new:
|
90
108
|
no_action: This method requires an administrator that verifies you
|
@@ -12,10 +12,17 @@ module Decidim
|
|
12
12
|
resources :stats, only: [:index]
|
13
13
|
resources :authorizations, only: [:index, :destroy]
|
14
14
|
resources :imports, only: [:new, :create]
|
15
|
+
resources :user_authorizations, only: [:show, :update, :destroy]
|
15
16
|
|
16
17
|
root to: "direct_verifications#index"
|
17
18
|
end
|
18
19
|
|
20
|
+
config.after_initialize do
|
21
|
+
if Decidim::DirectVerifications.participants_modal.present?
|
22
|
+
Decidim::Admin::OfficializationsController.include(Decidim::DirectVerifications::Admin::NeedsVerificationSnippets)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
19
26
|
initializer "decidim_notify.webpacker.assets_path" do
|
20
27
|
Decidim.register_assets_path File.expand_path("app/packs", root)
|
21
28
|
end
|
@@ -28,6 +28,12 @@ module Decidim
|
|
28
28
|
:name_parser
|
29
29
|
end
|
30
30
|
|
31
|
+
# add a button to the participants list to be able to handle verifications from there
|
32
|
+
# Manageable Verifications need to be registered in :manage_workflows
|
33
|
+
config_accessor :participants_modal do
|
34
|
+
true
|
35
|
+
end
|
36
|
+
|
31
37
|
def self.find_parser_class(manifest)
|
32
38
|
"Decidim::DirectVerifications::Parsers::#{manifest.to_s.camelize}".safe_constantize || Decidim::DirectVerifications::Parsers::NameParser
|
33
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-direct_verifications
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Vergés
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: decidim-admin
|
@@ -52,10 +52,13 @@ files:
|
|
52
52
|
- app/commands/decidim/direct_verifications/verification/confirm_user_authorization.rb
|
53
53
|
- app/commands/decidim/direct_verifications/verification/create_import.rb
|
54
54
|
- app/commands/decidim/direct_verifications/verification/destroy_user_authorization.rb
|
55
|
+
- app/controllers/concerns/decidim/direct_verifications/admin/needs_verification_snippets.rb
|
56
|
+
- app/controllers/decidim/direct_verifications/verification/admin/application_controller.rb
|
55
57
|
- app/controllers/decidim/direct_verifications/verification/admin/authorizations_controller.rb
|
56
58
|
- app/controllers/decidim/direct_verifications/verification/admin/direct_verifications_controller.rb
|
57
59
|
- app/controllers/decidim/direct_verifications/verification/admin/imports_controller.rb
|
58
60
|
- app/controllers/decidim/direct_verifications/verification/admin/stats_controller.rb
|
61
|
+
- app/controllers/decidim/direct_verifications/verification/admin/user_authorizations_controller.rb
|
59
62
|
- app/controllers/decidim/direct_verifications/verification/authorizations_controller.rb
|
60
63
|
- app/forms/decidim/direct_verifications/registration_form.rb
|
61
64
|
- app/forms/decidim/direct_verifications/verification/create_import_form.rb
|
@@ -68,14 +71,18 @@ files:
|
|
68
71
|
- app/mailers/decidim/direct_verifications/stats.rb
|
69
72
|
- app/packs/entrypoints/decidim_direct_verifications.js
|
70
73
|
- app/packs/entrypoints/decidim_direct_verifications.scss
|
74
|
+
- app/packs/entrypoints/decidim_direct_verifications_participants.js
|
71
75
|
- app/packs/src/decidim/direct_verifications/admin/checkboxes.js
|
76
|
+
- app/packs/src/decidim/direct_verifications/admin/participants.js
|
72
77
|
- app/packs/stylesheets/decidim/direct_verifications/admin/authorizations.scss
|
78
|
+
- app/permissions/decidim/direct_verifications/admin/permissions.rb
|
73
79
|
- app/views/decidim/direct_verifications/import_mailer/finished_processing.html.erb
|
74
80
|
- app/views/decidim/direct_verifications/import_mailer/finished_processing.text.erb
|
75
81
|
- app/views/decidim/direct_verifications/verification/admin/authorizations/index.html.erb
|
76
82
|
- app/views/decidim/direct_verifications/verification/admin/direct_verifications/index.html.erb
|
77
83
|
- app/views/decidim/direct_verifications/verification/admin/imports/new.html.erb
|
78
84
|
- app/views/decidim/direct_verifications/verification/admin/stats/index.html.erb
|
85
|
+
- app/views/decidim/direct_verifications/verification/admin/user_authorizations/show.html.erb
|
79
86
|
- app/views/devise/mailer/direct_invite.html.erb
|
80
87
|
- app/views/devise/mailer/direct_invite.text.erb
|
81
88
|
- config/assets.rb
|