sample_core_api 0.0.9.pre.6 → 0.0.9.pre.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/decoractors/authenticate.rb +1 -26
- data/lib/decoractors/valid.rb +3 -26
- data/lib/ioc/injector.rb +1 -1
- metadata +21 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6f83a2b2183ee268ef20ba591d8e1562385ff3407d65ec93a11cb5215be194e
|
4
|
+
data.tar.gz: 1ff5d0a5036b12408e319f8a8e9b961ead73f1deca1dabdf0076bfd0ab3a7534
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e678867ce46b92e5501732a8a6f932e4fc4f165725d03a3e2bc880819bddf8d6a612dd26d7021f78f2274f098920333a2658a027a5dfd0369730c733b448823d
|
7
|
+
data.tar.gz: 5c775832d079e6a52830fa61419b3eae4ea2e3ff6a094765a436df786103e8e38d89bf5f1ce3df4b3c3db169bdd967c76788b779f9fe78e8d7a6d90fff42d27a
|
@@ -15,7 +15,7 @@ module Authenticator
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def authenticate isAuthorized
|
18
|
-
lambda {
|
18
|
+
lambda {|self_model, *args, &blk|
|
19
19
|
puts "isAuthorized"
|
20
20
|
# check authentication and authorization here, then return true/false
|
21
21
|
if isAuthorized.call(*args, &blk)
|
@@ -26,28 +26,3 @@ module Authenticator
|
|
26
26
|
}
|
27
27
|
end
|
28
28
|
end
|
29
|
-
|
30
|
-
# class Authenticate < MethodDecorators::Decorator
|
31
|
-
# def initialize(authorize_function, arguments)
|
32
|
-
# @authorize_function = authorize_function
|
33
|
-
# @arguments = arguments
|
34
|
-
# end
|
35
|
-
|
36
|
-
# def call(wrapped, this, *args, &blk)
|
37
|
-
# puts "before authentication"
|
38
|
-
# puts "user #" + SecurityContextHolder.get_user()
|
39
|
-
# if self.send(@authorize_function, @arguments, *args, &blk)
|
40
|
-
# result = wrapped.call(*args, &blk)
|
41
|
-
# else
|
42
|
-
# raise CommonError::InvalidToken
|
43
|
-
# end
|
44
|
-
# puts "after authentication"
|
45
|
-
|
46
|
-
# result
|
47
|
-
# end
|
48
|
-
|
49
|
-
# def has_roles(roles, *args, &blk)
|
50
|
-
# # check roles here
|
51
|
-
# return true
|
52
|
-
# end
|
53
|
-
# end
|
data/lib/decoractors/valid.rb
CHANGED
@@ -2,10 +2,10 @@ require_relative '../rest/rest_service'
|
|
2
2
|
|
3
3
|
module Validator
|
4
4
|
def validate params={}
|
5
|
-
lambda {
|
5
|
+
lambda {|self_model, *args, &blk|
|
6
6
|
puts "Validate"
|
7
|
-
check_validate =
|
8
|
-
if
|
7
|
+
check_validate = self_model.check_validate(*args, &blk) # check validation and return true/false
|
8
|
+
if check_validate
|
9
9
|
true
|
10
10
|
else
|
11
11
|
raise CommonError::InvalidData
|
@@ -13,26 +13,3 @@ module Validator
|
|
13
13
|
}
|
14
14
|
end
|
15
15
|
end
|
16
|
-
|
17
|
-
# class Valid < MethodDecorators::Decorator
|
18
|
-
# def initialize(validate_function, arguments)
|
19
|
-
# @validate_function = validate_function
|
20
|
-
# @arguments = arguments
|
21
|
-
# end
|
22
|
-
|
23
|
-
# def call(wrapped, this, *args, &blk)
|
24
|
-
# puts "before validation"
|
25
|
-
# if self.send(@validate_function, @arguments, *args, &blk)
|
26
|
-
# result = wrapped.call(*args, &blk)
|
27
|
-
# else
|
28
|
-
# raise CommonError::InvalidData
|
29
|
-
# end
|
30
|
-
# puts "after validation"
|
31
|
-
# result
|
32
|
-
# end
|
33
|
-
|
34
|
-
# def validate(arguments, *args, &blk)
|
35
|
-
# # check validation here
|
36
|
-
# return true
|
37
|
-
# end
|
38
|
-
# end
|
data/lib/ioc/injector.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sample_core_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.9.pre.
|
4
|
+
version: 0.0.9.pre.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fusin Thang
|
@@ -130,6 +130,26 @@ dependencies:
|
|
130
130
|
- - ">="
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: 1.4.1
|
133
|
+
- !ruby/object:Gem::Dependency
|
134
|
+
name: dry-validation
|
135
|
+
requirement: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - "~>"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: 0.12.0
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: 0.12.0
|
143
|
+
type: :runtime
|
144
|
+
prerelease: false
|
145
|
+
version_requirements: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - "~>"
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: 0.12.0
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 0.12.0
|
133
153
|
- !ruby/object:Gem::Dependency
|
134
154
|
name: bundler
|
135
155
|
requirement: !ruby/object:Gem::Requirement
|