decidim-verifications 0.9.3 → 0.10.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: e674a0b1e962341cf29174556c19e2a47f240a51671b922d08414cb832fd8971
4
- data.tar.gz: 132ee3ce99a490341af0283b3955969c146e036b6b03bd2e9d3329bafa782b3c
3
+ metadata.gz: 28b612e850c7a5f71a92a94404023f8a7df8f40d428646319980a97817f66037
4
+ data.tar.gz: b5c270ac60c8112b7e17c7e85d8b9529b7fcceb0c21057ce298ea8dbccc1a262
5
5
  SHA512:
6
- metadata.gz: a05a7dfc16a8bbd9136088528e73b038fcb1e5ba4ef72679586700b42117330324684545551b46704d7bc647cf2cc3332f1260c1e5b766e6cce28c128e2b1619
7
- data.tar.gz: 05cd1188612e0527c8414495b698907e8aeb2ff72ab721e4e0ae04f223bc591b687004162d10e3e9d7dd4b6ea34fea0f0ff25aa3280e7801a00f03798464b535
6
+ metadata.gz: e3c3addd88ca3aee55235b7b889c70bbc3a781116b9b952bb1a050cc5aafcb0d1d96c451bd1a8815ea39cc5741dc1e1fa5302fe4558375d0c54f9d980d66195d
7
+ data.tar.gz: 0a6c56b01fee5975c7eda078ca60bb443553770b6adaea88525e4eb1504257836ee4d1ef238652e17bd7aae0caf0555eab21d262a2ed3d2195e83aeb82e2cd99
data/README.md CHANGED
@@ -97,17 +97,18 @@ You can override default behavior implementing a class that inherits form
97
97
  implement its public methods:
98
98
 
99
99
  * The `initialize` method receives the current authorization process context and
100
- saves it in local variables. This include the current authorization user state (an
101
- `Authorization` record) and permission `options` related to the action is trying to
102
- perform.
100
+ saves it in local variables. This include the current authorization user state
101
+ (an `Authorization` record) and permission `options` related to the action is
102
+ trying to perform.
103
103
 
104
104
  * The `authorize` method is responsible of evaluating the authorization process
105
- context and determine if the user authorization is `:ok` or in any other status.
105
+ context and determine if the user authorization is `:ok` or in any other
106
+ status.
106
107
 
107
108
  * The `redirect_params` method allows to add additional query string parameters
108
- when redirecting to the authorization form. This is useful to send to the
109
- authorization form the permission `options` information that could be useful to
110
- adapt its behavior or appearance.
109
+ when redirecting to the authorization form. This is useful to send to the
110
+ authorization form the permission `options` information that could be useful
111
+ to adapt its behavior or appearance.
111
112
 
112
113
  To be used by the verification method, this class should be referenced by name in
113
114
  its workflow manifest:
@@ -76,15 +76,15 @@ module Decidim
76
76
  end
77
77
 
78
78
  def active_authorization_methods
79
- Authorizations.new(user: current_user).pluck(:name)
79
+ Authorizations.new(organization: current_organization, user: current_user).pluck(:name)
80
80
  end
81
81
 
82
82
  def granted_authorizations
83
- Authorizations.new(user: current_user, granted: true)
83
+ Authorizations.new(organization: current_organization, user: current_user, granted: true)
84
84
  end
85
85
 
86
86
  def pending_authorizations
87
- Authorizations.new(user: current_user, granted: false)
87
+ Authorizations.new(organization: current_organization, user: current_user, granted: false)
88
88
  end
89
89
 
90
90
  def store_current_location
@@ -17,7 +17,7 @@ module Decidim
17
17
 
18
18
  def pending_authorizations
19
19
  Authorizations
20
- .new(name: "id_documents", granted: false)
20
+ .new(organization: current_organization, name: "id_documents", granted: false)
21
21
  .query
22
22
  .where("verification_metadata->'rejected' IS NULL")
23
23
  end
@@ -66,9 +66,11 @@ module Decidim
66
66
 
67
67
  private
68
68
 
69
+ # rubocop:disable Naming/MemoizedInstanceVariableName
69
70
  def authorization
70
71
  @authorization_presenter ||= AuthorizationPresenter.new(@authorization)
71
72
  end
73
+ # rubocop:enable Naming/MemoizedInstanceVariableName
72
74
 
73
75
  def load_authorization
74
76
  @authorization = Decidim::Authorization.find_or_initialize_by(
@@ -18,7 +18,7 @@ module Decidim
18
18
  private
19
19
 
20
20
  def pending_authorizations
21
- Authorizations.new(name: "postal_letter", granted: false)
21
+ Authorizations.new(organization: current_organization, name: "postal_letter", granted: false)
22
22
  end
23
23
  end
24
24
  end
@@ -58,9 +58,11 @@ module Decidim
58
58
 
59
59
  private
60
60
 
61
+ # rubocop:disable Naming/MemoizedInstanceVariableName
61
62
  def authorization
62
63
  @authorization_presenter ||= AuthorizationPresenter.new(@authorization)
63
64
  end
65
+ # rubocop:enable Naming/MemoizedInstanceVariableName
64
66
 
65
67
  def load_authorization
66
68
  @authorization = Decidim::Authorization.find_or_initialize_by(
@@ -6,10 +6,12 @@ module Decidim
6
6
  class Authorizations < Rectify::Query
7
7
  # Initializes the class.
8
8
  #
9
+ # @param organization [Organization] The organization where this authorization belongs to
9
10
  # @param name [String] The name of an authorization method
10
11
  # @param user [User] A user to find authorizations for
11
12
  # @param granted [Boolean] Whether the authorization is granted or not
12
- def initialize(user: nil, name: nil, granted: nil)
13
+ def initialize(organization:, user: nil, name: nil, granted: nil)
14
+ @organization = organization
13
15
  @user = user
14
16
  @name = name
15
17
  @granted = granted
@@ -19,7 +21,7 @@ module Decidim
19
21
  #
20
22
  # Returns an ActiveRecord::Relation.
21
23
  def query
22
- scope = Decidim::Authorization.where(nil)
24
+ scope = Decidim::Authorization.left_outer_joins(:organization).where(decidim_organizations: { id: organization.id })
23
25
 
24
26
  scope = scope.where(name: name) unless name.nil?
25
27
  scope = scope.where(user: user) unless user.nil?
@@ -35,7 +37,7 @@ module Decidim
35
37
 
36
38
  private
37
39
 
38
- attr_reader :user, :name, :granted
40
+ attr_reader :user, :name, :granted, :organization
39
41
  end
40
42
  end
41
43
  end
@@ -9,6 +9,13 @@ ca:
9
9
  document_type: Tipus del teu document
10
10
  user: Usuari
11
11
  verification_attachment: Còpia escanejada del teu document
12
+ postal_letter_address:
13
+ full_address: Adreça completa
14
+ postal_letter_confirmation:
15
+ verification_code: Codi de verificació
16
+ postal_letter_postage:
17
+ full_address: Adreça completa
18
+ verification_code: Codi de verificació
12
19
  decidim:
13
20
  admin:
14
21
  menu:
@@ -10,6 +10,13 @@ en:
10
10
  document_type: Type of your document
11
11
  user: User
12
12
  verification_attachment: Scanned copy of your document
13
+ postal_letter_address:
14
+ full_address: Full address
15
+ postal_letter_confirmation:
16
+ verification_code: Verification code
17
+ postal_letter_postage:
18
+ full_address: Full address
19
+ verification_code: Verification code
13
20
  decidim:
14
21
  admin:
15
22
  menu:
@@ -9,6 +9,13 @@ es:
9
9
  document_type: Tipo de tu documento
10
10
  user: Usuario
11
11
  verification_attachment: Copia escaneada de tu documento
12
+ postal_letter_address:
13
+ full_address: Dirección completa
14
+ postal_letter_confirmation:
15
+ verification_code: Código de verificación
16
+ postal_letter_postage:
17
+ full_address: Dirección completa
18
+ verification_code: Código de verificación
12
19
  decidim:
13
20
  admin:
14
21
  menu:
@@ -9,6 +9,13 @@ eu:
9
9
  document_type: Zure dokumentuaren mota
10
10
  user: Erabiltzaileak
11
11
  verification_attachment: Zure dokumentuaren eskaneatutako kopia
12
+ postal_letter_address:
13
+ full_address: Helbide osoa
14
+ postal_letter_confirmation:
15
+ verification_code: Egiaztapen kodea
16
+ postal_letter_postage:
17
+ full_address: Helbide osoa
18
+ verification_code: Egiaztapen kodea
12
19
  decidim:
13
20
  admin:
14
21
  menu:
@@ -9,6 +9,13 @@ fi:
9
9
  document_type: Asiakirjan tyyppi
10
10
  user: Käyttäjä
11
11
  verification_attachment: Asiakirjan skannattu kopio
12
+ postal_letter_address:
13
+ full_address: Koko osoite
14
+ postal_letter_confirmation:
15
+ verification_code: Vahvistuskoodi
16
+ postal_letter_postage:
17
+ full_address: Koko osoite
18
+ verification_code: Vahvistuskoodi
12
19
  decidim:
13
20
  admin:
14
21
  menu:
@@ -9,6 +9,13 @@ fr:
9
9
  document_type: Type de votre document
10
10
  user: Utilisateur
11
11
  verification_attachment: Copie scannée de votre document
12
+ postal_letter_address:
13
+ full_address: Adresse complète
14
+ postal_letter_confirmation:
15
+ verification_code: Code de vérification
16
+ postal_letter_postage:
17
+ full_address: Adresse complète
18
+ verification_code: Code de vérification
12
19
  decidim:
13
20
  admin:
14
21
  menu:
@@ -9,6 +9,13 @@ gl:
9
9
  document_type: Tipo do documento
10
10
  user: Usuario
11
11
  verification_attachment: Copia escaneada do documento
12
+ postal_letter_address:
13
+ full_address: Enderezo completo
14
+ postal_letter_confirmation:
15
+ verification_code: Código de verificación
16
+ postal_letter_postage:
17
+ full_address: Enderezo completo
18
+ verification_code: Código de verificación
12
19
  decidim:
13
20
  admin:
14
21
  menu:
@@ -9,6 +9,13 @@ it:
9
9
  document_type: Tipo del tuo documento
10
10
  user: Utente
11
11
  verification_attachment: Copia scannerizzata del tuo documento
12
+ postal_letter_address:
13
+ full_address: Indirizzo completo
14
+ postal_letter_confirmation:
15
+ verification_code: Codice di verifica
16
+ postal_letter_postage:
17
+ full_address: Indirizzo completo
18
+ verification_code: Codice di verifica
12
19
  decidim:
13
20
  admin:
14
21
  menu:
@@ -9,6 +9,13 @@ nl:
9
9
  document_type: Type van uw document
10
10
  user: Gebruiker
11
11
  verification_attachment: Gescande kopie van uw document
12
+ postal_letter_address:
13
+ full_address: Volledig adres
14
+ postal_letter_confirmation:
15
+ verification_code: Verificatie code
16
+ postal_letter_postage:
17
+ full_address: Volledig adres
18
+ verification_code: Verificatie code
12
19
  decidim:
13
20
  admin:
14
21
  menu:
@@ -9,6 +9,13 @@ pl:
9
9
  document_type: Typ twojego dokumentu
10
10
  user: Użytkownik
11
11
  verification_attachment: Zeskanowana kopia twojego dokumentu
12
+ postal_letter_address:
13
+ full_address: Pełny adres
14
+ postal_letter_confirmation:
15
+ verification_code: Kod weryfikacyjny
16
+ postal_letter_postage:
17
+ full_address: Pełny adres
18
+ verification_code: Kod weryfikacyjny
12
19
  decidim:
13
20
  admin:
14
21
  menu:
@@ -55,11 +62,6 @@ pl:
55
62
  authorize_with: Zweryfikuj przy pomocy %{authorizer}
56
63
  skip_verification: Możesz teraz pominąć to i %{link}
57
64
  start_exploring: zacznij odkrywać
58
- dummy_authorization:
59
- extra_explanation:
60
- one: Udział jest ograniczony do użytkowników, którzy mają kod pocztowy %{postal_codes}.
61
- few: 'Udział jest ograniczony do użytkowników, którzy mają jeden z następujących kodów pocztowych: %{postal_codes}.'
62
- other: 'Udział jest ograniczony do użytkowników, którzy mają jeden z następujących kodów pocztowych: %{postal_codes}.'
63
65
  id_documents:
64
66
  admin:
65
67
  confirmations:
@@ -9,6 +9,13 @@ pt-BR:
9
9
  document_type: Tipo do seu documento
10
10
  user: Do utilizador
11
11
  verification_attachment: Cópia digitalizada do seu documento
12
+ postal_letter_address:
13
+ full_address: Endereço completo
14
+ postal_letter_confirmation:
15
+ verification_code: Código de verificação
16
+ postal_letter_postage:
17
+ full_address: Endereço completo
18
+ verification_code: Código de verificação
12
19
  decidim:
13
20
  admin:
14
21
  menu:
@@ -9,6 +9,13 @@ pt:
9
9
  document_type: Tipo do seu documento
10
10
  user: Do utilizador
11
11
  verification_attachment: Cópia digitalizada do seu documento
12
+ postal_letter_address:
13
+ full_address: Endereço completo
14
+ postal_letter_confirmation:
15
+ verification_code: Código de verificação
16
+ postal_letter_postage:
17
+ full_address: Endereço completo
18
+ verification_code: Código de verificação
12
19
  decidim:
13
20
  admin:
14
21
  menu:
@@ -9,6 +9,13 @@ sv:
9
9
  document_type: Typ av ditt dokument
10
10
  user: Användare
11
11
  verification_attachment: Skannad kopia av ditt dokument
12
+ postal_letter_address:
13
+ full_address: Hela adressen
14
+ postal_letter_confirmation:
15
+ verification_code: Verifierings kod
16
+ postal_letter_postage:
17
+ full_address: Hela adressen
18
+ verification_code: Verifierings kod
12
19
  decidim:
13
20
  admin:
14
21
  menu:
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-verifications version.
5
5
  module Verifications
6
6
  def self.version
7
- "0.9.3"
7
+ "0.10.0"
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-verifications
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Rodriguez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-27 00:00:00.000000000 Z
11
+ date: 2018-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: decidim-core
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.9.3
19
+ version: 0.10.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.9.3
26
+ version: 0.10.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: decidim-admin
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.9.3
33
+ version: 0.10.0
34
34
  type: :development
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.9.3
40
+ version: 0.10.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: decidim-dev
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 0.9.3
47
+ version: 0.10.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 0.9.3
54
+ version: 0.10.0
55
55
  description: Several verification methods for your decidim instance
56
56
  email:
57
57
  - deivid.rodriguez@riseup.net
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  version: '0'
152
152
  requirements: []
153
153
  rubyforge_project:
154
- rubygems_version: 2.7.3
154
+ rubygems_version: 2.7.6
155
155
  signing_key:
156
156
  specification_version: 4
157
157
  summary: Decidim verifications module