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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f06c68171f233ccce5d7cb06ab76f6503254ae8159c8906a53170af8e6e4b78
4
- data.tar.gz: c4022844adcbf0d5740fe3b78f841a2be8c0db6b6d182a9d383f79ceb6d28299
3
+ metadata.gz: daa368238a056af49baf95e92dc664489f80b44e0146508e4006d8b454f79e37
4
+ data.tar.gz: 4cc6c9716a2101d1b7bba50bce22392772bb80124f6e959d525faaf1f2a43d56
5
5
  SHA512:
6
- metadata.gz: 9b7d4ad313c188b7dd2e9db490870828bf6b6c2590c15349ccc58d167bc29c6f1e455e3706a6202cb78d072a1b105308c0c9004cb239d06cefb4fe0ae951e7cf
7
- data.tar.gz: 3ed39b26565420d629984d4e932bce2b239369554b84d0daf2744cca469a65ec634ee17f514790b11d8a5a4d7833d23b15e55519051fdec046371d9b0e49524d
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
- anon.add_role anon_role unless anon.role?('anonymous')
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
- return [] if user.nil?
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| user.send(Regexp.last_match[1].to_sym) }
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
- return [] if user.nil?
29
- Permission.for_user(user, action)
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
@@ -34,8 +34,8 @@ module ProxES
34
34
  end
35
35
 
36
36
  def user_id
37
- return env['omniauth.auth'].uid if env['omniauth.auth']
38
- env['rack.session']['user_id'] if env['rack.session']
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ProxES
4
- VERSION = '0.9.9'.freeze
4
+ VERSION = '0.9.12'.freeze
5
5
  end
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.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-02 00:00:00.000000000 Z
11
+ date: 2018-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler