decidim-suomifi 0.18.1 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 150ac439de1d3aa6d6b1d4f751a2d9aaa42d71df7258e2ad1ce4ff17dda14908
4
- data.tar.gz: d507607ae2555b4b22d264084b0e4ae5b2ea92cec8fd40d99a684649d1ecd914
3
+ metadata.gz: 297cde0472fa64df7158b219adb6a6f91e03f57ac483c1fc6e05a6572ac4c700
4
+ data.tar.gz: 999f2c1d88e1c33281414e339e7306a3bcef5e91f3cb4c110201c458531f51bb
5
5
  SHA512:
6
- metadata.gz: '060508a9c89d455df3abc8ae4c97d0d1fe4cf3602574209dd937f06675c007bdd6a67925c7082138d941e47c4f638bbbd9397d9ea7c1df54ab61337558c6a30e'
7
- data.tar.gz: 1632a366514b05b264d90e0d3f47479d0bedd753127de042f654cf49af9e581b18422c2502998095bc90077a630ff7224b970d7b3dc30fb4ccb2d807d623699a
6
+ metadata.gz: ec37f076bb2edf69be9065a796eef6ee217ab74746c5e3e6a1f08aa370eef76ea2da8c6b36eb7a794009969a1f92962269c4bde0b208be4a99ee57f168c2edd3
7
+ data.tar.gz: 2e702a242797d54eed6b8254ba1dfb227cc7fc67a9db28c4627101f0e3b477cfc530a41e7214faf30a811a55377aec2d607119e0b014ff1b3638237d4493cf1a
data/README.md CHANGED
@@ -59,6 +59,9 @@ You need to set the following configuration options inside the initializer:
59
59
  sent to Suomi.fi.
60
60
  - `:private_key_file` - Path to the local private key (corresponding to the
61
61
  certificate). Will be used to decrypt messages coming from Suomi.fi.
62
+
63
+ Optionally you can also configure the module with the following options:
64
+
62
65
  - `:auto_email_domain` - Defines the auto-email domain in case the user's domain
63
66
  is not stored at Suomi.fi. In case this is not set (default), emails will not
64
67
  be auto-generated and users will need to enter them manually in case Suomi.fi
@@ -67,6 +70,14 @@ You need to set the following configuration options inside the initializer:
67
70
  `suomifi-756be91097ac490961fd04f121cb9550@example.org`. The email will
68
71
  always have the `suomifi-` prefix and the domain part is defined by the
69
72
  configuration option.
73
+ * In case this is not defined, the organization's host will be used as the
74
+ default.
75
+ - `:use_suomifi_email` - Defines whether the emails stored in Suomi.fi should
76
+ be used for the user accounts if they are available. Note that not all people
77
+ have an email address stored in the Suomi.fi database and not everyone keeps
78
+ it up to date. Another problem with this is that some people may have an old
79
+ or incorrectly written email address stored in Suomi.fi that may cause wrong
80
+ email addresses to be used for the use accounts.
70
81
 
71
82
  For more information about these options and possible other options, please
72
83
  refer to the [`omniauth-suomifi`](https://github.com/mainio/omniauth-suomifi)
@@ -27,12 +27,28 @@ module Decidim
27
27
  :medium_extensive
28
28
  end
29
29
 
30
- # Defines the auto email domain in case the person's email address is not
31
- # stored in the Suomi.fi database. In case this is defined, the user will
32
- # be automatically assigned an email such as
33
- # "suomifi-identifier@auto-email-domain.fi" upon their registration.
30
+ # Defines the email domain for the auto-generated email addresses for the
31
+ # user accounts. You can also use the person's own email address possibly
32
+ # stored in the Suomi.fi database with the option `use_suomifi_email`. Not
33
+ # all people have email address stored in Suomi.fi and some people may have
34
+ # incorrect email address stored there.
35
+ #
36
+ # In case this is defined, the user will be automatically assigned an email
37
+ # such as "suomifi-identifier@auto-email-domain.fi" upon their registration.
38
+ #
39
+ # In case this is not defined, the default is the organization's domain.
34
40
  config_accessor :auto_email_domain
35
41
 
42
+ # Defines whether to use the person's email address stored in the Suomi.fi
43
+ # database for the user account. Some people do not actively update these
44
+ # email addresses and some people may have a wrong email address stored in
45
+ # the Suomi.fi database which can belong to another person in the worst case
46
+ # scenario which can cause confusion among the participants. Use this option
47
+ # with caution!
48
+ config_accessor :use_suomifi_email do
49
+ false
50
+ end
51
+
36
52
  config_accessor :sp_entity_id, instance_reader: false
37
53
 
38
54
  # The certificate string for the application
@@ -13,10 +13,10 @@ module Decidim
13
13
 
14
14
  def verified_email
15
15
  @verified_email ||= begin
16
- if saml_attributes[:email]
16
+ if Decidim::Suomifi.use_suomifi_email && saml_attributes[:email]
17
17
  saml_attributes[:email]
18
- elsif Decidim::Suomifi.auto_email_domain
19
- domain = Decidim::Suomifi.auto_email_domain
18
+ else
19
+ domain = Decidim::Suomifi.auto_email_domain || organization.host
20
20
  "suomifi-#{person_identifier_digest}@#{domain}"
21
21
  end
22
22
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "webmock"
4
+
3
5
  module Decidim
4
6
  module Suomifi
5
7
  module Test
@@ -32,15 +34,7 @@ module Decidim
32
34
  end
33
35
 
34
36
  def instance_initialize
35
- yield self
36
-
37
- # Setup the Suomi.fi OmniAuth strategy for Devise
38
- # ::Devise.setup do |config|
39
- # config.omniauth(
40
- # :suomifi,
41
- # Decidim::Suomifi.omniauth_settings
42
- # )
43
- # end
37
+ yield self if block_given?
44
38
  end
45
39
  end
46
40
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Decidim
4
4
  module Suomifi
5
- VERSION = "0.18.1"
6
- DECIDIM_VERSION = "~> 0.18.0"
5
+ VERSION = "0.19.0"
6
+ DECIDIM_VERSION = "~> 0.19.0"
7
7
  end
8
8
  end
@@ -1,3 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "decidim/suomifi/test/runtime"
4
+
3
5
  Decidim::Suomifi::Test::Runtime.initialize
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-suomifi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.1
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antti Hukkanen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-29 00:00:00.000000000 Z
11
+ date: 2019-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: decidim-core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.18.0
19
+ version: 0.19.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.18.0
26
+ version: 0.19.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: henkilotunnus
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.18.0
61
+ version: 0.19.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.18.0
68
+ version: 0.19.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: xmlenc
71
71
  requirement: !ruby/object:Gem::Requirement