arkaan 0.7.17 → 0.7.18

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
  SHA1:
3
- metadata.gz: 6f8771e04e16cc35c953c3019a3f0bcb6b9b07cf
4
- data.tar.gz: 74913c921ed24b8c6d036c54c94475a760222080
3
+ metadata.gz: 905077c1bbe8679549f8949e8f90f2132a3e217d
4
+ data.tar.gz: 31cd85935a4dee853d2b5f176d551e8d63503f0d
5
5
  SHA512:
6
- metadata.gz: 0bd608fd764b34ee509a5b28570f7d1745c83c8ef346c8058b2dc2fd1f27606b46fc1017f37916b7f62a39d4b9829229510c46e5a878e3b5543a3fc89f51a2f9
7
- data.tar.gz: 6fa2b4acf5f2733a0511f6a43c1416c4634d3703b971f5bfc3c2b648aecc86feda8a277c6c7ac00462dace64dcf87f21cfef5a1d63f992e84c67e5dcc2ae828d
6
+ metadata.gz: 309c732e2dac6be5cf4f91d66838da2ac0d440c60f606da2a65aaa6fc2ce7a4193f2e5e06d11f0a2667e4b3adf130640371bde13f68e603269fd92b322514af8
7
+ data.tar.gz: 8adf71cff63870589f9291725b2c086170c4bc381bd92c1089f3da343247475e78d89a545e589b8d89eb13ea35833b0de7e4e663680e24a9cfcbc6c99da39c3e
@@ -10,12 +10,13 @@ module Arkaan
10
10
 
11
11
  gateway = Arkaan::Monitoring::Gateway.where(token: params['token']).first
12
12
  application = Arkaan::OAuth::Application.where(key: params['app_key']).first
13
+ route = parse_current_route
13
14
 
14
15
  if gateway.nil?
15
16
  halt 404, {message: 'gateway_not_found'}.to_json
16
17
  elsif application.nil?
17
18
  halt 404, {message: 'application_not_found'}.to_json
18
- elsif !application.premium?
19
+ elsif route && route.premium? && !application.premium?
19
20
  halt 401, {message: 'application_not_authorized'}.to_json
20
21
  end
21
22
  end
@@ -62,6 +63,13 @@ module Arkaan
62
63
  params[key] = parsed_body[key]
63
64
  end
64
65
  end
66
+
67
+ # Gets the current route in the database from the sinatra route.
68
+ # @return [Arkaan::Monitoring::Route] the route declared in the services registry.
69
+ def parse_current_route
70
+ splitted = request.env['sinatra.route'].split(' ')
71
+ return Arkaan::Monitoring::Route.where(verb: splitted.first.downcase, path: splitted.last).first
72
+ end
65
73
  end
66
74
  end
67
75
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arkaan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.17
4
+ version: 0.7.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Courtois