kaui 0.7.2 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +1 -2
- data/Gemfile.lock +59 -38
- data/README.md +12 -9
- data/Rakefile +9 -0
- data/{lib/generators/kaui/install/templates/app/assets/javascripts/kaui/all.js → app/assets/javascripts/application.js} +2 -5
- data/{lib/generators/kaui/install/templates/app/assets/stylesheets/kaui/all.css → app/assets/stylesheets/application.css} +0 -4
- data/app/assets/stylesheets/bootstrap_and_overrides.css +7 -0
- data/app/controllers/kaui/admin_allowed_users_controller.rb +48 -0
- data/app/controllers/kaui/admin_tenants_controller.rb +97 -0
- data/app/controllers/kaui/engine_controller.rb +28 -31
- data/app/controllers/kaui/engine_controller_util.rb +33 -0
- data/app/controllers/kaui/login_proxy_controller.rb +11 -0
- data/app/controllers/kaui/sessions_controller.rb +12 -0
- data/app/controllers/kaui/tenants_controller.rb +60 -0
- data/app/models/kaui/ability.rb +20 -3
- data/app/models/kaui/admin_tenant.rb +10 -0
- data/app/models/kaui/allowed_user.rb +8 -0
- data/app/models/kaui/allowed_user_tenant.rb +6 -0
- data/app/models/kaui/killbill_authenticatable.rb +5 -18
- data/app/models/kaui/tenant.rb +13 -0
- data/app/models/kaui/user.rb +14 -16
- data/app/views/kaui/admin_allowed_users/index.html.erb +23 -0
- data/app/views/kaui/admin_allowed_users/new.html.erb +22 -0
- data/app/views/kaui/admin_allowed_users/show.html.erb +53 -0
- data/app/views/kaui/admin_tenants/index.html.erb +25 -0
- data/app/views/kaui/admin_tenants/new.html.erb +32 -0
- data/app/views/kaui/admin_tenants/show.html.erb +68 -0
- data/app/views/kaui/invoices/show.html.erb +1 -1
- data/app/views/kaui/tenants/index.html.erb +17 -0
- data/config/initializers/killbill_authenticatable.rb +3 -5
- data/config/locales/en.bootstrap.yml +18 -0
- data/config/routes.rb +27 -1
- data/config/symmetric-encryption.yml +135 -0
- data/db/ddl.sql +33 -2
- data/db/migrate/20130812155313_devise_create_kaui_users.rb +1 -3
- data/db/migrate/20150109214021_create_kaui_tenants.rb +12 -0
- data/db/migrate/20150112232813_create_kaui_allowed_users.rb +19 -0
- data/kaui.gemspec +5 -3
- data/lib/kaui.rb +49 -1
- data/lib/kaui/version.rb +1 -1
- data/test/dummy/config/application.rb +3 -0
- data/test/dummy/config/database.yml +9 -0
- data/test/dummy/config/environments/development.rb +2 -2
- data/test/dummy/config/initializers/killbill_client.rb +2 -0
- data/test/dummy/config/symmetric-encryption.yml +135 -0
- data/test/dummy/db/migrate/{20130819152643_devise_create_kaui_users.kaui.rb → 20150116052157_devise_create_kaui_users.kaui.rb} +1 -3
- data/test/dummy/db/migrate/20150116052158_create_kaui_tenants.kaui.rb +13 -0
- data/test/dummy/db/migrate/20150116052159_create_kaui_allowed_users.kaui.rb +20 -0
- data/test/dummy/db/schema.rb +29 -3
- data/test/functional/kaui/admin_allowed_users_controller_test.rb +30 -0
- data/test/functional/kaui/admin_tenants_controller_test.rb +35 -0
- data/test/functional/kaui/functional_test_helper.rb +2 -50
- data/test/functional/kaui/functional_test_helper_nosetup.rb +53 -0
- data/test/functional/kaui/invoices_controller_test.rb +22 -0
- data/test/functional/kaui/tenants_controller_test.rb +60 -0
- data/test/integration/kaui/integration_test_helper.rb +2 -0
- data/test/integration/kaui/navigation_test.rb +1 -2
- data/test/killbill_test_helper.rb +46 -4
- data/test/test_helper.rb +1 -0
- data/test/unit/helpers/kaui/admin_allowed_users_helper_test.rb +6 -0
- data/test/unit/helpers/kaui/admin_tenants_helper_test.rb +6 -0
- data/test/unit/helpers/kaui/tenants_helper_test.rb +6 -0
- data/test/unit/kaui/allowed_user_test.rb +34 -0
- data/test/unit/kaui/tenant_test.rb +19 -0
- data/vendor/assets/javascripts/jquery.dataTables.min.js +155 -0
- metadata +86 -21
- data/app/assets/javascripts/kaui/analytics.js +0 -71
- data/app/assets/stylesheets/kaui/analytics.css +0 -30
- data/test/dummy/app/assets/javascripts/application.js +0 -21
- data/test/dummy/app/assets/stylesheets/application.css +0 -15
- data/test/dummy/app/views/layouts/application.html.erb +0 -48
- data/vendor/assets/javascripts/js/bootstrap-datepicker.cd46d38.js +0 -1211
- data/vendor/assets/javascripts/js/bootstrap.v2.2.1.min.js +0 -6
- data/vendor/assets/javascripts/js/jquery.dataTables.v1.9.3.min.js +0 -156
@@ -0,0 +1,19 @@
|
|
1
|
+
class CreateKauiAllowedUsers < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :kaui_allowed_users do |t|
|
4
|
+
t.string :kb_username
|
5
|
+
t.string :description
|
6
|
+
t.timestamps
|
7
|
+
end
|
8
|
+
|
9
|
+
add_index :kaui_allowed_users, [:kb_username], :unique => true
|
10
|
+
|
11
|
+
create_table :kaui_allowed_user_tenants do |t|
|
12
|
+
t.belongs_to :kaui_allowed_user, :index => true
|
13
|
+
t.belongs_to :kaui_tenant, :index => true
|
14
|
+
t.timestamps null: false
|
15
|
+
end
|
16
|
+
|
17
|
+
add_index :kaui_allowed_user_tenants, [:kaui_allowed_user_id, :kaui_tenant_id], :unique => true, :name => 'kaui_allowed_user_tenants_uniq'
|
18
|
+
end
|
19
|
+
end
|
data/kaui.gemspec
CHANGED
@@ -5,7 +5,7 @@ require 'kaui/version'
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = 'kaui'
|
7
7
|
s.version = Kaui::VERSION
|
8
|
-
s.summary = 'Killbill Admin UI
|
8
|
+
s.summary = 'Killbill Admin UI mountable engine'
|
9
9
|
s.description = 'Rails UI plugin for Killbill administration.'
|
10
10
|
|
11
11
|
s.required_ruby_version = '>= 1.8.7'
|
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
|
15
15
|
s.author = 'Killbill core team'
|
16
16
|
s.email = 'killbilling-users@googlegroups.com'
|
17
|
-
s.homepage = 'http://www.
|
17
|
+
s.homepage = 'http://www.killbill.io'
|
18
18
|
|
19
19
|
s.files = `git ls-files`.split("\n")
|
20
20
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
@@ -26,10 +26,12 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.add_dependency 'jquery-rails', '~> 3.0.4'
|
27
27
|
s.add_dependency 'money-rails', '~> 0.8.1'
|
28
28
|
s.add_dependency 'd3_rails', '~> 3.2.8'
|
29
|
-
s.add_dependency '
|
29
|
+
s.add_dependency 'twitter-bootstrap-rails', '~> 2.2.8'
|
30
|
+
s.add_dependency 'killbill-client', '~> 0.10.1'
|
30
31
|
s.add_dependency 'devise', '~> 3.0.2'
|
31
32
|
s.add_dependency 'cancan', '~> 1.6.10'
|
32
33
|
s.add_dependency 'carmen-rails', '~> 1.0.0'
|
34
|
+
s.add_dependency 'symmetric-encryption', '~> 3.6.0'
|
33
35
|
|
34
36
|
s.add_development_dependency 'fakeweb', '~> 1.3'
|
35
37
|
s.add_development_dependency 'rake', '>= 0.8.7'
|
data/lib/kaui.rb
CHANGED
@@ -4,21 +4,69 @@
|
|
4
4
|
require "kaui/engine"
|
5
5
|
|
6
6
|
module Kaui
|
7
|
+
|
8
|
+
mattr_accessor :home_path
|
7
9
|
mattr_accessor :account_home_path
|
8
10
|
mattr_accessor :bundle_home_path
|
9
11
|
mattr_accessor :invoice_home_path
|
12
|
+
mattr_accessor :tenant_home_path
|
13
|
+
mattr_accessor :select_tenant
|
14
|
+
mattr_accessor :new_user_session_path
|
15
|
+
mattr_accessor :destroy_user_session_path
|
16
|
+
|
10
17
|
mattr_accessor :bundle_key_display_string
|
11
18
|
mattr_accessor :creditcard_plugin_name
|
12
19
|
mattr_accessor :layout
|
13
20
|
|
21
|
+
self.home_path = lambda { Kaui::Engine.routes.url_helpers.home_path }
|
14
22
|
self.account_home_path = lambda {|account_id| Kaui::Engine.routes.url_helpers.account_path(account_id) }
|
15
23
|
self.bundle_home_path = lambda {|bundle_id| Kaui::Engine.routes.url_helpers.bundle_path(:id => bundle_id) }
|
16
24
|
self.invoice_home_path = lambda {|invoice_id| Kaui::Engine.routes.url_helpers.invoice_path(:id => invoice_id) }
|
25
|
+
self.tenant_home_path = lambda { Kaui::Engine.routes.url_helpers.tenants_path }
|
26
|
+
self.select_tenant = lambda { Kaui::Engine.routes.url_helpers.select_tenant_path }
|
27
|
+
self.new_user_session_path = lambda { Kaui::Engine.routes.url_helpers.new_user_session_path }
|
28
|
+
self.destroy_user_session_path = lambda { Kaui::Engine.routes.url_helpers.destroy_user_session_path }
|
29
|
+
|
17
30
|
self.bundle_key_display_string = lambda {|bundle_key| bundle_key }
|
18
31
|
self.creditcard_plugin_name = lambda { '__EXTERNAL_PAYMENT__' }
|
19
32
|
|
33
|
+
|
34
|
+
def self.is_user_assigned_valid_tenant?(user, session)
|
35
|
+
#
|
36
|
+
# If those are set in config initializer then we bypass the check
|
37
|
+
# For multi-tenant production deployment, those should not be set!
|
38
|
+
#
|
39
|
+
return true if KillBillClient.api_key.present? && KillBillClient.api_secret.present?
|
40
|
+
|
41
|
+
# Not tenant in the session, returns right away...
|
42
|
+
return false if session[:kb_tenant_id].nil?
|
43
|
+
|
44
|
+
# If there is a kb_tenant_id in the session then we check if the user is allowed to access it
|
45
|
+
au = Kaui::AllowedUser.find_by_kb_username(user.kb_username)
|
46
|
+
return false if au.nil?
|
47
|
+
|
48
|
+
return au.kaui_tenants.select { |t| t.kb_tenant_id == session[:kb_tenant_id] }.first
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.current_tenant_user_options(user, session)
|
52
|
+
kb_tenant_id = session[:kb_tenant_id]
|
53
|
+
user_tenant = Kaui::Tenant.find_by_kb_tenant_id(kb_tenant_id) if kb_tenant_id
|
54
|
+
result = {
|
55
|
+
:username => user.kb_username,
|
56
|
+
:password => user.password,
|
57
|
+
:session_id => user.kb_session_id,
|
58
|
+
}
|
59
|
+
if user_tenant
|
60
|
+
result[:api_key] = user_tenant.api_key
|
61
|
+
result[:api_secret] = user_tenant.api_secret
|
62
|
+
end
|
63
|
+
result
|
64
|
+
end
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
20
69
|
def self.config(&block)
|
21
|
-
# TODO
|
22
70
|
{
|
23
71
|
:layout => layout || 'kaui/layouts/kaui_application',
|
24
72
|
}
|
data/lib/kaui/version.rb
CHANGED
@@ -1,6 +1,15 @@
|
|
1
1
|
# Warning: The database defined as "test" will be erased and
|
2
2
|
# re-generated from your development database when you run "rake".
|
3
3
|
# Do not set this db to the same as development or production.
|
4
|
+
development:
|
5
|
+
adapter: mysql2
|
6
|
+
encoding: utf8
|
7
|
+
database: kaui
|
8
|
+
username: root
|
9
|
+
password: root
|
10
|
+
host: 127.0.0.1
|
11
|
+
port: 3306
|
12
|
+
|
4
13
|
test:
|
5
14
|
adapter: sqlite3
|
6
15
|
database: db/test.sqlite3
|
@@ -29,9 +29,9 @@ Dummy::Application.configure do
|
|
29
29
|
# with SQLite, MySQL, and PostgreSQL)
|
30
30
|
config.active_record.auto_explain_threshold_in_seconds = 0.5
|
31
31
|
|
32
|
-
# Do not compress assets
|
33
32
|
config.assets.compress = false
|
34
33
|
|
35
34
|
# Expands the lines which load the assets
|
36
|
-
config.assets.debug =
|
35
|
+
config.assets.debug = false
|
36
|
+
|
37
37
|
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
#
|
2
|
+
# Symmetric Encryption for Ruby
|
3
|
+
#
|
4
|
+
---
|
5
|
+
# For the development and test environments the test symmetric encryption keys
|
6
|
+
# can be placed directly in the source code.
|
7
|
+
# And therefore no RSA private key is required
|
8
|
+
development: &development_defaults
|
9
|
+
key: 1234567890ABCDEF1234567890ABCDEF
|
10
|
+
iv: 1234567890ABCDEF
|
11
|
+
cipher_name: aes-128-cbc
|
12
|
+
encoding: :base64strict
|
13
|
+
private_rsa_key: |
|
14
|
+
-----BEGIN RSA PRIVATE KEY-----
|
15
|
+
MIIEpAIBAAKCAQEAxfbNAn6fc+poM/5mZwpDqO/fD064jcb5HNnCMm0AgXE75nU4
|
16
|
+
J2zrD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TSbA3+44y
|
31
|
+
2Fys8/gQusYQ3YwomxU4ygL5lyxxY14sQ3UAzkECgYEAhjRJ8YyYicmdogZvajTI
|
32
|
+
oju/ekebnbr6ao4/o1f3I59C07ym4FAAN3tRn+5U7YuNgsE2YbdoEOVm5FRT7uWr
|
33
|
+
ws9LbIKJp1cxC59VmjACwW5Wt9dCbpObKEUUjkTJ4NbJHwdctqiOk97vhL0NL9ed
|
34
|
+
nMHK75n9oikI3sU9FIzOnukCgYEAz9FpgZ1K6EQ3om9S9crfyMEIICUBoiKQKb5z
|
35
|
+
sND+Y+Y//nnnGcFkhF7EezmcZ8eiqtYyPl3OqtC7U+LxrgPtWJ4azSwxyiL6lLb4
|
36
|
+
Zb/nykIf60Xe09QUre3zkCzKzuw44XF5gkvuW6tFC6H4+RZu4H8FDHHFp3gxXPEp
|
37
|
+
O43Xn8ECgYBzM7yEM0SUE6DI0WGATtuhVRXL3hjgPqf3TzmsQFMEal2Bu14d/d9f
|
38
|
+
zLks8POWjtQcgn2PGvrHS+aJZYR0okue4Ny5bfk+AohClXDtqZnz45wabYrRq6Xg
|
39
|
+
dTi8xJJHVkoRfcQleui6oqRB3i4iGlu5k8T1+djLLiN9eo0PY1VciQ==
|
40
|
+
-----END RSA PRIVATE KEY-----
|
41
|
+
|
42
|
+
test:
|
43
|
+
<<: *development_defaults
|
44
|
+
|
45
|
+
release:
|
46
|
+
# Since the key to encrypt and decrypt with must NOT be stored along with the
|
47
|
+
# source code, we only hold a RSA key that is used to unlock the file
|
48
|
+
# containing the actual symmetric encryption key
|
49
|
+
private_rsa_key: |
|
50
|
+
-----BEGIN RSA PRIVATE KEY-----
|
51
|
+
MIIEpAIBAAKCAQEAxfbNAn6fc+poM/5mZwpDqO/fD064jcb5HNnCMm0AgXE75nU4
|
52
|
+
J2zrDbLj9bmKTHNdhYiwTCPsnZ9Ngtz4VmBRHkmirA6cclMesWXUHlqfHyCvvEYj
|
53
|
+
bhVMwOu/t07wPzFH7/f2HQLEX4Ilw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6ao4/o1f3I59C07ym4FAAN3tRn+5U7YuNgsE2YbdoEOVm5FRT7uWr
|
69
|
+
ws9LbIKJp1cxC59VmjACwW5Wt9dCbpObKEUUjkTJ4NbJHwdctqiOk97vhL0NL9ed
|
70
|
+
nMHK75n9oikI3sU9FIzOnukCgYEAz9FpgZ1K6EQ3om9S9crfyMEIICUBoiKQKb5z
|
71
|
+
sND+Y+Y//nnnGcFkhF7EezmcZ8eiqtYyPl3OqtC7U+LxrgPtWJ4azSwxyiL6lLb4
|
72
|
+
Zb/nykIf60Xe09QUre3zkCzKzuw44XF5gkvuW6tFC6H4+RZu4H8FDHHFp3gxXPEp
|
73
|
+
O43Xn8ECgYBzM7yEM0SUE6DI0WGATtuhVRXL3hjgPqf3TzmsQFMEal2Bu14d/d9f
|
74
|
+
zLks8POWjtQcgn2PGvrHS+aJZYR0okue4Ny5bfk+AohClXDtqZnz45wabYrRq6Xg
|
75
|
+
dTi8xJJHVkoRfcQleui6oqRB3i4iGlu5k8T1+djLLiN9eo0PY1VciQ==
|
76
|
+
-----END RSA PRIVATE KEY-----
|
77
|
+
|
78
|
+
|
79
|
+
# List Symmetric Key files in the order of current / latest first
|
80
|
+
ciphers:
|
81
|
+
-
|
82
|
+
# Filename containing Symmetric Encryption Key encrypted using the
|
83
|
+
# RSA public key derived from the private key above
|
84
|
+
key_filename: config/keys/dummy_release.key
|
85
|
+
iv_filename: config/keys/dummy_release.iv
|
86
|
+
cipher_name: aes-256-cbc
|
87
|
+
# Base64 encode encrypted data without newlines
|
88
|
+
encoding: :base64strict
|
89
|
+
version: 1
|
90
|
+
|
91
|
+
production:
|
92
|
+
# Since the key to encrypt and decrypt with must NOT be stored along with the
|
93
|
+
# source code, we only hold a RSA key that is used to unlock the file
|
94
|
+
# containing the actual symmetric encryption key
|
95
|
+
private_rsa_key: |
|
96
|
+
-----BEGIN RSA PRIVATE KEY-----
|
97
|
+
MIIEpAIBAAKCAQEAy6UmlgZFM2f70i5/xINHdxZVbxPRgUrf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1BU4rcVMYuKJwS9XSFIlW0Npq8uMZKP4A8dnw+bz53XZJr5DsaPoWy
|
113
|
+
jm65UC+Tbqg0mZV0mJ5JMKiH5Ezfu03mJUuYmJgnAoGAVcFOB9GdrRpk6/rALCGO
|
114
|
+
BUa7FakdHmR7R/banSCYzzIf61WSzzsdb9PWC1uDiEWva9gr07RNCHmfqld9LPFV
|
115
|
+
6YPbop8kj7bfMEBB4MfQymfGlf8azICbAW6cKtbqyzBYh/9ud+diIwLjwULZjxUc
|
116
|
+
vtrTWYc1cmD7ofqg2nE7bsECgYEAqCtOyTPaOiS/WNRcpI1zYHPhC0IDDAEjHhvm
|
117
|
+
6IjUf4/M/jfpWsyfG3M5Fzbfnnjf+LV1pWO3Cg2qzaum02BUZGFB0ZWKhRtG+Rv+
|
118
|
+
goptX1L26Rdsx7sR1M1KWYolJAt1dj0ax5mLh3G4Dcm2Rr2Oy0HoOCbSIbkPKsL5
|
119
|
+
Wo6cqT8CgYAwMtF9qJYeEJtjgxuRVwlEUzcvxsNiuuUSFq9RpAXYL+F2U/P0SdQw
|
120
|
+
06nf1JLvkcG2CyMbIB62BnQcuUyGAuhjtbpcsSn4MG00vfDNMPkaxOJ9W4S3mmnt
|
121
|
+
U2mXWYauJDvNdLEr42bVX3bTPTfR4zrIqe+oJJCH61Jcu/3ekpSkkA==
|
122
|
+
-----END RSA PRIVATE KEY-----
|
123
|
+
|
124
|
+
|
125
|
+
# List Symmetric Key files in the order of current / latest first
|
126
|
+
ciphers:
|
127
|
+
-
|
128
|
+
# Filename containing Symmetric Encryption Key encrypted using the
|
129
|
+
# RSA public key derived from the private key above
|
130
|
+
key_filename: config/keys/dummy_production.key
|
131
|
+
iv_filename: config/keys/dummy_production.iv
|
132
|
+
cipher_name: aes-256-cbc
|
133
|
+
# Base64 encode encrypted data without newlines
|
134
|
+
encoding: :base64strict
|
135
|
+
version: 1
|
@@ -3,13 +3,11 @@ class DeviseCreateKauiUsers < ActiveRecord::Migration
|
|
3
3
|
def change
|
4
4
|
create_table(:kaui_users) do |t|
|
5
5
|
# From Kill Bill
|
6
|
-
t.string :kb_tenant_id, :null => true
|
7
6
|
t.string :kb_username, :null => false
|
8
7
|
t.string :kb_session_id, :null => true
|
9
|
-
|
10
8
|
t.timestamps
|
11
9
|
end
|
12
10
|
|
13
|
-
add_index :kaui_users, [:
|
11
|
+
add_index :kaui_users, [:kb_username], :unique => true
|
14
12
|
end
|
15
13
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# This migration comes from kaui (originally 20150109214021)
|
2
|
+
class CreateKauiTenants < ActiveRecord::Migration
|
3
|
+
def change
|
4
|
+
create_table :kaui_tenants do |t|
|
5
|
+
t.string :name
|
6
|
+
t.string :kb_tenant_id
|
7
|
+
t.string :api_key
|
8
|
+
t.string :encrypted_api_secret
|
9
|
+
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# This migration comes from kaui (originally 20150112232813)
|
2
|
+
class CreateKauiAllowedUsers < ActiveRecord::Migration
|
3
|
+
def change
|
4
|
+
create_table :kaui_allowed_users do |t|
|
5
|
+
t.string :kb_username
|
6
|
+
t.string :description
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
|
10
|
+
add_index :kaui_allowed_users, [:kb_username], :unique => true
|
11
|
+
|
12
|
+
create_table :kaui_allowed_user_tenants do |t|
|
13
|
+
t.belongs_to :kaui_allowed_user, :index => true
|
14
|
+
t.belongs_to :kaui_tenant, :index => true
|
15
|
+
t.timestamps null: false
|
16
|
+
end
|
17
|
+
|
18
|
+
add_index :kaui_allowed_user_tenants, [:kaui_allowed_user_id, :kaui_tenant_id], :unique => true, :name => 'kaui_allowed_user_tenants_uniq'
|
19
|
+
end
|
20
|
+
end
|
data/test/dummy/db/schema.rb
CHANGED
@@ -11,16 +11,42 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended to check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(:version =>
|
14
|
+
ActiveRecord::Schema.define(:version => 20150116052159) do
|
15
15
|
|
16
|
-
create_table "
|
16
|
+
create_table "kaui_allowed_user_tenants", :force => true do |t|
|
17
|
+
t.integer "kaui_allowed_user_id"
|
18
|
+
t.integer "kaui_tenant_id"
|
19
|
+
t.datetime "created_at", :null => false
|
20
|
+
t.datetime "updated_at", :null => false
|
21
|
+
end
|
22
|
+
|
23
|
+
add_index "kaui_allowed_user_tenants", ["kaui_allowed_user_id", "kaui_tenant_id"], :name => "kaui_allowed_user_tenants_uniq", :unique => true
|
24
|
+
|
25
|
+
create_table "kaui_allowed_users", :force => true do |t|
|
26
|
+
t.string "kb_username"
|
27
|
+
t.string "description"
|
28
|
+
t.datetime "created_at", :null => false
|
29
|
+
t.datetime "updated_at", :null => false
|
30
|
+
end
|
31
|
+
|
32
|
+
add_index "kaui_allowed_users", ["kb_username"], :name => "index_kaui_allowed_users_on_kb_username", :unique => true
|
33
|
+
|
34
|
+
create_table "kaui_tenants", :force => true do |t|
|
35
|
+
t.string "name"
|
17
36
|
t.string "kb_tenant_id"
|
37
|
+
t.string "api_key"
|
38
|
+
t.string "encrypted_api_secret"
|
39
|
+
t.datetime "created_at", :null => false
|
40
|
+
t.datetime "updated_at", :null => false
|
41
|
+
end
|
42
|
+
|
43
|
+
create_table "kaui_users", :force => true do |t|
|
18
44
|
t.string "kb_username", :null => false
|
19
45
|
t.string "kb_session_id"
|
20
46
|
t.datetime "created_at", :null => false
|
21
47
|
t.datetime "updated_at", :null => false
|
22
48
|
end
|
23
49
|
|
24
|
-
add_index "kaui_users", ["
|
50
|
+
add_index "kaui_users", ["kb_username"], :name => "index_kaui_users_on_kb_username", :unique => true
|
25
51
|
|
26
52
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Kaui
|
4
|
+
class AdminAllowedUsersControllerTest < Kaui::FunctionalTestHelper
|
5
|
+
test "should get new" do
|
6
|
+
post :new
|
7
|
+
assert_response :success
|
8
|
+
end
|
9
|
+
|
10
|
+
test "should get create" do
|
11
|
+
post :create, :allowed_user => { :kb_username => 'Albator', :description => 'My french super hero'}
|
12
|
+
assert_response 302
|
13
|
+
end
|
14
|
+
|
15
|
+
test 'should get index' do
|
16
|
+
get :index
|
17
|
+
assert_response 200
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
test "should get show" do
|
22
|
+
au = Kaui::AllowedUser.new
|
23
|
+
au.kb_username = 'Mad Max'
|
24
|
+
au.description = 'My super hero'
|
25
|
+
au.save!
|
26
|
+
get :show, :id => au.id
|
27
|
+
assert_response :success
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Kaui
|
4
|
+
class AdminTenantsControllerTest < Kaui::FunctionalTestHelper
|
5
|
+
|
6
|
+
test "should get new" do
|
7
|
+
post :new
|
8
|
+
assert_response :success
|
9
|
+
end
|
10
|
+
|
11
|
+
test "should get create" do
|
12
|
+
now = Time.now.to_s
|
13
|
+
post :create, :tenant => { :name => 'Goldorak_' + now, :api_key => '12345_' + now, :api_secret => 'ItH@st0beComplic@ted'}
|
14
|
+
assert_response 302
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
test "should get show" do
|
19
|
+
tenant = Kaui::Tenant.new
|
20
|
+
tenant.name = 'foo'
|
21
|
+
tenant.api_key = 'api_key'
|
22
|
+
tenant.api_secret = 'api_secret'
|
23
|
+
tenant.kb_tenant_id = 'kb_tenant_id'
|
24
|
+
tenant.save!
|
25
|
+
get :show, :id => tenant.id
|
26
|
+
assert_response :success
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
test "should get index" do
|
31
|
+
get :index
|
32
|
+
assert_response :success
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|