kaui 0.8.3 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -0
- data/Gemfile.lock +5 -5
- data/README.md +2 -2
- data/app/controllers/kaui/admin_tenants_controller.rb +5 -0
- data/app/models/kaui/ability.rb +7 -1
- data/app/views/kaui/admin_tenants/show.html.erb +9 -9
- data/kaui.gemspec +1 -1
- data/lib/kaui/version.rb +1 -1
- data/test/functional/kaui/admin_tenants_controller_test.rb +24 -6
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2789a969d9773d7b85873b78de5e7499e8a0bff
|
4
|
+
data.tar.gz: 16387777a6d098c092cfb74b6bbf35c771f852d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5da777efcada57eefc888c217e444059cce523e8bc37d4fb2395e7b3252e010f4e82e3d5ff5d4986a2cff8caf40a41e471f5a6e52e5c21ac0d89eeebfd061fb
|
7
|
+
data.tar.gz: fb7a52912944083a5142609d150d272c78e1176b0a3c1e918e7adc513839e610d97d56cf3c36a59417a522af5b9abbda39f8694efe045bbc3ce0d9320ad058fb
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
kaui (0.8.
|
4
|
+
kaui (0.8.4)
|
5
5
|
cancan (~> 1.6.10)
|
6
6
|
carmen-rails (~> 1.0.0)
|
7
7
|
d3_rails (~> 3.2.8)
|
8
8
|
devise (~> 3.0.2)
|
9
9
|
jquery-rails (~> 3.0.4)
|
10
|
-
killbill-client (~> 0.10.
|
10
|
+
killbill-client (~> 0.10.7)
|
11
11
|
money-rails (~> 0.8.1)
|
12
12
|
rails (~> 3.2.14)
|
13
13
|
symmetric-encryption (~> 3.6.0)
|
@@ -67,7 +67,7 @@ GEM
|
|
67
67
|
warden (~> 1.2.3)
|
68
68
|
docile (1.1.5)
|
69
69
|
erubis (2.7.0)
|
70
|
-
execjs (2.
|
70
|
+
execjs (2.4.0)
|
71
71
|
fakeweb (1.3.0)
|
72
72
|
hike (1.2.3)
|
73
73
|
i18n (0.6.11)
|
@@ -76,13 +76,13 @@ GEM
|
|
76
76
|
railties (>= 3.0, < 5.0)
|
77
77
|
thor (>= 0.14, < 2.0)
|
78
78
|
json (1.8.2)
|
79
|
-
killbill-client (0.10.
|
79
|
+
killbill-client (0.10.7)
|
80
80
|
json (>= 1.2.0)
|
81
81
|
mail (2.5.4)
|
82
82
|
mime-types (~> 1.16)
|
83
83
|
treetop (~> 1.4.8)
|
84
84
|
mime-types (1.25.1)
|
85
|
-
money (5.1.
|
85
|
+
money (5.1.1)
|
86
86
|
i18n (~> 0.6.0)
|
87
87
|
money-rails (0.8.1)
|
88
88
|
activesupport (>= 3.0)
|
data/README.md
CHANGED
@@ -97,7 +97,7 @@ KAUI has been enhanced to support multi-tenancy. In order to benefit from that m
|
|
97
97
|
Admin User Roles
|
98
98
|
-------------------------
|
99
99
|
|
100
|
-
In multi-tenancy mode, there are two
|
100
|
+
In multi-tenancy mode, there are two kinds of users:
|
101
101
|
|
102
102
|
* The **multi-tenant admin** user, which has the rights to configure the tenant information (creation of tenant, add allowed users for specific tenant, upload catalog, ...)
|
103
103
|
* The **per-tenant admin** user, which operates just a given tenant
|
@@ -116,7 +116,7 @@ Multi-tenancy screens
|
|
116
116
|
|
117
117
|
KAUI has been enriched with new models and new screens to manage the multi-tenancy, and those are available for the multi-tenant admin user:
|
118
118
|
|
119
|
-
* The `kaui_tenants` table will list the available tenants (from KAUI point of view); note that this is redundant with the Kill Bill `tenants` table, and the reason is that the `api_secret` needs to maintained in KAUI as well, so listing the existing tenants from Kill Bill would not work since that key is encrypted and cannot be returned. A new screen mounted on `/admin_tenants` allows to configure new tenants. The view allows to create the new tenant in Kill Bill or simply updates the local KAUI config if the tenant already exists.
|
119
|
+
* The `kaui_tenants` table will list the available tenants (from KAUI point of view); note that this is redundant with the Kill Bill `tenants` table, and the reason is that the `api_secret` needs to be maintained in KAUI as well, so listing the existing tenants from Kill Bill would not work since that key is encrypted and cannot be returned. A new screen mounted on `/admin_tenants` allows to configure new tenants. The view allows to create the new tenant in Kill Bill or simply updates the local KAUI config if the tenant already exists.
|
120
120
|
* The `kaui_allowed_users` table along with the join table `kaui_allowed_user_tenants` will list all the users in the system that can access specific tenants. The join table is required since a given user could access multiple tenants (e.g multi-tenant admin user), and at the same time many users could access the same tenant. A new screen mounted on `/admin_allowed_users` allows to configure the set of allowed users associated to specific tenants.
|
121
121
|
|
122
122
|
|
@@ -58,6 +58,11 @@ module Kaui
|
|
58
58
|
|
59
59
|
def show
|
60
60
|
@tenant = Kaui::Tenant.find(params[:id])
|
61
|
+
user = current_user
|
62
|
+
if @tenant.kaui_allowed_users.index { |e| e.kb_username == user.kb_username}.nil?
|
63
|
+
flash[:error] = "Does not have permissions to see tenant id #{params[:id]}"
|
64
|
+
redirect_to admin_tenants_path and return
|
65
|
+
end
|
61
66
|
render
|
62
67
|
end
|
63
68
|
|
data/app/models/kaui/ability.rb
CHANGED
@@ -33,9 +33,15 @@ module Kaui
|
|
33
33
|
#
|
34
34
|
to_be_model, action = permission.split(':')
|
35
35
|
# Currently the only actions implemented for overdue and catalog (upload_config) are those implemented at the tenant level:
|
36
|
-
if to_be_model == 'tenant' ||
|
36
|
+
if to_be_model == 'tenant' ||
|
37
|
+
to_be_model == 'overdue' ||
|
38
|
+
to_be_model == 'catalog'
|
37
39
|
to_be_model = 'admin_tenant'
|
38
40
|
end
|
41
|
+
if to_be_model == 'entitlement'
|
42
|
+
to_be_model = 'subscription'
|
43
|
+
end
|
44
|
+
|
39
45
|
[to_be_model, action]
|
40
46
|
end
|
41
47
|
end
|
@@ -1,13 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
</dl>
|
1
|
+
<dl class="dl-horizontal">
|
2
|
+
<dt>Name:</dt>
|
3
|
+
<dd><%= @tenant.name %> </dd>
|
4
|
+
<dt>Tenant ID:</dt>
|
5
|
+
<dd><%= @tenant.kb_tenant_id %> </dd>
|
6
|
+
<dt>API Key:</dt>
|
7
|
+
<dd><%= @tenant.api_key %> </dd>
|
8
|
+
</dl>
|
10
9
|
|
10
|
+
<% if can? :view, Kaui::AdminTenant %>
|
11
11
|
<% unless @tenant.kaui_allowed_users.empty? %>
|
12
12
|
<h3>Allowed Users:</h3>
|
13
13
|
<table id="allowed-users-for-tenant-table" class="table table-condensed">
|
data/kaui.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
|
|
27
27
|
s.add_dependency 'money-rails', '~> 0.8.1'
|
28
28
|
s.add_dependency 'd3_rails', '~> 3.2.8'
|
29
29
|
s.add_dependency 'twitter-bootstrap-rails', '~> 2.2.8'
|
30
|
-
s.add_dependency 'killbill-client', '~> 0.10.
|
30
|
+
s.add_dependency 'killbill-client', '~> 0.10.7'
|
31
31
|
s.add_dependency 'devise', '~> 3.0.2'
|
32
32
|
s.add_dependency 'cancan', '~> 1.6.10'
|
33
33
|
s.add_dependency 'carmen-rails', '~> 1.0.0'
|
data/lib/kaui/version.rb
CHANGED
@@ -2,7 +2,6 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module Kaui
|
4
4
|
class AdminTenantsControllerTest < Kaui::FunctionalTestHelper
|
5
|
-
|
6
5
|
test "should get new" do
|
7
6
|
post :new
|
8
7
|
assert_response :success
|
@@ -10,26 +9,45 @@ module Kaui
|
|
10
9
|
|
11
10
|
test "should get create" do
|
12
11
|
now = Time.now.to_s
|
13
|
-
post :create, :tenant => { :name => 'Goldorak_' + now, :api_key => '12345_' + now, :api_secret => 'ItH@st0beComplic@ted'}
|
12
|
+
post :create, { :tenant => { :name => 'Goldorak_' + now, :api_key => '12345_' + now, :api_secret => 'ItH@st0beComplic@ted'}, :create_tenant => true}
|
14
13
|
assert_response 302
|
15
14
|
end
|
16
15
|
|
17
16
|
|
18
|
-
test "should get
|
17
|
+
test "should get index" do
|
18
|
+
get :index
|
19
|
+
assert_response :success
|
20
|
+
end
|
21
|
+
|
22
|
+
test "should get show with allowed user" do
|
19
23
|
tenant = Kaui::Tenant.new
|
20
24
|
tenant.name = 'foo'
|
21
25
|
tenant.api_key = 'api_key'
|
22
26
|
tenant.api_secret = 'api_secret'
|
23
27
|
tenant.kb_tenant_id = 'kb_tenant_id'
|
24
28
|
tenant.save!
|
29
|
+
|
30
|
+
# Add an allowed user that will verify that we can only
|
31
|
+
au = Kaui::AllowedUser.find_by_kb_username('admin')
|
32
|
+
au.kaui_tenants << tenant
|
33
|
+
|
25
34
|
get :show, :id => tenant.id
|
26
35
|
assert_response :success
|
27
36
|
end
|
28
37
|
|
38
|
+
test "should get show with NO allowed user" do
|
39
|
+
tenant = Kaui::Tenant.new
|
40
|
+
tenant.name = 'foo'
|
41
|
+
tenant.api_key = 'api_key'
|
42
|
+
tenant.api_secret = 'api_secret'
|
43
|
+
tenant.kb_tenant_id = 'kb_tenant_id'
|
44
|
+
tenant.save!
|
29
45
|
|
30
|
-
|
31
|
-
|
32
|
-
|
46
|
+
get :show, :id => tenant.id
|
47
|
+
assert_response 302
|
48
|
+
# Clear it before we call check_no_flash_error
|
49
|
+
flash[:error] = nil
|
33
50
|
end
|
51
|
+
|
34
52
|
end
|
35
53
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kaui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Killbill core team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.10.
|
89
|
+
version: 0.10.7
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.10.
|
96
|
+
version: 0.10.7
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: devise
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -497,7 +497,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
497
497
|
version: '0'
|
498
498
|
requirements: []
|
499
499
|
rubyforge_project:
|
500
|
-
rubygems_version: 2.
|
500
|
+
rubygems_version: 2.4.6
|
501
501
|
signing_key:
|
502
502
|
specification_version: 4
|
503
503
|
summary: Killbill Admin UI mountable engine
|