sample_core_api 0.0.9.pre.3 → 0.0.9.pre.6
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/decoractors/authenticate.rb +17 -8
- data/lib/decoractors/valid.rb +11 -8
- data/lib/ioc/injector.rb +3 -0
- 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: be0b35369c52fa332ea1cee2167292c18dbf739b7cd2506f88145a76c98bbd8a
|
4
|
+
data.tar.gz: 80be2877ffb5bfc945ad4a567dbf073e779f7270dcb18b5f9bb233cf5152a833
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be8a79f314256dbe3cc300be2aac06989542091b0b126bba492b2e9deaff16412b48b4b7c5645f5aa3661f7f5722bc9787801ec24e336642c818d467a8029064
|
7
|
+
data.tar.gz: 2649841e10b42997018ed12684490a7742f9c70f36f134b0d4b168c1951ef753b56f29893b939e3aae4786b6a7c03d916f59c9ef73a1ad590007bb77582ae942
|
@@ -1,19 +1,28 @@
|
|
1
|
-
require_relative '../
|
1
|
+
require_relative '../rest/rest_service'
|
2
2
|
require_relative '../security/security_context_holder'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
injector
|
7
|
-
|
4
|
+
module Authenticator
|
8
5
|
def has_roles roles
|
9
|
-
lambda {|
|
10
|
-
|
6
|
+
lambda {|*args, &blk|
|
7
|
+
puts 'has_roles'
|
8
|
+
check_role = true # check role here and return true/false
|
9
|
+
if check_role
|
10
|
+
true
|
11
|
+
else
|
12
|
+
false
|
13
|
+
end
|
11
14
|
}
|
12
15
|
end
|
13
16
|
|
14
17
|
def authenticate isAuthorized
|
15
|
-
lambda {
|
18
|
+
lambda {|*args, &blk|
|
16
19
|
puts "isAuthorized"
|
20
|
+
# check authentication and authorization here, then return true/false
|
21
|
+
if isAuthorized.call(*args, &blk)
|
22
|
+
true
|
23
|
+
else
|
24
|
+
raise CommonError::PermissionDenied
|
25
|
+
end
|
17
26
|
}
|
18
27
|
end
|
19
28
|
end
|
data/lib/decoractors/valid.rb
CHANGED
@@ -1,12 +1,15 @@
|
|
1
|
-
require_relative '../
|
1
|
+
require_relative '../rest/rest_service'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
3
|
+
module Validator
|
4
|
+
def validate params={}
|
5
|
+
lambda {|*args, &blk|
|
6
|
+
puts "Validate"
|
7
|
+
check_validate = true # check validation and return true/false
|
8
|
+
if validate
|
9
|
+
true
|
10
|
+
else
|
11
|
+
raise CommonError::InvalidData
|
12
|
+
end
|
10
13
|
}
|
11
14
|
end
|
12
15
|
end
|
data/lib/ioc/injector.rb
CHANGED