sand 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sand/middleware.rb +3 -5
- data/lib/sand/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5a9e7385667a8ea61ee1cf926d8efffc8592895
|
4
|
+
data.tar.gz: c0d622bad1f642e2bf6c03e8a0b61bc0e8f9b29b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24d2c4ed4eaef6e09ab3c5b50e85f83b6b6d265832a79d3d8618ec01cd8aa9fda320867c075fe62cef64645fde8c97ba9ad87a5912989ce9ab89c836d8da20d8
|
7
|
+
data.tar.gz: 0967885c0dbdb324236638c09ea3f3d466b3ae6d63f141893133b28989513b57462959c2b45cb6f47ee9a9d385ebc01a4d169c176ebd361c5b3547993bb6889d
|
data/lib/sand/middleware.rb
CHANGED
@@ -9,31 +9,29 @@ module Sand
|
|
9
9
|
end
|
10
10
|
|
11
11
|
class Middleware
|
12
|
-
attr_reader :app, :
|
12
|
+
attr_reader :app, :options, :response
|
13
13
|
|
14
14
|
DEFAULT_OPTIONS = {
|
15
15
|
pass: []
|
16
16
|
}.freeze
|
17
17
|
|
18
18
|
def initialize(app, options = {})
|
19
|
-
@env = nil
|
20
19
|
@app = app
|
21
20
|
@options = DEFAULT_OPTIONS.merge(options)
|
22
21
|
end
|
23
22
|
|
24
|
-
def passed?
|
23
|
+
def passed?(env)
|
25
24
|
return true if options[:pass].any? { |r| r =~ env['PATH_INFO'] }
|
26
25
|
return true if env['sand.pass'] == true || env['sand.scoped'] || env['sand.authorized'] == true # rubocop:disable Metrics/LineLength
|
27
26
|
false
|
28
27
|
end
|
29
28
|
|
30
29
|
def call(env)
|
31
|
-
@env = env
|
32
30
|
env['sand'] = RequestMethods.new(env)
|
33
31
|
|
34
32
|
result = app.call(env)
|
35
33
|
|
36
|
-
return result if passed?
|
34
|
+
return result if passed?(env)
|
37
35
|
raise Sand::AuthorizationNotPerformed
|
38
36
|
end
|
39
37
|
end
|
data/lib/sand/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sand
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Tomlin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|