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 +4 -4
- data/lib/arkaan/utils/controller.rb +9 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 905077c1bbe8679549f8949e8f90f2132a3e217d
|
4
|
+
data.tar.gz: 31cd85935a4dee853d2b5f176d551e8d63503f0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|