proxes 0.9.9 → 0.9.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ditty/components/proxes.rb +1 -3
- data/lib/proxes/helpers/indices.rb +6 -4
- data/lib/proxes/policies/request_policy.rb +1 -0
- data/lib/proxes/request.rb +2 -2
- data/lib/proxes/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: daa368238a056af49baf95e92dc664489f80b44e0146508e4006d8b454f79e37
|
4
|
+
data.tar.gz: 4cc6c9716a2101d1b7bba50bce22392772bb80124f6e959d525faaf1f2a43d56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5384c2901a06e83e904f2444f30b2b410b67f6e09e69271390b2298ee29b7762e294cee00a11ed466b869a32c66f0f48f229df3823496ca9520cdfa1682d9241
|
7
|
+
data.tar.gz: cd8c9489ae8593f5e9cab925a00e27f07da849d0eb2b3f16002e9a0b836ce9c0ec0263dc8c260d5205ca95b7dd27c6bdd4e8bb867185c74000ae6478c436a680
|
@@ -64,10 +64,8 @@ module Ditty
|
|
64
64
|
::ProxES::Permission.find_or_create(role: user_role, verb: 'INDEX', pattern: 'user-{user.id}')
|
65
65
|
|
66
66
|
# Kibana Specific
|
67
|
-
anon = ::Ditty::User.find_or_create(email: 'anonymous@proxes.io')
|
68
|
-
anon.remove_role user_role
|
69
67
|
anon_role = ::Ditty::Role.find_or_create(name: 'anonymous')
|
70
|
-
|
68
|
+
::Ditty::User.create_anonymous_user('anonymous@proxes.io')
|
71
69
|
::ProxES::Permission.find_or_create(role: anon_role, verb: 'GET', pattern: '/.kibana/config/*')
|
72
70
|
::ProxES::Permission.find_or_create(role: anon_role, verb: 'INDEX', pattern: '.kibana')
|
73
71
|
|
@@ -17,16 +17,18 @@ module ProxES
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def patterns
|
20
|
-
|
20
|
+
current_user = user || Ditty::User.anonymous_user
|
21
|
+
return [] if current_user.nil?
|
21
22
|
patterns_for('INDEX').map do |permission|
|
22
23
|
return nil if permission.pattern.blank?
|
23
|
-
permission.pattern.gsub(/\{user.(.*)\}/) { |_match|
|
24
|
+
permission.pattern.gsub(/\{user.(.*)\}/) { |_match| current_user.send(Regexp.last_match[1].to_sym) }
|
24
25
|
end.compact
|
25
26
|
end
|
26
27
|
|
27
28
|
def patterns_for(action)
|
28
|
-
|
29
|
-
|
29
|
+
current_user = user || Ditty::User.anonymous_user
|
30
|
+
return [] if current_user.nil?
|
31
|
+
Permission.for_user(current_user, action)
|
30
32
|
end
|
31
33
|
end
|
32
34
|
end
|
@@ -21,6 +21,7 @@ module ProxES
|
|
21
21
|
def method_missing(method_sym, *arguments, &block)
|
22
22
|
return super if method_sym.to_s[-1] != '?'
|
23
23
|
|
24
|
+
return true if user && user.super_admin?
|
24
25
|
return false if request.indices? && !index_allowed?
|
25
26
|
action_allowed? method_sym[0..-2].upcase
|
26
27
|
end
|
data/lib/proxes/request.rb
CHANGED
@@ -34,8 +34,8 @@ module ProxES
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def user_id
|
37
|
-
return env['
|
38
|
-
env['
|
37
|
+
return env['rack.session']['user_id'] if env['rack.session']
|
38
|
+
env['omniauth.auth'].uid if env['omniauth.auth']
|
39
39
|
end
|
40
40
|
|
41
41
|
def user
|
data/lib/proxes/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: proxes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jurgens du Toit
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|