proxes 0.3.6 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/proxes/container.rb +8 -2
- data/lib/proxes/helpers/authentication.rb +2 -1
- data/lib/proxes/listener.rb +5 -1
- data/lib/proxes/proxes.rb +10 -0
- data/lib/proxes/security.rb +2 -2
- data/lib/proxes/seed.rb +2 -4
- data/lib/proxes/version.rb +1 -1
- data/migrate/{20170207_01_base_tables.rb → 20170207_base_tables.rb} +0 -0
- data/migrate/{20170207_02_audit_log.rb → 20170208_audit_log.rb} +0 -0
- data/proxes.gemspec +2 -2
- data/views/audit_logs/index.haml +2 -0
- data/views/identity/register.haml +0 -3
- data/views/partials/form_control.haml +1 -2
- data/views/partials/pager.haml +12 -19
- data/views/permissions/index.haml +2 -0
- data/views/roles/index.haml +2 -0
- data/views/users/index.haml +3 -1
- metadata +12 -13
- data/Gemfile.dev.lock +0 -164
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 701cef47d840b7a98b029c49b0669549df8d24fe
|
4
|
+
data.tar.gz: beefb8e479b990c177976245a03d2f401d10861a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d95b0bf8b05afe16014fdeb90c88c8860462d5c240f0e5f0c0483f869403430e81e8724b9d6fa031dd5777cb466a0992dbbd93192fb45f5b799968cf3ee219e9
|
7
|
+
data.tar.gz: aa3fffe5fe4deb819ecaa8e2f13562da5e881dca04e4c2e0ea449c239d1d16d27fc1e2b6b06dc6e05a8f28ec5bdd8f8474fcad11c20be981fcc83d1d8102764d
|
data/.gitignore
CHANGED
data/lib/proxes/container.rb
CHANGED
@@ -96,13 +96,19 @@ module ProxES
|
|
96
96
|
def navigation
|
97
97
|
Plugins.plugins.map do |_key, plugin|
|
98
98
|
plugin.nav_items if plugin.respond_to?(:nav_items)
|
99
|
-
end.flatten.sort_by { |h| h[:order] }
|
99
|
+
end.compact.flatten.sort_by { |h| h[:order] }
|
100
100
|
end
|
101
101
|
|
102
102
|
def migrations
|
103
103
|
Plugins.plugins.map do |_key, plugin|
|
104
104
|
plugin.migration_folder if plugin.respond_to?(:migration_folder)
|
105
|
-
end
|
105
|
+
end.compact
|
106
|
+
end
|
107
|
+
|
108
|
+
def seeders
|
109
|
+
Plugins.plugins.map do |_key, plugin|
|
110
|
+
plugin.seeder if plugin.respond_to?(:seeder)
|
111
|
+
end.compact
|
106
112
|
end
|
107
113
|
end
|
108
114
|
|
@@ -4,7 +4,8 @@ module ProxES
|
|
4
4
|
module Authentication
|
5
5
|
def current_user
|
6
6
|
return nil unless env['rack.session'] && env['rack.session']['user_id']
|
7
|
-
@
|
7
|
+
@users ||= Hash.new {|h,k| h[k] = User[k]}
|
8
|
+
@users[env['rack.session']['user_id']]
|
8
9
|
end
|
9
10
|
|
10
11
|
def current_user=(user)
|
data/lib/proxes/listener.rb
CHANGED
@@ -2,11 +2,15 @@ require 'wisper'
|
|
2
2
|
|
3
3
|
module ProxES
|
4
4
|
class Listener
|
5
|
+
def initialize
|
6
|
+
@mutex = Mutex.new
|
7
|
+
end
|
8
|
+
|
5
9
|
def method_missing(method, *args, &block)
|
6
10
|
vals = { action: method }
|
7
11
|
vals[:user] = args[0][:user] if (args[0] && args[0].has_key?(:user))
|
8
12
|
vals[:details] = args[0][:details] if (args[0] && args[0].has_key?(:details))
|
9
|
-
AuditLog.create vals
|
13
|
+
@mutex.synchronize { AuditLog.create vals }
|
10
14
|
end
|
11
15
|
|
12
16
|
def respond_to_missing?(method, include_private = false)
|
data/lib/proxes/proxes.rb
CHANGED
@@ -29,6 +29,16 @@ module ProxES
|
|
29
29
|
{ order: 2, link:'/permissions/', text: 'Permissions', target: Permission, icon: 'check-square' },
|
30
30
|
]
|
31
31
|
end
|
32
|
+
|
33
|
+
def self.seeder
|
34
|
+
Proc.new do
|
35
|
+
::ProxES::Role.find_or_create(name: 'user')
|
36
|
+
sa = ::ProxES::Role.find_or_create(name: 'super_admin')
|
37
|
+
%w(GET POST PUT DELETE HEAD OPTIONS INDEX).each do |verb|
|
38
|
+
::ProxES::Permission.find_or_create(role: sa, verb: verb, pattern: '.*')
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
32
42
|
end
|
33
43
|
end
|
34
44
|
|
data/lib/proxes/security.rb
CHANGED
@@ -38,9 +38,9 @@ module ProxES
|
|
38
38
|
begin
|
39
39
|
check_basic
|
40
40
|
authorize request
|
41
|
-
rescue StandardError
|
41
|
+
rescue StandardError
|
42
42
|
log_action(:es_request_denied, details: "#{request.request_method.upcase} #{request.fullpath} (#{request.class.name})")
|
43
|
-
logger.debug "Access denied by security layer: #{
|
43
|
+
logger.debug "Access denied for #{current_user ? current_user.email : 'Anonymous User'} by security layer: #{request.request_method.upcase} #{request.fullpath} (#{request.class.name})"
|
44
44
|
return error 'Forbidden', 403
|
45
45
|
end
|
46
46
|
request.index = policy_scope(request) if request.indices?
|
data/lib/proxes/seed.rb
CHANGED
@@ -2,8 +2,6 @@ require 'proxes/db'
|
|
2
2
|
require 'proxes/models/role'
|
3
3
|
require 'proxes/models/permission'
|
4
4
|
|
5
|
-
ProxES::
|
6
|
-
|
7
|
-
%w(GET POST PUT DELETE HEAD OPTIONS INDEX).each do |verb|
|
8
|
-
ProxES::Permission.find_or_create(role: sa, verb: verb, pattern: '.*')
|
5
|
+
::ProxES::Container.seeders.each do |seeder|
|
6
|
+
seeder.call
|
9
7
|
end
|
data/lib/proxes/version.rb
CHANGED
File without changes
|
File without changes
|
data/proxes.gemspec
CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_dependency 'activesupport'
|
31
31
|
spec.add_dependency 'rake', '~> 10.0'
|
32
32
|
spec.add_dependency 'rack-contrib'
|
33
|
-
spec.add_dependency 'sinatra'
|
33
|
+
spec.add_dependency 'sinatra', '~> 1.0'
|
34
34
|
spec.add_dependency 'sinatra-flash'
|
35
35
|
spec.add_dependency 'sinatra-contrib'
|
36
36
|
spec.add_dependency 'elasticsearch'
|
@@ -40,7 +40,7 @@ Gem::Specification.new do |spec|
|
|
40
40
|
spec.add_dependency 'bcrypt'
|
41
41
|
spec.add_dependency 'omniauth'
|
42
42
|
spec.add_dependency 'omniauth-identity'
|
43
|
-
spec.add_dependency 'haml'
|
43
|
+
spec.add_dependency 'haml', '~> 4.0'
|
44
44
|
spec.add_dependency 'wisper'
|
45
45
|
spec.add_dependency 'tilt', '>= 2'
|
46
46
|
end
|
data/views/audit_logs/index.haml
CHANGED
@@ -13,8 +13,7 @@
|
|
13
13
|
- options.each do |k,v| k ||= v; v ||= k;
|
14
14
|
%option{ value: k, selected: (k.to_s == model[field].to_s)}= v
|
15
15
|
- elsif type == 'textarea'
|
16
|
-
%textarea{attributes}
|
17
|
-
= model[field]
|
16
|
+
%textarea{attributes}= preserve(model[field])
|
18
17
|
- else
|
19
18
|
%input{attributes, type: type, value: model[field]}
|
20
19
|
- if model.errors[field]
|
data/views/partials/pager.haml
CHANGED
@@ -1,19 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Showing
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
<a href="<%= next_link %>">Next</a>
|
14
|
-
</li>
|
15
|
-
<li>
|
16
|
-
<a href="<%= base_path %>?page=<%= list.page_count %>&count=<%= list.page_size %>">Last</a>
|
17
|
-
</li>
|
18
|
-
</ul>
|
19
|
-
</nav>
|
1
|
+
%nav{"aria-label" => "Page navigation"}
|
2
|
+
%p.text-center
|
3
|
+
Showing #{list.current_page_record_range} of #{list.pagination_record_count} records
|
4
|
+
%ul.pager
|
5
|
+
%li
|
6
|
+
%a{href: "#{base_path}?page=1&count=#{list.page_size}"} First
|
7
|
+
%li{class: ("disabled" if list.first_page?)}
|
8
|
+
%a{href: prev_link} Previous
|
9
|
+
%li{class: ("disabled" if list.last_page?)}
|
10
|
+
%a{href: next_link} Next
|
11
|
+
%li
|
12
|
+
%a{href: "#{base_path}?page=#{list.page_count}&count=#{list.page_size}"} Last
|
data/views/roles/index.haml
CHANGED
data/views/users/index.haml
CHANGED
@@ -17,4 +17,6 @@
|
|
17
17
|
%td= entity.surname
|
18
18
|
%td= entity.roles_dataset.map(:name).map(&:titlecase).join(', ')
|
19
19
|
.panel-body.text-right
|
20
|
-
%a.btn.btn-primary{ href: '/_proxes/users/new' } New User
|
20
|
+
%a.btn.btn-primary{ href: '/_proxes/users/new' } New User
|
21
|
+
|
22
|
+
=pagination(list, base_path)
|
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.
|
4
|
+
version: 0.4.0
|
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: 2017-
|
11
|
+
date: 2017-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -140,16 +140,16 @@ dependencies:
|
|
140
140
|
name: sinatra
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - "
|
143
|
+
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
145
|
+
version: '1.0'
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- - "
|
150
|
+
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
152
|
+
version: '1.0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: sinatra-flash
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -280,16 +280,16 @@ dependencies:
|
|
280
280
|
name: haml
|
281
281
|
requirement: !ruby/object:Gem::Requirement
|
282
282
|
requirements:
|
283
|
-
- - "
|
283
|
+
- - "~>"
|
284
284
|
- !ruby/object:Gem::Version
|
285
|
-
version: '0'
|
285
|
+
version: '4.0'
|
286
286
|
type: :runtime
|
287
287
|
prerelease: false
|
288
288
|
version_requirements: !ruby/object:Gem::Requirement
|
289
289
|
requirements:
|
290
|
-
- - "
|
290
|
+
- - "~>"
|
291
291
|
- !ruby/object:Gem::Version
|
292
|
-
version: '0'
|
292
|
+
version: '4.0'
|
293
293
|
- !ruby/object:Gem::Dependency
|
294
294
|
name: wisper
|
295
295
|
requirement: !ruby/object:Gem::Requirement
|
@@ -336,7 +336,6 @@ files:
|
|
336
336
|
- Gemfile
|
337
337
|
- Gemfile.ci
|
338
338
|
- Gemfile.dev
|
339
|
-
- Gemfile.dev.lock
|
340
339
|
- LICENSE.txt
|
341
340
|
- README.md
|
342
341
|
- Rakefile
|
@@ -396,8 +395,8 @@ files:
|
|
396
395
|
- lib/proxes/seed.rb
|
397
396
|
- lib/proxes/services/logger.rb
|
398
397
|
- lib/proxes/version.rb
|
399
|
-
- migrate/
|
400
|
-
- migrate/
|
398
|
+
- migrate/20170207_base_tables.rb
|
399
|
+
- migrate/20170208_audit_log.rb
|
401
400
|
- migrate/20170416_audit_log_details.rb
|
402
401
|
- migrate/20170416_user_specific_permissions.rb
|
403
402
|
- package.json
|
data/Gemfile.dev.lock
DELETED
@@ -1,164 +0,0 @@
|
|
1
|
-
GIT
|
2
|
-
remote: https://github.com/alexch/rerun.git
|
3
|
-
revision: 3e4c486304be406cb86180ef70ec24e9ae055ce4
|
4
|
-
branch: master
|
5
|
-
specs:
|
6
|
-
rerun (0.11.0)
|
7
|
-
listen (~> 3.0)
|
8
|
-
|
9
|
-
PATH
|
10
|
-
remote: .
|
11
|
-
specs:
|
12
|
-
proxes (0.3.5)
|
13
|
-
activesupport
|
14
|
-
bcrypt
|
15
|
-
elasticsearch
|
16
|
-
haml
|
17
|
-
logger
|
18
|
-
omniauth
|
19
|
-
omniauth-identity
|
20
|
-
pundit
|
21
|
-
rack-contrib
|
22
|
-
rake (~> 10.0)
|
23
|
-
sequel
|
24
|
-
sinatra
|
25
|
-
sinatra-contrib
|
26
|
-
sinatra-flash
|
27
|
-
tilt (>= 2)
|
28
|
-
wisper
|
29
|
-
|
30
|
-
GEM
|
31
|
-
remote: https://rubygems.org/
|
32
|
-
specs:
|
33
|
-
activesupport (5.0.1)
|
34
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
35
|
-
i18n (~> 0.7)
|
36
|
-
minitest (~> 5.1)
|
37
|
-
tzinfo (~> 1.1)
|
38
|
-
backports (3.7.0)
|
39
|
-
bcrypt (3.1.11)
|
40
|
-
bcrypt-ruby (3.1.5)
|
41
|
-
bcrypt (>= 3.1.3)
|
42
|
-
byebug (9.0.6)
|
43
|
-
coderay (1.1.1)
|
44
|
-
concurrent-ruby (1.0.4)
|
45
|
-
database_cleaner (1.5.3)
|
46
|
-
diff-lcs (1.2.5)
|
47
|
-
docile (1.1.5)
|
48
|
-
elasticsearch (5.0.4)
|
49
|
-
elasticsearch-api (= 5.0.4)
|
50
|
-
elasticsearch-transport (= 5.0.4)
|
51
|
-
elasticsearch-api (5.0.4)
|
52
|
-
multi_json
|
53
|
-
elasticsearch-transport (5.0.4)
|
54
|
-
faraday
|
55
|
-
multi_json
|
56
|
-
factory_girl (4.8.0)
|
57
|
-
activesupport (>= 3.0.0)
|
58
|
-
faraday (0.12.0.1)
|
59
|
-
multipart-post (>= 1.2, < 3)
|
60
|
-
ffi (1.9.14)
|
61
|
-
git-version-bump (0.15.1)
|
62
|
-
haml (4.0.7)
|
63
|
-
tilt
|
64
|
-
hashie (3.5.5)
|
65
|
-
i18n (0.7.0)
|
66
|
-
json (2.0.2)
|
67
|
-
listen (3.1.5)
|
68
|
-
rb-fsevent (~> 0.9, >= 0.9.4)
|
69
|
-
rb-inotify (~> 0.9, >= 0.9.7)
|
70
|
-
ruby_dep (~> 1.2)
|
71
|
-
logger (1.2.8)
|
72
|
-
method_source (0.8.2)
|
73
|
-
minitest (5.10.1)
|
74
|
-
multi_json (1.12.1)
|
75
|
-
multipart-post (2.0.0)
|
76
|
-
omniauth (1.6.1)
|
77
|
-
hashie (>= 3.4.6, < 3.6.0)
|
78
|
-
rack (>= 1.6.2, < 3)
|
79
|
-
omniauth-identity (1.1.1)
|
80
|
-
bcrypt-ruby (~> 3.0)
|
81
|
-
omniauth (~> 1.0)
|
82
|
-
pry (0.10.4)
|
83
|
-
coderay (~> 1.1.0)
|
84
|
-
method_source (~> 0.8.1)
|
85
|
-
slop (~> 3.4)
|
86
|
-
pry-byebug (3.4.2)
|
87
|
-
byebug (~> 9.0)
|
88
|
-
pry (~> 0.10)
|
89
|
-
pundit (1.1.0)
|
90
|
-
activesupport (>= 3.0.0)
|
91
|
-
rack (1.6.5)
|
92
|
-
rack-contrib (1.4.0)
|
93
|
-
git-version-bump (~> 0.15)
|
94
|
-
rack (~> 1.4)
|
95
|
-
rack-protection (1.5.3)
|
96
|
-
rack
|
97
|
-
rack-test (0.6.3)
|
98
|
-
rack (>= 1.0)
|
99
|
-
racksh (1.0.0)
|
100
|
-
rack (>= 1.0)
|
101
|
-
rack-test (>= 0.5)
|
102
|
-
rake (10.5.0)
|
103
|
-
rb-fsevent (0.9.8)
|
104
|
-
rb-inotify (0.9.7)
|
105
|
-
ffi (>= 0.5.0)
|
106
|
-
rspec (3.5.0)
|
107
|
-
rspec-core (~> 3.5.0)
|
108
|
-
rspec-expectations (~> 3.5.0)
|
109
|
-
rspec-mocks (~> 3.5.0)
|
110
|
-
rspec-core (3.5.4)
|
111
|
-
rspec-support (~> 3.5.0)
|
112
|
-
rspec-expectations (3.5.0)
|
113
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
114
|
-
rspec-support (~> 3.5.0)
|
115
|
-
rspec-mocks (3.5.0)
|
116
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
117
|
-
rspec-support (~> 3.5.0)
|
118
|
-
rspec-support (3.5.0)
|
119
|
-
ruby_dep (1.5.0)
|
120
|
-
sequel (4.45.0)
|
121
|
-
simplecov (0.12.0)
|
122
|
-
docile (~> 1.1.0)
|
123
|
-
json (>= 1.8, < 3)
|
124
|
-
simplecov-html (~> 0.10.0)
|
125
|
-
simplecov-html (0.10.0)
|
126
|
-
sinatra (1.4.8)
|
127
|
-
rack (~> 1.5)
|
128
|
-
rack-protection (~> 1.4)
|
129
|
-
tilt (>= 1.3, < 3)
|
130
|
-
sinatra-contrib (1.4.7)
|
131
|
-
backports (>= 2.0)
|
132
|
-
multi_json
|
133
|
-
rack-protection
|
134
|
-
rack-test
|
135
|
-
sinatra (~> 1.4.0)
|
136
|
-
tilt (>= 1.3, < 3)
|
137
|
-
sinatra-flash (0.3.0)
|
138
|
-
sinatra (>= 1.0.0)
|
139
|
-
slop (3.6.0)
|
140
|
-
sqlite3 (1.3.12)
|
141
|
-
thread_safe (0.3.5)
|
142
|
-
tilt (2.0.7)
|
143
|
-
tzinfo (1.2.2)
|
144
|
-
thread_safe (~> 0.1)
|
145
|
-
wisper (2.0.0)
|
146
|
-
|
147
|
-
PLATFORMS
|
148
|
-
ruby
|
149
|
-
|
150
|
-
DEPENDENCIES
|
151
|
-
bundler (~> 1.12)
|
152
|
-
database_cleaner
|
153
|
-
factory_girl
|
154
|
-
proxes!
|
155
|
-
pry-byebug
|
156
|
-
rack-test
|
157
|
-
racksh
|
158
|
-
rerun!
|
159
|
-
rspec (~> 3.0)
|
160
|
-
simplecov
|
161
|
-
sqlite3
|
162
|
-
|
163
|
-
BUNDLED WITH
|
164
|
-
1.14.6
|