panda_pal 5.20.0 → 5.20.1
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/config/initializers/apartment.rb +8 -2
- data/lib/panda_pal/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 05adff1a6ac1e3c077fce392acaf5ac773b516f75ffa90d171ed8cb9c6c1b4b0
|
|
4
|
+
data.tar.gz: 243c14022da12a505d38f0be0a05c135412ab1eaba1a5478c3fec2d7ff967062
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 992ba7279928e36ae595362aaee43babe52f5b0cce6bbf75a9eb42c1f803588fd62221039714726aef283aec7becea7b69cbff1aba4dd3beaf7f6492d5291d67
|
|
7
|
+
data.tar.gz: 3e75a8857d2df28981c883922221d964edbfd324c7269034aa984a5eb5aaf9a97b2757e7a46740ae044086cbe312798b333cf5b5bd9645442d385ffe6cfc7e74
|
|
@@ -273,17 +273,23 @@ Apartment.configure do |config|
|
|
|
273
273
|
end
|
|
274
274
|
|
|
275
275
|
Rails.application.config.middleware.use Apartment::Elevators::Generic, lambda { |request|
|
|
276
|
+
params = lambda do
|
|
277
|
+
request.params
|
|
278
|
+
rescue EOFError, Rack::Utils::InvalidParameterError, Rack::Utils::ParameterTypeError, Rack::QueryParser::ParamsTooDeepError
|
|
279
|
+
{}
|
|
280
|
+
end
|
|
281
|
+
|
|
276
282
|
tenant = if match = request.path.match(/\/(?:orgs?|organizations?)\/(\d+)/)
|
|
277
283
|
PandaPal::Organization.find_by(id: match[1]).try(:tenant_name)
|
|
278
284
|
elsif match = request.path.match(/\/(?:orgs?|organizations?|o)\/(\w+)/)
|
|
279
285
|
PandaPal::Organization.find_by(name: match[1]).try(:tenant_name)
|
|
280
|
-
elsif (panda_token = PandaPal::Session.extract_panda_token(request)).present?
|
|
286
|
+
elsif (panda_token = PandaPal::Session.extract_panda_token(request, params.call)).present?
|
|
281
287
|
header, sig = panda_token.split('.')
|
|
282
288
|
# This is just switching the tenant. Auth should be performed elsewhere (eg via `forbid_access_if_lacking_session`/`valid_session?`).
|
|
283
289
|
decoded_header = JSON.parse(Base64.urlsafe_decode64(header))
|
|
284
290
|
PandaPal::Organization.find_by(id: decoded_header['o']).try(:tenant_name)
|
|
285
291
|
elsif request.path.start_with?('/rails/active_storage/blobs/')
|
|
286
|
-
PandaPal::Organization.find_by(id:
|
|
292
|
+
PandaPal::Organization.find_by(id: params.call['organization_id']).try(:tenant_name)
|
|
287
293
|
end
|
|
288
294
|
tenant || 'public'
|
|
289
295
|
}
|
data/lib/panda_pal/version.rb
CHANGED