decidim-api 0.32.0.rc1 → 0.32.0.rc2
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/app/controllers/decidim/api/queries_controller.rb +8 -1
- data/config/locales/sk.yml +14 -0
- data/decidim-api.gemspec +1 -1
- data/lib/decidim/api/version.rb +1 -1
- data/lib/devise/models/api_authenticatable.rb +7 -1
- data/lib/devise/strategies/api_authenticatable.rb +1 -1
- metadata +11 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 23003b024e8967089ac13a4ba13075c57db1e97d09c3773b48888823a1c6a702
|
|
4
|
+
data.tar.gz: 5eba663637e8f9eb32e8d794d32a783e5febfcb2eca8f260eb8147876e964d0a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b559b193744d9dfaca9d67851d5b55718951b9067d5dba4e5e9b1646b64c068ea657fb6d80dfec23ff7da7d6e6160263680d0aec4ae86d0c15f9f25454f37b56
|
|
7
|
+
data.tar.gz: 689b793f28dfc1ba3294add033e06ac87cfbdc8ddc0cf95c4a7823e007de8de0127fff31a958acd76ef1b391099614677cdb0e97e9d1fe5e009387077c986a75
|
|
@@ -36,7 +36,7 @@ module Decidim
|
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
def api_user
|
|
39
|
-
@api_user
|
|
39
|
+
@api_user ||= organization_user(current_api_user || current_user)
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
# Determines the scopes for the user for API requests.
|
|
@@ -84,6 +84,13 @@ module Decidim
|
|
|
84
84
|
raise ArgumentError, "Unexpected parameter: #{variables_param}"
|
|
85
85
|
end
|
|
86
86
|
end
|
|
87
|
+
|
|
88
|
+
def organization_user(user)
|
|
89
|
+
return if user.blank? || current_organization.blank?
|
|
90
|
+
return unless user.decidim_organization_id == current_organization.id
|
|
91
|
+
|
|
92
|
+
user
|
|
93
|
+
end
|
|
87
94
|
end
|
|
88
95
|
end
|
|
89
96
|
end
|
data/config/locales/sk.yml
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
+
---
|
|
1
2
|
sk:
|
|
3
|
+
decidim:
|
|
4
|
+
api:
|
|
5
|
+
errors:
|
|
6
|
+
introspection_disabled: Introspekcia je pre túto požiadavku zakázaná
|
|
7
|
+
invalid_locale: Poskytnutý neplatný jazyk
|
|
8
|
+
locale_argument_error: Pri internom spracovaní údajov i18n sa vyskytla chyba
|
|
9
|
+
not_found: "%{type} sa nenašiel"
|
|
10
|
+
permission_not_set: Pre tento %{type} nebolo nastavené oprávnenie
|
|
11
|
+
recursion_limit_exceeded_error: V dopyte bolo zistených príliš veľa rekurzií
|
|
12
|
+
too_many_aliases_error: Použilo sa príliš veľa aliasov. Použili ste %{size} aliasov, ale povolených je %{limit}.
|
|
13
|
+
unauthorized_field: Nemôžete zobraziť ani upraviť pole %{field} v %{type}, pretože nemáte oprávnenie
|
|
14
|
+
unauthorized_mutation: Nemáte oprávnenie vykonať túto mutáciu
|
|
15
|
+
unauthorized_object: Nemôžete zobraziť ani upraviť tento %{type}, pretože nemáte oprávnenia
|
data/decidim-api.gemspec
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
$LOAD_PATH.push File.expand_path("lib", __dir__)
|
|
4
4
|
|
|
5
5
|
Gem::Specification.new do |s|
|
|
6
|
-
version = "0.32.0.
|
|
6
|
+
version = "0.32.0.rc2"
|
|
7
7
|
s.version = version
|
|
8
8
|
s.authors = ["Josep Jaume Rey Peroy", "Marc Riera Casals", "Oriol Gual Oliva"]
|
|
9
9
|
s.email = ["josepjaume@gmail.com", "mrc2407@gmail.com", "oriolgual@gmail.com"]
|
data/lib/decidim/api/version.rb
CHANGED
|
@@ -22,7 +22,13 @@ module Devise
|
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def find_for_api_authentication(conditions)
|
|
25
|
-
|
|
25
|
+
organization = conditions.dig(:env, "decidim.current_organization")
|
|
26
|
+
return unless organization
|
|
27
|
+
|
|
28
|
+
find_for_authentication(
|
|
29
|
+
api_key: conditions[:api_key],
|
|
30
|
+
decidim_organization_id: organization.id
|
|
31
|
+
)
|
|
26
32
|
end
|
|
27
33
|
end
|
|
28
34
|
end
|
|
@@ -9,7 +9,7 @@ module Devise
|
|
|
9
9
|
key = authentication_hash[:key]
|
|
10
10
|
secret = authentication_hash[:secret]
|
|
11
11
|
|
|
12
|
-
resource = mapping.to.find_for_api_authentication(api_key: key)
|
|
12
|
+
resource = mapping.to.find_for_api_authentication(api_key: key, env:)
|
|
13
13
|
validation_status = validate(resource) { resource.valid_api_secret?(secret) }
|
|
14
14
|
|
|
15
15
|
success!(resource) if validation_status
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: decidim-api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.32.0.
|
|
4
|
+
version: 0.32.0.rc2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Josep Jaume Rey Peroy
|
|
@@ -17,14 +17,14 @@ dependencies:
|
|
|
17
17
|
requirements:
|
|
18
18
|
- - '='
|
|
19
19
|
- !ruby/object:Gem::Version
|
|
20
|
-
version: 0.32.0.
|
|
20
|
+
version: 0.32.0.rc2
|
|
21
21
|
type: :runtime
|
|
22
22
|
prerelease: false
|
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
|
24
24
|
requirements:
|
|
25
25
|
- - '='
|
|
26
26
|
- !ruby/object:Gem::Version
|
|
27
|
-
version: 0.32.0.
|
|
27
|
+
version: 0.32.0.rc2
|
|
28
28
|
- !ruby/object:Gem::Dependency
|
|
29
29
|
name: devise-jwt
|
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -111,56 +111,56 @@ dependencies:
|
|
|
111
111
|
requirements:
|
|
112
112
|
- - '='
|
|
113
113
|
- !ruby/object:Gem::Version
|
|
114
|
-
version: 0.32.0.
|
|
114
|
+
version: 0.32.0.rc2
|
|
115
115
|
type: :development
|
|
116
116
|
prerelease: false
|
|
117
117
|
version_requirements: !ruby/object:Gem::Requirement
|
|
118
118
|
requirements:
|
|
119
119
|
- - '='
|
|
120
120
|
- !ruby/object:Gem::Version
|
|
121
|
-
version: 0.32.0.
|
|
121
|
+
version: 0.32.0.rc2
|
|
122
122
|
- !ruby/object:Gem::Dependency
|
|
123
123
|
name: decidim-comments
|
|
124
124
|
requirement: !ruby/object:Gem::Requirement
|
|
125
125
|
requirements:
|
|
126
126
|
- - '='
|
|
127
127
|
- !ruby/object:Gem::Version
|
|
128
|
-
version: 0.32.0.
|
|
128
|
+
version: 0.32.0.rc2
|
|
129
129
|
type: :development
|
|
130
130
|
prerelease: false
|
|
131
131
|
version_requirements: !ruby/object:Gem::Requirement
|
|
132
132
|
requirements:
|
|
133
133
|
- - '='
|
|
134
134
|
- !ruby/object:Gem::Version
|
|
135
|
-
version: 0.32.0.
|
|
135
|
+
version: 0.32.0.rc2
|
|
136
136
|
- !ruby/object:Gem::Dependency
|
|
137
137
|
name: decidim-dev
|
|
138
138
|
requirement: !ruby/object:Gem::Requirement
|
|
139
139
|
requirements:
|
|
140
140
|
- - '='
|
|
141
141
|
- !ruby/object:Gem::Version
|
|
142
|
-
version: 0.32.0.
|
|
142
|
+
version: 0.32.0.rc2
|
|
143
143
|
type: :development
|
|
144
144
|
prerelease: false
|
|
145
145
|
version_requirements: !ruby/object:Gem::Requirement
|
|
146
146
|
requirements:
|
|
147
147
|
- - '='
|
|
148
148
|
- !ruby/object:Gem::Version
|
|
149
|
-
version: 0.32.0.
|
|
149
|
+
version: 0.32.0.rc2
|
|
150
150
|
- !ruby/object:Gem::Dependency
|
|
151
151
|
name: decidim-participatory_processes
|
|
152
152
|
requirement: !ruby/object:Gem::Requirement
|
|
153
153
|
requirements:
|
|
154
154
|
- - '='
|
|
155
155
|
- !ruby/object:Gem::Version
|
|
156
|
-
version: 0.32.0.
|
|
156
|
+
version: 0.32.0.rc2
|
|
157
157
|
type: :development
|
|
158
158
|
prerelease: false
|
|
159
159
|
version_requirements: !ruby/object:Gem::Requirement
|
|
160
160
|
requirements:
|
|
161
161
|
- - '='
|
|
162
162
|
- !ruby/object:Gem::Version
|
|
163
|
-
version: 0.32.0.
|
|
163
|
+
version: 0.32.0.rc2
|
|
164
164
|
description: API engine for decidim
|
|
165
165
|
email:
|
|
166
166
|
- josepjaume@gmail.com
|