arkaan 0.7.18 → 0.7.19
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/lib/arkaan/utils/controller.rb +14 -7
- 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: 7600e95ffa796c17564879976e258e2be2d93120
|
4
|
+
data.tar.gz: a0703ac0822608b541fc8afc5adc394677de44f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c19ada966e37f2d2028135e36fe7387f8f9c606c8250bb3428cb64a0fcdb6505d0c7593cf0536f812c39d762fd93ee81c08a3b1146c988d6eb2f543e5a92f7bc
|
7
|
+
data.tar.gz: 9df8559123c96edd543cb253269643f26f7810306b93f089e4cb3d44d0251f29764e185fc128f1efeaaa562fd8e4c9ccd62dd85a994b250910acd3606e55d768
|
@@ -9,15 +9,12 @@ module Arkaan
|
|
9
9
|
check_presence('token', 'app_key')
|
10
10
|
|
11
11
|
gateway = Arkaan::Monitoring::Gateway.where(token: params['token']).first
|
12
|
-
application = Arkaan::OAuth::Application.where(key: params['app_key']).first
|
13
|
-
|
14
|
-
|
12
|
+
@application = Arkaan::OAuth::Application.where(key: params['app_key']).first
|
13
|
+
|
15
14
|
if gateway.nil?
|
16
15
|
halt 404, {message: 'gateway_not_found'}.to_json
|
17
|
-
elsif application.nil?
|
16
|
+
elsif @application.nil?
|
18
17
|
halt 404, {message: 'application_not_found'}.to_json
|
19
|
-
elsif route && route.premium? && !application.premium?
|
20
|
-
halt 401, {message: 'application_not_authorized'}.to_json
|
21
18
|
end
|
22
19
|
end
|
23
20
|
|
@@ -44,7 +41,17 @@ module Arkaan
|
|
44
41
|
unless service.nil? || !service.routes.where(path: path, verb: verb).first.nil?
|
45
42
|
Arkaan::Monitoring::Route.create(path: path, verb: verb, premium: premium, service: service)
|
46
43
|
end
|
47
|
-
|
44
|
+
if premium
|
45
|
+
self.public_send(verb, path) do
|
46
|
+
@sinatra_route = parse_current_route
|
47
|
+
if !@application.premium?
|
48
|
+
halt 401, {message: 'application_not_authorized'}.to_json
|
49
|
+
end
|
50
|
+
instance_eval(&block)
|
51
|
+
end
|
52
|
+
else
|
53
|
+
self.public_send(verb, path, &block)
|
54
|
+
end
|
48
55
|
end
|
49
56
|
|
50
57
|
# Checks the presence of several fields given as parameters and halts the execution if it's not present.
|