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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4928cec1e6b6d4f5e09fd2235e38b4e7a0fe411dc4be792a25d5bff2a8ef5b6
4
- data.tar.gz: 978ba2b8a55151a524643df8268e2f0435f329edc46acad48c3fe463f5382150
3
+ metadata.gz: f9f466181031acf9fe03bd55ef1f1ae1e407707acc0b22a639576523eebe90ae
4
+ data.tar.gz: 3071bc96c9e22c9ca06ce14f3ce81b1280a54dcb3a4478abb0ef02531c2f6c23
5
5
  SHA512:
6
- metadata.gz: f9435b6e219c4c49c2d19899fe7482524ca101545f9099dd2b09a7a7c33a0d662ce0b60dace84582912b1e91c8969843b2263404e4730c31043908da455f345a
7
- data.tar.gz: 42dc907a3fd1bfc59194a31007c6ed083a5b5610790bde8f32a50ef83ee5fed8ed8e4a215adb8586bb7e1e096a9244e5aa48c0a0973b0d1afce1f409ddc9cd3d
6
+ metadata.gz: 490468f076bdc3f270d8f853f0c809bc6aac17f989d4984538550107e963fab25b52ae5bb30ed76856747e67740976dc3a027d49b0f916a339565b409f606751
7
+ data.tar.gz: 8e9b5c8d40c075d34e41f3711d9c5740e0ecc62bd916ec6d3a4b9afa80855d1ca1c260a13eda183feca9aefa2066b5682ba9e0a80c300a36844cab79b53896d0
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Decidim::DirectVerifications
2
2
 
3
- [![Build Status](https://travis-ci.org/Platoniq/decidim-verifications-direct_verifications.svg?branch=master)](https://travis-ci.org/Platoniq/decidim-verifications-direct_verifications)
3
+ ![[CI] Test](https://github.com/Platoniq/decidim-verifications-direct_verifications/workflows/%5BCI%5D%20Test/badge.svg)
4
+ [![Maintainability](https://api.codeclimate.com/v1/badges/2195deb4de6c6354a6bc/maintainability)](https://codeclimate.com/github/Platoniq/decidim-verifications-direct_verifications/maintainability)
5
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/2195deb4de6c6354a6bc/test_coverage)](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
 
@@ -75,6 +75,7 @@ module Decidim
75
75
 
76
76
  def configured_workflows
77
77
  return Decidim::DirectVerifications.config.manage_workflows if Decidim::DirectVerifications.config
78
+
78
79
  ["direct_verifications"]
79
80
  end
80
81
 
@@ -59,6 +59,11 @@ ca:
59
59
  authorizations:
60
60
  new:
61
61
  no_action: Aquest mètode requereix que un administrador us verifiqui
62
+ verifications:
63
+ authorizations:
64
+ first_login:
65
+ actions:
66
+ direct_verifications: Verificació directa
62
67
  devise:
63
68
  mailer:
64
69
  direct_invite:
@@ -57,6 +57,11 @@ en:
57
57
  authorizations:
58
58
  new:
59
59
  no_action: This method requires an administrator that verifies you
60
+ verifications:
61
+ authorizations:
62
+ first_login:
63
+ actions:
64
+ direct_verifications: Direct verification
60
65
  devise:
61
66
  mailer:
62
67
  direct_invite:
@@ -59,6 +59,11 @@ es:
59
59
  authorizations:
60
60
  new:
61
61
  no_action: Este método requiere que un administrador os verifique
62
+ verifications:
63
+ authorizations:
64
+ first_login:
65
+ actions:
66
+ direct_verifications: Verificación directa
62
67
  devise:
63
68
  mailer:
64
69
  direct_invite:
@@ -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
@@ -3,7 +3,8 @@
3
3
  module Decidim
4
4
  # This holds the decidim-direct_verifications version.
5
5
  module DirectVerifications
6
- VERSION = "0.17.8"
7
- DECIDIM_VERSION = ">= 0.17.1"
6
+ VERSION = "0.20"
7
+ DECIDIM_VERSION = "0.20.0"
8
+ MIN_DECIDIM_VERSION = ">= 0.17.0"
8
9
  end
9
10
  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.17.8
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: 2019-06-12 00:00:00.000000000 Z
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.1
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.1
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.1
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.1
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