proxes 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/proxes-install +6 -0
- data/lib/proxes.rb +1 -1
- data/lib/proxes/controllers/users.rb +1 -2
- data/lib/proxes/helpers/component.rb +10 -5
- data/lib/proxes/helpers/indices.rb +2 -2
- data/lib/proxes/models/user.rb +1 -0
- data/lib/proxes/policies/request/cat_policy.rb +16 -0
- data/lib/proxes/policies/request_policy.rb +2 -1
- data/lib/proxes/proxes.rb +2 -1
- data/lib/proxes/rake_tasks.rb +139 -2
- data/lib/proxes/request/cat.rb +32 -0
- data/lib/proxes/request/search.rb +0 -1
- data/lib/proxes/version.rb +1 -1
- data/proxes.gemspec +2 -0
- data/views/identity/login.haml +1 -1
- data/views/identity/register.haml +1 -1
- data/views/layout.haml +2 -5
- data/views/permissions/display.haml +2 -2
- data/views/permissions/edit.haml +1 -1
- data/views/permissions/index.haml +13 -4
- data/views/permissions/new.haml +1 -1
- data/views/roles/display.haml +13 -8
- data/views/roles/edit.haml +1 -1
- data/views/roles/index.haml +4 -3
- data/views/roles/new.haml +1 -1
- data/views/users/display.haml +39 -3
- data/views/users/edit.haml +1 -1
- data/views/users/index.haml +4 -3
- data/views/users/new.haml +1 -1
- data/views/users/profile.haml +6 -5
- metadata +33 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20d593cfefd6a398b5dcbc2d25708c06631353ca
|
4
|
+
data.tar.gz: c76a06e2c8e63ad15d6b8870ab48a302b89126a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5216a08a4b1fa8424c000e06b911d4607b8e6f9ca79ae664d819e3f494c4fecab032794e804bea4e40f4d6c300d7290656d276d00b31b7801b7c50fd85d5471f
|
7
|
+
data.tar.gz: 88d5fa844230f66b0b021895c7e110f5c8ec5293e5855493e94aaa34a02d4f19319ce2fca6b2db5a75951cb1bc1a1441d80f5d7f36ce5a254a222b8306ec9403
|
data/bin/proxes-install
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
sudo apt-get install -y wget git libpq-dev python-psycopg2 ca-certificates
|
3
|
+
wget https://gitlab.com/snippets/1663435/raw -O Gemfile
|
4
|
+
wget https://gitlab.com/snippets/1663436/raw -O Rakefile
|
5
|
+
wget https://gitlab.com/snippets/1663438/raw -O config.ru
|
6
|
+
bundle install
|
data/lib/proxes.rb
CHANGED
@@ -123,7 +123,7 @@ module ProxES
|
|
123
123
|
if identity.valid? && identity.save
|
124
124
|
log_action("#{dehumanized}_update_password".to_sym) if settings.track_actions
|
125
125
|
flash[:success] = 'Password Updated'
|
126
|
-
redirect
|
126
|
+
redirect back
|
127
127
|
else
|
128
128
|
haml :"#{view_location}/profile", locals: { entity: entity, identity: identity, title: heading }
|
129
129
|
end
|
@@ -156,7 +156,6 @@ module ProxES
|
|
156
156
|
# Profile
|
157
157
|
get '/profile' do
|
158
158
|
entity = current_user
|
159
|
-
halt 404 unless entity
|
160
159
|
authorize entity, :read
|
161
160
|
|
162
161
|
haml :"#{view_location}/profile", locals: { entity: entity, identity: entity.identity.first, title: 'My Account' }
|
@@ -6,6 +6,8 @@ require 'active_support/inflector'
|
|
6
6
|
module ProxES
|
7
7
|
module Helpers
|
8
8
|
module Component
|
9
|
+
include ActiveSupport::Inflector
|
10
|
+
|
9
11
|
def dataset
|
10
12
|
policy_scope(settings.model_class)
|
11
13
|
end
|
@@ -19,10 +21,10 @@ module ProxES
|
|
19
21
|
|
20
22
|
def heading(action = nil)
|
21
23
|
@headings ||= begin
|
22
|
-
heading =
|
24
|
+
heading = titleize(demodulize(settings.model_class))
|
23
25
|
h = Hash.new(heading)
|
24
26
|
h[:new] = "New #{heading}"
|
25
|
-
h[:list] =
|
27
|
+
h[:list] = pluralize heading
|
26
28
|
h[:edit] = "Edit #{heading}"
|
27
29
|
h
|
28
30
|
end
|
@@ -30,15 +32,18 @@ module ProxES
|
|
30
32
|
end
|
31
33
|
|
32
34
|
def dehumanized
|
33
|
-
settings.dehumanized ||
|
35
|
+
settings.dehumanized || underscore(heading)
|
34
36
|
end
|
35
37
|
|
36
38
|
def base_path
|
37
|
-
settings.base_path || "/_proxes/#{
|
39
|
+
settings.base_path || "/_proxes/#{dasherize(view_location)}"
|
38
40
|
end
|
39
41
|
|
40
42
|
def view_location
|
41
|
-
settings.
|
43
|
+
p settings.model_class
|
44
|
+
p 'asd'
|
45
|
+
p settings.view_location
|
46
|
+
settings.view_location || underscore(pluralize(demodulize(settings.model_class)))
|
42
47
|
end
|
43
48
|
end
|
44
49
|
end
|
@@ -4,13 +4,13 @@ module ProxES
|
|
4
4
|
module Helpers
|
5
5
|
module Indices
|
6
6
|
def filter(asked, against)
|
7
|
-
return against.map { |a| a.gsub(/\.\*/, '*') } if asked == ['*'] || asked == []
|
7
|
+
return against.map { |a| a.gsub(/\.\*/, '*') } if asked == ['*'] || asked == [] || asked.nil?
|
8
8
|
|
9
9
|
answer = []
|
10
10
|
against.each do |pattern|
|
11
11
|
answer.concat(asked.select { |idx| idx =~ /#{pattern}/ })
|
12
12
|
end
|
13
|
-
answer
|
13
|
+
answer.count > 0 ? answer : against
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
data/lib/proxes/models/user.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ProxES
|
4
|
+
class Request
|
5
|
+
class CatPolicy < RequestPolicy
|
6
|
+
class Scope < RequestPolicy::Scope
|
7
|
+
def resolve
|
8
|
+
patterns = Permission.for_user(user, 'INDEX').map do |permission|
|
9
|
+
permission.pattern.gsub(/\{user.(.*)\}/) { |_match| user.send(Regexp.last_match[1].to_sym) }
|
10
|
+
end
|
11
|
+
filter scope.index, patterns
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -28,7 +28,7 @@ module ProxES
|
|
28
28
|
patterns = Permission.for_user(user, 'INDEX').map do |permission|
|
29
29
|
permission.pattern.gsub(/\{user.(.*)\}/) { |_match| user.send(Regexp.last_match[1].to_sym) }
|
30
30
|
end
|
31
|
-
filter(record.index, patterns).count
|
31
|
+
filter(record.index, patterns).count > 0
|
32
32
|
end
|
33
33
|
|
34
34
|
def action_allowed?(action)
|
@@ -64,6 +64,7 @@ module ProxES
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
+
require 'proxes/policies/request/cat_policy'
|
67
68
|
require 'proxes/policies/request/root_policy'
|
68
69
|
require 'proxes/policies/request/stats_policy'
|
69
70
|
require 'proxes/policies/request/search_policy'
|
data/lib/proxes/proxes.rb
CHANGED
@@ -26,7 +26,8 @@ module ProxES
|
|
26
26
|
[
|
27
27
|
{ order: 0, link: '/users/', text: 'Users', target: User, icon: 'user' },
|
28
28
|
{ order: 1, link: '/roles/', text: 'Roles', target: Role, icon: 'group' },
|
29
|
-
{ order: 2, link: '/permissions/', text: 'Permissions', target: Permission, icon: 'check-square' }
|
29
|
+
{ order: 2, link: '/permissions/', text: 'Permissions', target: Permission, icon: 'check-square' },
|
30
|
+
{ order: 3, link: '/audit-logs/', text: 'Audit Logs', target: AuditLog, icon: 'history' },
|
30
31
|
]
|
31
32
|
end
|
32
33
|
|
data/lib/proxes/rake_tasks.rb
CHANGED
@@ -2,15 +2,146 @@
|
|
2
2
|
|
3
3
|
require 'rake'
|
4
4
|
require 'rake/tasklib'
|
5
|
+
require 'highline'
|
6
|
+
require 'yaml'
|
5
7
|
|
6
8
|
module ProxES
|
7
9
|
class Tasks < ::Rake::TaskLib
|
8
10
|
include ::Rake::DSL if defined?(::Rake::DSL)
|
9
11
|
|
12
|
+
CONFIG_PATH = File.expand_path('./config/config.yml')
|
13
|
+
|
14
|
+
POSTGRES_PACKAGES = [
|
15
|
+
'postgresql-common',
|
16
|
+
'postgresql-9.5',
|
17
|
+
'postgresql-client-9.5',
|
18
|
+
'postgresql-contrib-9.5',
|
19
|
+
'postgresql-9.5-plv8',
|
20
|
+
]
|
21
|
+
|
22
|
+
|
10
23
|
def install_tasks
|
11
24
|
namespace :proxes do
|
25
|
+
task :config do
|
26
|
+
cli = HighLine.new
|
27
|
+
|
28
|
+
config = File.file?(CONFIG_PATH) ? YAML.load_file(CONFIG_PATH) : {}
|
29
|
+
config['install_folder'] = cli.ask('To which folder should we install', String) do |q|
|
30
|
+
q.default = config['install_folder'] || File.expand_path('~/proxes')
|
31
|
+
end.to_s
|
32
|
+
|
33
|
+
config['proxes_hostname'] = cli.ask('ProxES Hostname?', String).to_s
|
34
|
+
|
35
|
+
# Port Config
|
36
|
+
config['web_port'] = cli.ask('HTTP Port? [80]', Integer) {|q| q.default = config['web_port'] || 80}.to_i
|
37
|
+
config['https_port'] = cli.ask('SSL Port? [443]', Integer) {|q| q.default = config['https_port'] || 443}.to_i
|
38
|
+
|
39
|
+
# Certificate
|
40
|
+
config['ssl_key_path'] = cli.ask('Path to SSL key', String) {|q| q.default = config['ssl_key_path']}.to_s
|
41
|
+
config['ssl_cert_path'] = cli.ask('Path to SSL certificate', String) {|q| q.default = config['ssl_cert_path']}.to_s
|
42
|
+
|
43
|
+
config['redis_url'] = cli.ask('Redis URL', String) do |q|
|
44
|
+
q.default = config['redis_url'] || 'redis://localhost:6379'
|
45
|
+
end.to_s
|
46
|
+
config['elasticsearch_url'] = cli.ask('ElasticSearch URL', String) do |q|
|
47
|
+
q.default = config['elasticsearch_url'] || 'http://localhost:9200'
|
48
|
+
end.to_s
|
49
|
+
|
50
|
+
# Database Setup
|
51
|
+
config['db_name'] = cli.ask('Database Name', String) {|q| q.default = 'proxes'}.to_s
|
52
|
+
config['db_username'] = cli.ask('Database Username', String) {|q| q.default = 'proxes'}.to_s
|
53
|
+
config['db_password'] = cli.ask('Database Password', String).to_s
|
54
|
+
config['database_url'] = cli.ask('Database URL', String) do |q|
|
55
|
+
q.default = config['database_url'] || "postgres://#{config['db_username']}:#{config['db_password']}@localhost:5432/#{config['db_name']}"
|
56
|
+
end.to_s
|
57
|
+
|
58
|
+
File.open(CONFIG_PATH, 'w') {|f| f.write config.to_yaml }
|
59
|
+
end
|
60
|
+
|
61
|
+
task :setup_redhat do
|
62
|
+
cli = HighLine.new
|
63
|
+
config = YAML.load_file(CONFIG_PATH)
|
64
|
+
# Redis
|
65
|
+
if cli.ask('Install Redis Server? (y/n)') {|q| q.in = ['y', 'n']; q.default = ENV['REDIS_URL'].nil? ? 'y' : 'n' } == 'y'
|
66
|
+
system 'sudo yum install epel-release'
|
67
|
+
system 'sudo yum update'
|
68
|
+
system 'sudo yum install -y redis'
|
69
|
+
system 'sudo systemctl start redis'
|
70
|
+
system 'sudo systemctl enable redis'
|
71
|
+
end
|
72
|
+
|
73
|
+
# Postgres
|
74
|
+
if cli.ask('Install PostgreSQL Server? (y/n)') {|q| q.in = ['y', 'n']; q.default = ENV['REDIS_URL'].nil? ? 'y' : 'n'} == 'y'
|
75
|
+
system 'sudo yum install -y postgresql-server postgresql-contrib'
|
76
|
+
end
|
77
|
+
|
78
|
+
if cli.ask('Setup the PostgreSQL User & DB? (y/n)') {|q| q.in = ['y', 'n']; q.default = 'y'} == 'y'
|
79
|
+
system "sudo -u postgres createuser #{config['db_username']}"
|
80
|
+
system "sudo -u postgres createdb -O #{config['db_username']} #{config['db_name']}"
|
81
|
+
system "sudo -u postgres psql -c \"alter user #{config['db_username']} with encrypted password '#{config['db_password']}';\""
|
82
|
+
system "sudo -u postgres psql -c \"grant all privileges on database #{config['db_name']} to #{config['db_username']};\""
|
83
|
+
end
|
84
|
+
|
85
|
+
# Certs
|
86
|
+
if cli.ask('Get a cert through Lets Encrypt? (y/n)') {|q| q.in = ['y', 'n']; q.default = 'y'} == 'y'
|
87
|
+
system 'sudo yum install epel-release'
|
88
|
+
system 'sudo apt-get update'
|
89
|
+
system 'sudo apt-get install -y certbot'
|
90
|
+
system "sudo certbot -n certonly --standalone -d #{config['proxes_hostname']}"
|
91
|
+
config['ssl_key_path'] = "/etc/letsencrypt/live/#{config['proxes_hostname']}/privkey.pem"
|
92
|
+
config['ssl_cert_path'] = "/etc/letsencrypt/live/#{config['proxes_hostname']}/fullchain.pem"
|
93
|
+
end
|
94
|
+
|
95
|
+
# TODO: Write the .env file
|
96
|
+
|
97
|
+
File.open(CONFIG_PATH, 'w') {|f| f.write config.to_yaml }
|
98
|
+
end
|
99
|
+
|
100
|
+
task :setup_debian do
|
101
|
+
cli = HighLine.new
|
102
|
+
config = YAML.load_file(CONFIG_PATH)
|
103
|
+
|
104
|
+
# Redis
|
105
|
+
if cli.ask('Install Redis Server? (y/n)') {|q| q.in = ['y', 'n']; q.default = ENV['REDIS_URL'].nil? ? 'y' : 'n' } == 'y'
|
106
|
+
system 'sudo apt-get install -y redis-server'
|
107
|
+
end
|
108
|
+
|
109
|
+
# Postgres
|
110
|
+
if cli.ask('Install PostgreSQL Server? (y/n)') {|q| q.in = ['y', 'n']; q.default = ENV['REDIS_URL'].nil? ? 'y' : 'n'} == 'y'
|
111
|
+
system 'sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ACCC4CF8'
|
112
|
+
unless File.file? '/etc/apt/sources.list.d/pgdg.list'
|
113
|
+
system 'sudo sh -c \'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list\''
|
114
|
+
end
|
115
|
+
system 'sudo apt-get update'
|
116
|
+
system 'sudo apt-get install -y ' + POSTGRES_PACKAGES.join(' ')
|
117
|
+
end
|
118
|
+
|
119
|
+
if cli.ask('Setup the PostgreSQL User & DB? (y/n)') {|q| q.in = ['y', 'n']; q.default = 'y'} == 'y'
|
120
|
+
system "sudo -u postgres createuser #{config['db_username']}"
|
121
|
+
system "sudo -u postgres createdb -O #{config['db_username']} #{config['db_name']}"
|
122
|
+
system "sudo -u postgres psql -c \"alter user #{config['db_username']} with encrypted password '#{config['db_password']}';\""
|
123
|
+
system "sudo -u postgres psql -c \"grant all privileges on database #{config['db_name']} to #{config['db_username']};\""
|
124
|
+
end
|
125
|
+
|
126
|
+
# Certs
|
127
|
+
if cli.ask('Get a cert through Lets Encrypt? (y/n)') {|q| q.in = ['y', 'n']; q.default = 'y'} == 'y'
|
128
|
+
system 'sudo add-apt-repository ppa:certbot/certbot'
|
129
|
+
system 'sudo apt-get update'
|
130
|
+
system 'sudo apt-get install -y certbot'
|
131
|
+
system "sudo certbot -n certonly --standalone -d #{config['proxes_hostname']}"
|
132
|
+
config['ssl_key_path'] = "/etc/letsencrypt/live/#{config['proxes_hostname']}/privkey.pem"
|
133
|
+
config['ssl_cert_path'] = "/etc/letsencrypt/live/#{config['proxes_hostname']}/fullchain.pem"
|
134
|
+
end
|
135
|
+
|
136
|
+
# TODO: Write the .env file
|
137
|
+
|
138
|
+
File.open(CONFIG_PATH, 'w') {|f| f.write config.to_yaml }
|
139
|
+
end
|
140
|
+
|
141
|
+
|
12
142
|
desc 'Generate the needed tokens'
|
13
143
|
task :generate_tokens do
|
144
|
+
puts 'Generating the ProxES tokens'
|
14
145
|
require 'securerandom'
|
15
146
|
File.write('.session_secret', SecureRandom.random_bytes(40))
|
16
147
|
File.write('.token_secret', SecureRandom.random_bytes(40))
|
@@ -18,11 +149,13 @@ module ProxES
|
|
18
149
|
|
19
150
|
desc 'Seed the ProxES database'
|
20
151
|
task :seed do
|
152
|
+
puts 'Seeding the ProxES database'
|
21
153
|
require 'proxes/seed'
|
22
154
|
end
|
23
155
|
|
24
156
|
desc 'Prepare ProxES migrations'
|
25
157
|
task :prep do
|
158
|
+
puts 'Preparing the ProxES migrations folder'
|
26
159
|
Dir.mkdir 'migrations' unless File.exist?('migrations')
|
27
160
|
::ProxES::Container.migrations.each do |path|
|
28
161
|
FileUtils.cp_r "#{path}/.", 'migrations'
|
@@ -31,31 +164,35 @@ module ProxES
|
|
31
164
|
|
32
165
|
desc 'Migrate ProxES database to latest version'
|
33
166
|
task :migrate do
|
167
|
+
puts 'Running the ProxES migrations'
|
34
168
|
Rake::Task['proxes:migrate:up'].invoke
|
35
169
|
end
|
36
170
|
|
37
171
|
namespace :migrate do
|
38
|
-
require_relative './db'
|
39
|
-
Sequel.extension :migration
|
172
|
+
require_relative './db' if ENV['DATABASE_URL']
|
40
173
|
folder = 'migrations'
|
41
174
|
|
42
175
|
desc 'Check if the migration is current'
|
43
176
|
task :check do
|
177
|
+
Sequel.extension :migration
|
44
178
|
Sequel::Migrator.check_current(DB, folder)
|
45
179
|
end
|
46
180
|
|
47
181
|
desc 'Migrate ProxES database to latest version'
|
48
182
|
task :up do
|
183
|
+
Sequel.extension :migration
|
49
184
|
Sequel::Migrator.apply(DB, folder)
|
50
185
|
end
|
51
186
|
|
52
187
|
desc 'Roll back the ProxES database'
|
53
188
|
task :down do
|
189
|
+
Sequel.extension :migration
|
54
190
|
Sequel::Migrator.apply(DB, folder, 0)
|
55
191
|
end
|
56
192
|
|
57
193
|
desc 'Reset the ProxES database'
|
58
194
|
task :bounce do
|
195
|
+
Sequel.extension :migration
|
59
196
|
Sequel::Migrator.apply(DB, folder, 0)
|
60
197
|
Sequel::Migrator.apply(DB, folder)
|
61
198
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rack'
|
4
|
+
require 'proxes/request'
|
5
|
+
|
6
|
+
module ProxES
|
7
|
+
class Request
|
8
|
+
class Cat < Request
|
9
|
+
attr_reader :index, :type, :id
|
10
|
+
|
11
|
+
def index=(idx)
|
12
|
+
@index = idx
|
13
|
+
self.path_info = '/' + [endpoint, type, index]
|
14
|
+
.map { |v| v.is_a?(Array) ? v.join(',') : v }
|
15
|
+
.select { |v| !v.nil? && v != '' }.join('/')
|
16
|
+
end
|
17
|
+
|
18
|
+
def endpoint
|
19
|
+
'_cat'
|
20
|
+
end
|
21
|
+
|
22
|
+
def parse
|
23
|
+
@type ||= check_part(path_parts[1])
|
24
|
+
@index ||= check_part(path_parts[2])
|
25
|
+
end
|
26
|
+
|
27
|
+
def indices?
|
28
|
+
true
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/proxes/version.rb
CHANGED
data/proxes.gemspec
CHANGED
@@ -26,6 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_development_dependency 'rack-test'
|
27
27
|
spec.add_development_dependency 'database_cleaner'
|
28
28
|
spec.add_development_dependency 'factory_girl'
|
29
|
+
spec.add_development_dependency 'timecop'
|
29
30
|
|
30
31
|
spec.add_dependency 'activesupport'
|
31
32
|
spec.add_dependency 'rake', '~> 10.0'
|
@@ -42,5 +43,6 @@ Gem::Specification.new do |spec|
|
|
42
43
|
spec.add_dependency 'omniauth-identity'
|
43
44
|
spec.add_dependency 'haml', '~> 4.0'
|
44
45
|
spec.add_dependency 'wisper'
|
46
|
+
spec.add_dependency 'highline'
|
45
47
|
spec.add_dependency 'tilt', '>= 2'
|
46
48
|
end
|
data/views/identity/login.haml
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
.col-md-8
|
4
4
|
.panel.panel-default
|
5
5
|
.panel-heading
|
6
|
-
ProxES Registration
|
6
|
+
%h4 ProxES Registration
|
7
7
|
.panel-body
|
8
8
|
%form.form-horizontal{ method: 'post', action: '/_proxes/auth/identity/new' }
|
9
9
|
= form_control(:username, identity, label: 'Email', placeholder: 'Your email address')
|
data/views/layout.haml
CHANGED
@@ -26,13 +26,10 @@
|
|
26
26
|
#wrapper
|
27
27
|
= haml :'partials/navbar', locals: { title: (defined?(title) ? title : 'ProxES') }
|
28
28
|
#page-wrapper
|
29
|
-
- if cluster_health.nil?
|
30
|
-
%table.table
|
31
|
-
%tbody
|
32
|
-
%tr.danger
|
33
|
-
%td.text-center Cannot Connect to Cluster
|
34
29
|
.row
|
35
30
|
.col-md-12
|
31
|
+
- if cluster_health.nil?
|
32
|
+
.alert.alert-danger.text-center Cannot Connect to Cluster
|
36
33
|
-if defined? title
|
37
34
|
%h1.page-header= title
|
38
35
|
= haml :'partials/notifications'
|
@@ -18,10 +18,10 @@
|
|
18
18
|
|
19
19
|
.row
|
20
20
|
.col-md-6
|
21
|
-
%a.btn.btn-default{ href: "
|
21
|
+
%a.btn.btn-default{ href: "#{base_path}/#{entity.id}/edit" } Edit
|
22
22
|
.col-md-6.text-right
|
23
23
|
- if policy(entity).delete?
|
24
|
-
%form{ method: 'post', action: "
|
24
|
+
%form{ method: 'post', action: "#{base_path}/#{entity.id}" }
|
25
25
|
%input{ name: '_method', value: 'DELETE', type: 'hidden' }
|
26
26
|
%button.btn.btn-warning{ type: 'submit' } Delete
|
27
27
|
.col-md-2
|
data/views/permissions/edit.haml
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
.col-md-8
|
4
4
|
.panel.panel-default
|
5
5
|
.panel-body
|
6
|
-
%form.form-horizontal{ method: 'post', action: "
|
6
|
+
%form.form-horizontal{ method: 'post', action: "#{base_path}/#{entity.id}" }
|
7
7
|
%input{ name: '_method', value: 'PUT', type: 'hidden' }
|
8
8
|
= haml :'permissions/form', locals: { entity: entity }
|
9
9
|
%button.btn.btn-primary{ type: 'submit' }
|
@@ -1,16 +1,25 @@
|
|
1
1
|
.row
|
2
2
|
.col-md-12
|
3
3
|
.panel.panel-default
|
4
|
-
.panel-heading VERB Pattern
|
5
4
|
%table.table.table-striped
|
5
|
+
%thead
|
6
|
+
%tr
|
7
|
+
%th Role
|
8
|
+
%th User
|
9
|
+
%th Permission
|
6
10
|
%tbody
|
7
11
|
-list.each do |entity|
|
8
12
|
%tr
|
9
13
|
%td
|
10
|
-
|
14
|
+
= entity.role ? entity.role.name : 'None'
|
15
|
+
%td
|
16
|
+
= entity.user ? entity.user.username : 'None'
|
17
|
+
%td
|
18
|
+
%a.btn-block{ href: "#{base_path}/#{entity.id}" }
|
11
19
|
= entity.verb
|
12
20
|
= entity.pattern
|
13
|
-
|
14
|
-
|
21
|
+
- if policy(::ProxES::Permission).create?
|
22
|
+
.panel-body.text-right
|
23
|
+
%a.btn.btn-primary{ href: "#{base_path}/new" } New Permission
|
15
24
|
|
16
25
|
=pagination(list, base_path)
|
data/views/permissions/new.haml
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
.col-md-8
|
4
4
|
.panel.panel-default
|
5
5
|
.panel-body
|
6
|
-
%form.form-horizontal{ method: 'post', action:
|
6
|
+
%form.form-horizontal{ method: 'post', action: base_path }
|
7
7
|
= haml :'permissions/form', locals: { entity: entity }
|
8
8
|
%button.btn.btn-primary.btn{ type: 'submit' }
|
9
9
|
Create Permission
|
data/views/roles/display.haml
CHANGED
@@ -9,10 +9,10 @@
|
|
9
9
|
|
10
10
|
.row
|
11
11
|
.col-md-6
|
12
|
-
%a.btn.btn-default{ href: "
|
12
|
+
%a.btn.btn-default{ href: "#{base_path}/#{entity.id}/edit" } Edit
|
13
13
|
.col-md-6.text-right
|
14
14
|
- if policy(entity).delete?
|
15
|
-
%form{ method: 'post', action: "
|
15
|
+
%form{ method: 'post', action: "#{base_path}/#{entity.id}" }
|
16
16
|
%input{ name: '_method', value: 'DELETE', type: 'hidden' }
|
17
17
|
%button.btn.btn-warning{ type: 'submit' } Delete
|
18
18
|
.col-md-2
|
@@ -22,12 +22,17 @@
|
|
22
22
|
.col-md-8
|
23
23
|
.panel.panel-default
|
24
24
|
.panel-heading
|
25
|
-
%
|
25
|
+
%h4 Permissions
|
26
26
|
%table.table
|
27
|
-
- entity.permissions.
|
27
|
+
- if entity.permissions.count > 0
|
28
|
+
- entity.permissions.each do |permission|
|
29
|
+
%tr
|
30
|
+
%td
|
31
|
+
%a.btn-block{ href: "/_proxes/permissions/#{entity.id}" }
|
32
|
+
= permission.verb
|
33
|
+
= permission.pattern
|
34
|
+
- else
|
28
35
|
%tr
|
29
|
-
%td
|
30
|
-
|
31
|
-
= permission.verb
|
32
|
-
= permission.pattern
|
36
|
+
%td{ colspan: 2 } No Permissions
|
37
|
+
|
33
38
|
.col-md-2
|
data/views/roles/edit.haml
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
.col-md-8
|
4
4
|
.panel.panel-default
|
5
5
|
.panel-body
|
6
|
-
%form.form-horizontal{ method: 'post', action: "
|
6
|
+
%form.form-horizontal{ method: 'post', action: "#{base_path}/#{entity.id}" }
|
7
7
|
%input{ name: '_method', value: 'PUT', type: 'hidden' }
|
8
8
|
= haml :'roles/form', locals: { entity: entity }
|
9
9
|
%button.btn.btn-primary{ type: 'submit' }
|
data/views/roles/index.haml
CHANGED
@@ -10,10 +10,11 @@
|
|
10
10
|
-list.each do |entity|
|
11
11
|
%tr
|
12
12
|
%td
|
13
|
-
%a{ href: "
|
13
|
+
%a{ href: "#{base_path}/#{entity.id}" }= entity.name
|
14
14
|
%td
|
15
15
|
= entity.permissions_dataset.count
|
16
|
-
|
17
|
-
|
16
|
+
- if policy(::ProxES::Role).create?
|
17
|
+
.panel-body.text-right
|
18
|
+
%a.btn.btn-primary{ href: "#{base_path}/new" } New Role
|
18
19
|
|
19
20
|
=pagination(list, base_path)
|
data/views/roles/new.haml
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
.col-md-8
|
4
4
|
.panel.panel-default
|
5
5
|
.panel-body
|
6
|
-
%form.form-horizontal{ method: 'post', action:
|
6
|
+
%form.form-horizontal{ method: 'post', action: base_path }
|
7
7
|
= haml :'roles/form', locals: { entity: entity }
|
8
8
|
%button.btn.btn-primary.btn{ type: 'submit' }
|
9
9
|
Create Role
|
data/views/users/display.haml
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
.panel-body
|
6
6
|
.author
|
7
7
|
%img.pull-right.thumbnail{ src: entity.gravatar }
|
8
|
-
%h4
|
8
|
+
%h4= entity.email
|
9
9
|
|
10
10
|
%hr
|
11
11
|
%p.description
|
@@ -23,10 +23,46 @@
|
|
23
23
|
|
24
24
|
.row
|
25
25
|
.col-md-6
|
26
|
-
%a.btn.btn-default{ href: "
|
26
|
+
%a.btn.btn-default{ href: "#{base_path}/#{entity.id}/edit" } Edit
|
27
27
|
.col-md-6.text-right
|
28
28
|
- if policy(entity).delete?
|
29
|
-
%form{ method: 'post', action: "
|
29
|
+
%form{ method: 'post', action: "#{base_path}/#{entity.id}" }
|
30
30
|
%input{ name: '_method', value: 'DELETE', type: 'hidden' }
|
31
31
|
%button.btn.btn-warning{ type: 'submit' } Delete
|
32
32
|
.col-md-2
|
33
|
+
|
34
|
+
.row
|
35
|
+
.col-md-2
|
36
|
+
.col-md-8
|
37
|
+
.panel.panel-default
|
38
|
+
.panel-heading
|
39
|
+
%h4 Permissions
|
40
|
+
%table.table
|
41
|
+
- if entity.permissions.count > 0
|
42
|
+
- entity.permissions.each do |permission|
|
43
|
+
%tr
|
44
|
+
%td
|
45
|
+
%a.btn-block{ href: "/_proxes/permissions/#{entity.id}" }
|
46
|
+
= permission.verb
|
47
|
+
= permission.pattern
|
48
|
+
- else
|
49
|
+
%tr
|
50
|
+
%td{ colspan: 2 } No Permissions
|
51
|
+
.col-md-2
|
52
|
+
|
53
|
+
.row
|
54
|
+
.col-md-2
|
55
|
+
.col-md-8
|
56
|
+
.panel.panel-default
|
57
|
+
.panel-heading
|
58
|
+
%h4 Change Password
|
59
|
+
.panel-body
|
60
|
+
%form.form-horizontal{ method: 'post', action: "#{base_path}/#{entity.id}/identity" }
|
61
|
+
%input{ name: '_method', value: 'PUT', type: 'hidden' }
|
62
|
+
= form_control(:password, entity.identity.first, type: 'password', placeholder: 'Your password')
|
63
|
+
= form_control(:password_confirmation, entity.identity.first, type: 'password', label: 'Confirm Password', placeholder: 'Confirm your password')
|
64
|
+
%button.btn.btn-primary{ type: 'submit' }
|
65
|
+
Change Password
|
66
|
+
.col-md-2
|
67
|
+
|
68
|
+
|
data/views/users/edit.haml
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
.col-md-8
|
4
4
|
.panel.panel-default
|
5
5
|
.panel-body
|
6
|
-
%form.form-horizontal{ method: 'post', action: "
|
6
|
+
%form.form-horizontal{ method: 'post', action: "#{base_path}/#{entity.id}" }
|
7
7
|
%input{ name: '_method', value: 'PUT', type: 'hidden' }
|
8
8
|
= haml :'users/user', locals: { user: entity }
|
9
9
|
%button.btn.btn-primary{ type: 'submit' }
|
data/views/users/index.haml
CHANGED
@@ -12,11 +12,12 @@
|
|
12
12
|
-list.each do |entity|
|
13
13
|
%tr
|
14
14
|
%td
|
15
|
-
%a{ href: "
|
15
|
+
%a{ href: "#{base_path}/#{entity.id}" }= entity.email
|
16
16
|
%td= entity.name
|
17
17
|
%td= entity.surname
|
18
18
|
%td= entity.roles_dataset.map(:name).map(&:titlecase).join(', ')
|
19
|
-
|
20
|
-
|
19
|
+
- if policy(::ProxES::User).create?
|
20
|
+
.panel-body.text-right
|
21
|
+
%a.btn.btn-primary{ href: "#{base_path}/new" } New User
|
21
22
|
|
22
23
|
=pagination(list, base_path)
|
data/views/users/new.haml
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
.col-md-8
|
4
4
|
.panel.panel-default
|
5
5
|
.panel-body
|
6
|
-
%form.form-horizontal{ method: 'post', action:
|
6
|
+
%form.form-horizontal{ method: 'post', action: base_path }
|
7
7
|
= haml :'users/identity', locals: { identity: identity }
|
8
8
|
= haml :'users/user', locals: { user: entity }
|
9
9
|
%button.btn.btn-primary.btn{ type: 'submit' }
|
data/views/users/profile.haml
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
.panel-body
|
6
6
|
.author
|
7
7
|
%img.pull-right.thumbnail{ src: entity.gravatar }
|
8
|
-
%h4
|
8
|
+
%h4= entity.email
|
9
9
|
|
10
10
|
%hr
|
11
11
|
%p.description
|
@@ -20,18 +20,19 @@
|
|
20
20
|
%p.description
|
21
21
|
%label Signed up:
|
22
22
|
= entity.created_at.strftime('%Y-%m-%d %H:%M:%S')
|
23
|
+
.col-md-2
|
23
24
|
|
24
|
-
|
25
|
+
.row
|
26
|
+
.col-md-2
|
27
|
+
.col-md-8
|
25
28
|
.panel.panel-default
|
26
29
|
.panel-heading
|
27
30
|
%h4 Change Password
|
28
31
|
.panel-body
|
29
|
-
%form.form-horizontal{ method: 'post', action: "
|
32
|
+
%form.form-horizontal{ method: 'post', action: "#{base_path}/#{entity.id}/identity" }
|
30
33
|
%input{ name: '_method', value: 'PUT', type: 'hidden' }
|
31
34
|
= form_control(:password, identity, type: 'password', placeholder: 'Your password')
|
32
35
|
= form_control(:password_confirmation, identity, type: 'password', label: 'Confirm Password', placeholder: 'Confirm your password')
|
33
36
|
%button.btn.btn-primary{ type: 'submit' }
|
34
37
|
Change Password
|
35
38
|
.col-md-2
|
36
|
-
|
37
|
-
|
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.
|
4
|
+
version: 0.4.4
|
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-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: timecop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: activesupport
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -304,6 +318,20 @@ dependencies:
|
|
304
318
|
- - ">="
|
305
319
|
- !ruby/object:Gem::Version
|
306
320
|
version: '0'
|
321
|
+
- !ruby/object:Gem::Dependency
|
322
|
+
name: highline
|
323
|
+
requirement: !ruby/object:Gem::Requirement
|
324
|
+
requirements:
|
325
|
+
- - ">="
|
326
|
+
- !ruby/object:Gem::Version
|
327
|
+
version: '0'
|
328
|
+
type: :runtime
|
329
|
+
prerelease: false
|
330
|
+
version_requirements: !ruby/object:Gem::Requirement
|
331
|
+
requirements:
|
332
|
+
- - ">="
|
333
|
+
- !ruby/object:Gem::Version
|
334
|
+
version: '0'
|
307
335
|
- !ruby/object:Gem::Dependency
|
308
336
|
name: tilt
|
309
337
|
requirement: !ruby/object:Gem::Requirement
|
@@ -341,6 +369,7 @@ files:
|
|
341
369
|
- Rakefile
|
342
370
|
- Vagrantfile
|
343
371
|
- bin/console
|
372
|
+
- bin/proxes-install
|
344
373
|
- bin/setup
|
345
374
|
- config.ru
|
346
375
|
- config/logger.yml
|
@@ -376,6 +405,7 @@ files:
|
|
376
405
|
- lib/proxes/policies/audit_log_policy.rb
|
377
406
|
- lib/proxes/policies/identity_policy.rb
|
378
407
|
- lib/proxes/policies/permission_policy.rb
|
408
|
+
- lib/proxes/policies/request/cat_policy.rb
|
379
409
|
- lib/proxes/policies/request/root_policy.rb
|
380
410
|
- lib/proxes/policies/request/search_policy.rb
|
381
411
|
- lib/proxes/policies/request/snapshot_policy.rb
|
@@ -387,6 +417,7 @@ files:
|
|
387
417
|
- lib/proxes/proxes.rb
|
388
418
|
- lib/proxes/rake_tasks.rb
|
389
419
|
- lib/proxes/request.rb
|
420
|
+
- lib/proxes/request/cat.rb
|
390
421
|
- lib/proxes/request/root.rb
|
391
422
|
- lib/proxes/request/search.rb
|
392
423
|
- lib/proxes/request/snapshot.rb
|