decidim-direct_verifications 0.17.8 → 0.20
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 +4 -4
- data/README.md +14 -1
- data/app/controllers/decidim/direct_verifications/verification/admin/direct_verifications_controller.rb +1 -0
- data/config/locales/ca.yml +5 -0
- data/config/locales/en.yml +5 -0
- data/config/locales/es.yml +5 -0
- data/lib/decidim/direct_verifications/tests/verification_controller_examples.rb +68 -0
- data/lib/decidim/direct_verifications/user_processor.rb +3 -0
- data/lib/decidim/direct_verifications/user_stats.rb +4 -1
- data/lib/decidim/direct_verifications/version.rb +3 -2
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9f466181031acf9fe03bd55ef1f1ae1e407707acc0b22a639576523eebe90ae
|
4
|
+
data.tar.gz: 3071bc96c9e22c9ca06ce14f3ce81b1280a54dcb3a4478abb0ef02531c2f6c23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 490468f076bdc3f270d8f853f0c809bc6aac17f989d4984538550107e963fab25b52ae5bb30ed76856747e67740976dc3a027d49b0f916a339565b409f606751
|
7
|
+
data.tar.gz: 8e9b5c8d40c075d34e41f3711d9c5740e0ecc62bd916ec6d3a4b9afa80855d1ca1c260a13eda183feca9aefa2066b5682ba9e0a80c300a36844cab79b53896d0
|
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# Decidim::DirectVerifications
|
2
2
|
|
3
|
-
|
3
|
+
![[CI] Test](https://github.com/Platoniq/decidim-verifications-direct_verifications/workflows/%5BCI%5D%20Test/badge.svg)
|
4
|
+
[](https://codeclimate.com/github/Platoniq/decidim-verifications-direct_verifications/maintainability)
|
5
|
+
[](https://codeclimate.com/github/Platoniq/decidim-verifications-direct_verifications/test_coverage)
|
6
|
+
|
4
7
|
|
5
8
|
A [Decidim](https://github.com/decidim/decidim) that provides a verification method called `Direct verification`. Works only on the admin side, final users do not intervene in the verification process.
|
6
9
|
|
@@ -84,6 +87,11 @@ en:
|
|
84
87
|
direct_verifications_managers:
|
85
88
|
name: Organization managers
|
86
89
|
explanation: Direct Verifications Subgroup explanation
|
90
|
+
verifications:
|
91
|
+
authorizations:
|
92
|
+
first_login:
|
93
|
+
actions:
|
94
|
+
direct_verifications_managers: Organization managers
|
87
95
|
```
|
88
96
|
|
89
97
|
Similarly, you can also overwrite the default title "Direct verification" by creating the key again in your locales:
|
@@ -95,6 +103,11 @@ en:
|
|
95
103
|
direct_verifications:
|
96
104
|
name: Generic organization members
|
97
105
|
explanation: Direct Verifications Subgroup explanation
|
106
|
+
verifications:
|
107
|
+
authorizations:
|
108
|
+
first_login:
|
109
|
+
actions:
|
110
|
+
direct_verifications: Generic organization members
|
98
111
|
```
|
99
112
|
|
100
113
|
|
data/config/locales/ca.yml
CHANGED
data/config/locales/en.yml
CHANGED
data/config/locales/es.yml
CHANGED
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
shared_examples_for "checking users" do |params|
|
4
|
+
context "when check without mails" do
|
5
|
+
it "renders the index with info message" do
|
6
|
+
params[:userlist] = ""
|
7
|
+
post :create, params: params
|
8
|
+
expect(flash[:info]).not_to be_empty
|
9
|
+
expect(flash[:info]).to include("0 users detected")
|
10
|
+
expect(subject).to render_template("decidim/direct_verifications/verification/admin/direct_verifications/index")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context "when check with mails" do
|
15
|
+
it "renders the index with info message" do
|
16
|
+
params[:userlist] = "mail@example.com"
|
17
|
+
post :create, params: params
|
18
|
+
expect(flash[:info]).not_to be_empty
|
19
|
+
expect(flash[:info]).to include("1 users detected")
|
20
|
+
expect(subject).to render_template("decidim/direct_verifications/verification/admin/direct_verifications/index")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
shared_examples_for "registering users" do |params|
|
26
|
+
context "when send valid emails" do
|
27
|
+
it "creates warning message" do
|
28
|
+
post :create, params: params
|
29
|
+
expect(flash[:warning]).not_to be_empty
|
30
|
+
expect(flash[:warning]).to include("1 detected")
|
31
|
+
expect(flash[:warning]).to include("0 errors")
|
32
|
+
expect(flash[:warning]).to include("1 users")
|
33
|
+
expect(flash[:warning]).to include("registered")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
shared_examples_for "authorizing users" do |params|
|
39
|
+
context "when send valid emails" do
|
40
|
+
it "creates notice message" do
|
41
|
+
post :create, params: params
|
42
|
+
expect(flash[:notice]).not_to be_empty
|
43
|
+
expect(flash[:notice]).to include("1 detected")
|
44
|
+
expect(flash[:notice]).to include("0 errors")
|
45
|
+
expect(flash[:notice]).to include("1 users")
|
46
|
+
expect(flash[:notice]).to include("verified")
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
shared_examples_for "revoking users" do |params|
|
52
|
+
context "when send valid emails" do
|
53
|
+
it "creates notice message" do
|
54
|
+
create(
|
55
|
+
:authorization,
|
56
|
+
:granted,
|
57
|
+
name: verification_type,
|
58
|
+
user: authorized_user
|
59
|
+
)
|
60
|
+
post :create, params: params
|
61
|
+
expect(flash[:notice]).not_to be_empty
|
62
|
+
expect(flash[:notice]).to include("1 detected")
|
63
|
+
expect(flash[:notice]).to include("0 errors")
|
64
|
+
expect(flash[:notice]).to include("1 users")
|
65
|
+
expect(flash[:notice]).to include("revoked")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -22,6 +22,7 @@ module Decidim
|
|
22
22
|
def register_users
|
23
23
|
@emails.each do |email, name|
|
24
24
|
next if find_user(email)
|
25
|
+
|
25
26
|
form = register_form(email, name)
|
26
27
|
begin
|
27
28
|
InviteUser.call(form) do
|
@@ -44,6 +45,7 @@ module Decidim
|
|
44
45
|
if (u = find_user(email))
|
45
46
|
auth = authorization(u)
|
46
47
|
next unless !auth.granted? || auth.expired?
|
48
|
+
|
47
49
|
Verification::ConfirmUserAuthorization.call(auth, authorize_form(u)) do
|
48
50
|
on(:ok) do
|
49
51
|
add_processed :authorized, email
|
@@ -63,6 +65,7 @@ module Decidim
|
|
63
65
|
if (u = find_user(email))
|
64
66
|
auth = authorization(u)
|
65
67
|
next unless auth.granted?
|
68
|
+
|
66
69
|
Verification::DestroyUserAuthorization.call(auth) do
|
67
70
|
on(:ok) do
|
68
71
|
add_processed :revoked, email
|
@@ -39,7 +39,7 @@ module Decidim
|
|
39
39
|
if authorization_handler.empty?
|
40
40
|
filter = { decidim_organization_id: organization.id }
|
41
41
|
filter[:email] = emails unless emails.empty?
|
42
|
-
return User.where(filter).where.not(email:
|
42
|
+
return User.where(filter).where.not(email: "")
|
43
43
|
end
|
44
44
|
authorized_users(false)
|
45
45
|
end
|
@@ -55,17 +55,20 @@ module Decidim
|
|
55
55
|
end
|
56
56
|
q = q.where("decidim_users.decidim_organization_id=:org and decidim_users.email!=''", org: organization.id)
|
57
57
|
return q if emails.empty?
|
58
|
+
|
58
59
|
q.where("decidim_users.email IN (:emails)", emails: emails)
|
59
60
|
end
|
60
61
|
|
61
62
|
def expires_in
|
62
63
|
return unless workflow_manifest
|
63
64
|
return if workflow_manifest.expires_in.zero?
|
65
|
+
|
64
66
|
workflow_manifest.expires_in
|
65
67
|
end
|
66
68
|
|
67
69
|
def workflow_manifest
|
68
70
|
return if authorization_handler.empty?
|
71
|
+
|
69
72
|
@workflow_manifest ||= Decidim::Verifications.find_workflow_manifest(authorization_handler)
|
70
73
|
end
|
71
74
|
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: 0.
|
4
|
+
version: '0.20'
|
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:
|
11
|
+
date: 2020-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: decidim-admin
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.17.
|
19
|
+
version: 0.17.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.17.
|
26
|
+
version: 0.17.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: decidim-core
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.17.
|
33
|
+
version: 0.17.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.17.
|
40
|
+
version: 0.17.0
|
41
41
|
description: Provides a verification method that also registers users directly in
|
42
42
|
the platform. Can be used to mass verificate user with other verification handlers
|
43
43
|
email:
|
@@ -66,6 +66,7 @@ files:
|
|
66
66
|
- config/locales/es.yml
|
67
67
|
- lib/decidim/direct_verifications.rb
|
68
68
|
- lib/decidim/direct_verifications/config.rb
|
69
|
+
- lib/decidim/direct_verifications/tests/verification_controller_examples.rb
|
69
70
|
- lib/decidim/direct_verifications/user_processor.rb
|
70
71
|
- lib/decidim/direct_verifications/user_stats.rb
|
71
72
|
- lib/decidim/direct_verifications/verification.rb
|