kaui 0.8.0 → 0.8.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b6a81e6e3a3619f778099f358dc74d3225cb53e8
4
- data.tar.gz: 20c0ac946eeb47e2a1caf16b916b5d9541ec12ff
3
+ metadata.gz: f76c44debafe012a786bfaad08689567c41e67c1
4
+ data.tar.gz: 685ef282ca6ec11ce123b672803827ed3ab6bdca
5
5
  SHA512:
6
- metadata.gz: 8e0c097898fc8ef1a2950043724888498061d9e4132bf0986e7060ef216098f8a575a98a84486580e2cd8039600543f793b5fa30f3fba8fe0e677feec723418b
7
- data.tar.gz: d7e88959ca5f56094c30586856b3ead2d09dea34ca1620ee9029da414823950a3a03564b6d77d0426b701c2f8f0a08f6f20fe928dfc23c91da1764ea682c7107
6
+ metadata.gz: d5e837d361a21b06f0fbb19202170733fcd3fb7e5b5413e7e17aed117b8c7c81af34e55df61f317a2f1acd640143e791b7d574b4e609233bd0c1eb6b5c78dfe6
7
+ data.tar.gz: 2a86fe5e70491f0e8b5fc472f44282371d7ce68e1b044ce82ff028d07443ce3883569aa63e9777e5dd6ca9df79a8fdf65d7f107caa3fbdb92ec86a0960df53de
data/Gemfile.lock CHANGED
@@ -1,13 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kaui (0.8.0)
4
+ kaui (0.8.1)
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.1)
10
+ killbill-client (~> 0.10.4)
11
11
  money-rails (~> 0.8.1)
12
12
  rails (~> 3.2.14)
13
13
  symmetric-encryption (~> 3.6.0)
@@ -45,11 +45,8 @@ GEM
45
45
  multi_json (~> 1.0)
46
46
  arel (3.0.3)
47
47
  bcrypt (3.1.10)
48
- bcrypt (3.1.10-java)
49
48
  bcrypt-ruby (3.1.5)
50
49
  bcrypt (>= 3.1.3)
51
- bcrypt-ruby (3.1.5-java)
52
- bcrypt (>= 3.1.3)
53
50
  builder (3.0.4)
54
51
  cancan (1.6.10)
55
52
  carmen (1.0.1)
@@ -79,8 +76,7 @@ GEM
79
76
  railties (>= 3.0, < 5.0)
80
77
  thor (>= 0.14, < 2.0)
81
78
  json (1.8.2)
82
- json (1.8.2-java)
83
- killbill-client (0.10.3)
79
+ killbill-client (0.10.4)
84
80
  json (>= 1.2.0)
85
81
  mail (2.5.4)
86
82
  mime-types (~> 1.16)
@@ -136,7 +132,6 @@ GEM
136
132
  coercible (>= 1.0.0)
137
133
  thor (0.19.1)
138
134
  thread_safe (0.3.4)
139
- thread_safe (0.3.4-java)
140
135
  tilt (1.4.1)
141
136
  treetop (1.4.15)
142
137
  polyglot
data/README.md CHANGED
@@ -87,3 +87,37 @@ Then, install and run it from a local directory:
87
87
  Alternatively, you can run the `kaui` script under `bin` by setting your loadpath correctly:
88
88
 
89
89
  ruby -Ilib bin/kaui /path/to/rails/app --path=$PWD --skip-bundle
90
+
91
+
92
+ Multi-Tenancy
93
+ ===========
94
+
95
+ KAUI has been enhanced to support multi-tenancy. In order to benefit from that mode, remove the properties `KillBillClient.api_key` and `KillBillClient.api_secret` from the config/initializers directory.
96
+
97
+ Admin User Roles
98
+ -------------------------
99
+
100
+ In multi-tenancy mode, there are two kind of users:
101
+
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
+ * The **per-tenant admin** user, which operates just a given tenant
104
+
105
+ Those roles and permissions are defined the same way other permissions are defined: The Shiro configuration (static config file, LDAP) in Kill Bill, will determine for each user its associated role, and the roles will have a set of available [permissions](https://github.com/killbill/killbill-api/blob/master/src/main/java/org/killbill/billing/security/Permission.java). The new permissions have been created:
106
+
107
+ * TENANT_CAN_VIEW
108
+ * TENANT_CAN_CREATE
109
+ * OVERDUE_CAN_UPLOAD
110
+ * CATALOG_CAN_UPLOAD
111
+
112
+ The [enforcement in KAUI](https://github.com/killbill/killbill-admin-ui/blob/master/app/models/kaui/ability.rb) is based on the CanCan gem.
113
+
114
+ Multi-tenancy screens
115
+ ------------------------------
116
+
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
+
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.
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
+
122
+
123
+
@@ -22,14 +22,22 @@ module Kaui
22
22
  end
23
23
 
24
24
  begin
25
- # Create the tenant in Kill Bill
26
- new_tenant = Kaui::AdminTenant.new
27
- new_tenant.external_key = param_tenant[:name]
28
- new_tenant.api_key = param_tenant[:api_key]
29
- new_tenant.api_secret = param_tenant[:api_secret]
30
25
 
31
26
  options = tenant_options_for_client
32
- new_tenant = new_tenant.create(options[:username], nil, comment, options)
27
+ new_tenant = nil
28
+
29
+ if params[:create_tenant]
30
+ # Create the tenant in Kill Bill
31
+ new_tenant = Kaui::AdminTenant.new
32
+ new_tenant.external_key = param_tenant[:name]
33
+ new_tenant.api_key = param_tenant[:api_key]
34
+ new_tenant.api_secret = param_tenant[:api_secret]
35
+ new_tenant = new_tenant.create(options[:username], nil, comment, options)
36
+ else
37
+ options[:api_key] = param_tenant[:api_key]
38
+ options[:api_secret] = param_tenant[:api_secret]
39
+ new_tenant = Kaui::AdminTenant.find_by_api_key(param_tenant[:api_key], options)
40
+ end
33
41
 
34
42
  # Transform object to Kaui model
35
43
  tenant_model = Kaui::Tenant.new
@@ -24,6 +24,13 @@
24
24
  </div>
25
25
  </div>
26
26
 
27
+ <div class="control-group">
28
+ <%= f.label :create_tenant, 'Create tenant', :class => 'control-label' %>
29
+ <div class="controls">
30
+ <%= check_box_tag(:create_tenant) %>
31
+ </div>
32
+ </div>
33
+
27
34
  <div class="form-actions">
28
35
  <%= button_tag 'Configure a new Tenant', :class => 'btn btn-primary' %>
29
36
  </div>
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.1'
30
+ s.add_dependency 'killbill-client', '~> 0.10.4'
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
@@ -1,3 +1,3 @@
1
1
  module Kaui
2
- VERSION = '0.8.0'
2
+ VERSION = '0.8.1'
3
3
  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.0
4
+ version: 0.8.1
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-02-13 00:00:00.000000000 Z
11
+ date: 2015-02-27 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.1
89
+ version: 0.10.4
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.1
96
+ version: 0.10.4
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: devise
99
99
  requirement: !ruby/object:Gem::Requirement