strongbolt 0.3.6

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.
Files changed (145) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +33 -0
  3. data/.gitignore +18 -0
  4. data/.rspec +1 -0
  5. data/.ruby-gemset +1 -0
  6. data/.ruby-version +1 -0
  7. data/Gemfile +4 -0
  8. data/Gemfile.lock +130 -0
  9. data/LICENSE.txt +22 -0
  10. data/README.md +182 -0
  11. data/Rakefile +1 -0
  12. data/app/assets/javascripts/strongbolt.js +1 -0
  13. data/app/assets/javascripts/strongbolt/role-capabilities.js +80 -0
  14. data/app/controllers/strongbolt/capabilities_controller.rb +77 -0
  15. data/app/controllers/strongbolt/roles_controller.rb +92 -0
  16. data/app/controllers/strongbolt/security_controller.rb +8 -0
  17. data/app/controllers/strongbolt/user_groups_controller.rb +76 -0
  18. data/app/controllers/strongbolt/user_groups_users_controller.rb +35 -0
  19. data/app/controllers/strongbolt_controller.rb +2 -0
  20. data/app/views/strongbolt/_menu.html.erb +13 -0
  21. data/app/views/strongbolt/capabilities/index.html.erb +53 -0
  22. data/app/views/strongbolt/capabilities/show.html.erb +53 -0
  23. data/app/views/strongbolt/roles/_capabilities.html.erb +47 -0
  24. data/app/views/strongbolt/roles/_capability.html.erb +21 -0
  25. data/app/views/strongbolt/roles/_form.html.erb +12 -0
  26. data/app/views/strongbolt/roles/edit.html.erb +14 -0
  27. data/app/views/strongbolt/roles/index.html.erb +54 -0
  28. data/app/views/strongbolt/roles/new.html.erb +11 -0
  29. data/app/views/strongbolt/roles/show.html.erb +52 -0
  30. data/app/views/strongbolt/user_groups/_form.html.erb +12 -0
  31. data/app/views/strongbolt/user_groups/edit.html.erb +14 -0
  32. data/app/views/strongbolt/user_groups/index.html.erb +46 -0
  33. data/app/views/strongbolt/user_groups/new.html.erb +13 -0
  34. data/app/views/strongbolt/user_groups/show.html.erb +88 -0
  35. data/lib/generators/strongbolt/fix_generator.rb +23 -0
  36. data/lib/generators/strongbolt/indexes_generator.rb +19 -0
  37. data/lib/generators/strongbolt/install_generator.rb +29 -0
  38. data/lib/generators/strongbolt/templates/fix.rb +5 -0
  39. data/lib/generators/strongbolt/templates/indexes.rb +21 -0
  40. data/lib/generators/strongbolt/templates/migration.rb +73 -0
  41. data/lib/generators/strongbolt/templates/strongbolt.rb +45 -0
  42. data/lib/generators/strongbolt/views_generator.rb +26 -0
  43. data/lib/strongbolt.rb +219 -0
  44. data/lib/strongbolt/base.rb +7 -0
  45. data/lib/strongbolt/bolted.rb +125 -0
  46. data/lib/strongbolt/bolted_controller.rb +297 -0
  47. data/lib/strongbolt/capabilities_role.rb +15 -0
  48. data/lib/strongbolt/capability.rb +165 -0
  49. data/lib/strongbolt/configuration.rb +111 -0
  50. data/lib/strongbolt/controllers/url_helpers.rb +37 -0
  51. data/lib/strongbolt/engine.rb +44 -0
  52. data/lib/strongbolt/errors.rb +38 -0
  53. data/lib/strongbolt/generators/migration.rb +35 -0
  54. data/lib/strongbolt/helpers.rb +18 -0
  55. data/lib/strongbolt/rails/routes.rb +20 -0
  56. data/lib/strongbolt/role.rb +46 -0
  57. data/lib/strongbolt/roles_user_group.rb +15 -0
  58. data/lib/strongbolt/rspec.rb +29 -0
  59. data/lib/strongbolt/rspec/user.rb +90 -0
  60. data/lib/strongbolt/tenantable.rb +304 -0
  61. data/lib/strongbolt/user_abilities.rb +292 -0
  62. data/lib/strongbolt/user_group.rb +24 -0
  63. data/lib/strongbolt/user_groups_user.rb +16 -0
  64. data/lib/strongbolt/users_tenant.rb +12 -0
  65. data/lib/strongbolt/version.rb +3 -0
  66. data/lib/tasks/strongbolt_tasks.rake +29 -0
  67. data/spec/controllers/strongbolt/capabilities_controller_spec.rb +254 -0
  68. data/spec/controllers/strongbolt/roles_controller_spec.rb +228 -0
  69. data/spec/controllers/strongbolt/user_groups_controller_spec.rb +216 -0
  70. data/spec/controllers/strongbolt/user_groups_users_controller_spec.rb +69 -0
  71. data/spec/controllers/without_authorization_controller_spec.rb +20 -0
  72. data/spec/dummy/.rspec +2 -0
  73. data/spec/dummy/README.rdoc +28 -0
  74. data/spec/dummy/Rakefile +6 -0
  75. data/spec/dummy/app/assets/images/.keep +0 -0
  76. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  77. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  78. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  79. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  80. data/spec/dummy/app/controllers/posts_controller.rb +18 -0
  81. data/spec/dummy/app/controllers/test_controller.rb +3 -0
  82. data/spec/dummy/app/controllers/without_authorization_controller.rb +5 -0
  83. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  84. data/spec/dummy/app/mailers/.keep +0 -0
  85. data/spec/dummy/app/models/.keep +0 -0
  86. data/spec/dummy/app/models/concerns/.keep +0 -0
  87. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  88. data/spec/dummy/bin/bundle +3 -0
  89. data/spec/dummy/bin/rails +4 -0
  90. data/spec/dummy/bin/rake +4 -0
  91. data/spec/dummy/config.ru +4 -0
  92. data/spec/dummy/config/application.rb +29 -0
  93. data/spec/dummy/config/boot.rb +5 -0
  94. data/spec/dummy/config/database.yml +25 -0
  95. data/spec/dummy/config/environment.rb +5 -0
  96. data/spec/dummy/config/environments/development.rb +37 -0
  97. data/spec/dummy/config/environments/production.rb +78 -0
  98. data/spec/dummy/config/environments/test.rb +39 -0
  99. data/spec/dummy/config/initializers/assets.rb +8 -0
  100. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  101. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  102. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  103. data/spec/dummy/config/initializers/inflections.rb +16 -0
  104. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  105. data/spec/dummy/config/initializers/session_store.rb +3 -0
  106. data/spec/dummy/config/initializers/strongbolt.rb +32 -0
  107. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  108. data/spec/dummy/config/locales/en.yml +23 -0
  109. data/spec/dummy/config/routes.rb +12 -0
  110. data/spec/dummy/config/secrets.yml +22 -0
  111. data/spec/dummy/db/development.sqlite3 +0 -0
  112. data/spec/dummy/db/migrate/20150630212236_create_strongbolt_tables.rb +54 -0
  113. data/spec/dummy/db/migrate/20150630212251_create_strongbolt_tables_indexes.rb +21 -0
  114. data/spec/dummy/db/schema.rb +84 -0
  115. data/spec/dummy/db/test.sqlite3 +0 -0
  116. data/spec/dummy/lib/assets/.keep +0 -0
  117. data/spec/dummy/public/404.html +67 -0
  118. data/spec/dummy/public/422.html +67 -0
  119. data/spec/dummy/public/500.html +66 -0
  120. data/spec/dummy/public/favicon.ico +0 -0
  121. data/spec/fabricators/capability_fabricator.rb +4 -0
  122. data/spec/fabricators/role_fabricator.rb +9 -0
  123. data/spec/fabricators/user_fabricator.rb +3 -0
  124. data/spec/fabricators/user_group_fabricator.rb +9 -0
  125. data/spec/fixtures/application.rb +28 -0
  126. data/spec/fixtures/controllers.rb +5 -0
  127. data/spec/spec_helper.rb +89 -0
  128. data/spec/strongbolt/bolted_controller_spec.rb +706 -0
  129. data/spec/strongbolt/bolted_spec.rb +136 -0
  130. data/spec/strongbolt/capability_spec.rb +251 -0
  131. data/spec/strongbolt/configuration_spec.rb +119 -0
  132. data/spec/strongbolt/controllers/url_helpers_spec.rb +34 -0
  133. data/spec/strongbolt/helpers_spec.rb +43 -0
  134. data/spec/strongbolt/role_spec.rb +90 -0
  135. data/spec/strongbolt/tenantable_spec.rb +281 -0
  136. data/spec/strongbolt/user_abilities_spec.rb +509 -0
  137. data/spec/strongbolt/user_group_spec.rb +37 -0
  138. data/spec/strongbolt/users_tenant_spec.rb +36 -0
  139. data/spec/strongbolt_spec.rb +274 -0
  140. data/spec/support/controller_macros.rb +11 -0
  141. data/spec/support/db_setup.rb +134 -0
  142. data/spec/support/helpers.rb +62 -0
  143. data/spec/support/transactional_specs.rb +17 -0
  144. data/strongbolt.gemspec +32 -0
  145. metadata +407 -0
@@ -0,0 +1,37 @@
1
+ require "spec_helper"
2
+
3
+ module Strongbolt
4
+
5
+ describe UserGroup do
6
+
7
+ let(:user_group) { UserGroup.new name: "PCCC" }
8
+
9
+ subject { user_group }
10
+
11
+ it { is_expected.to be_valid }
12
+
13
+ it { is_expected.to validate_presence_of :name }
14
+
15
+ it { is_expected.to have_many(:user_groups_users).class_name("Strongbolt::UserGroupsUser")
16
+ .dependent :restrict_with_exception }
17
+ it { is_expected.to have_many(:users).through :user_groups_users }
18
+
19
+ it { is_expected.to have_many(:roles_user_groups).class_name("Strongbolt::RolesUserGroup")
20
+ .dependent :delete_all }
21
+ it { is_expected.to have_many(:roles).through :roles_user_groups }
22
+
23
+ it { is_expected.to have_many(:capabilities).through :roles }
24
+
25
+ context "when there are users linked to it" do
26
+ before { user_group.users << User.create! }
27
+
28
+ it "cannot delete" do
29
+ expect do
30
+ user_group.destroy
31
+ end.to raise_error ActiveRecord::DeleteRestrictionError
32
+ end
33
+ end
34
+
35
+ end
36
+
37
+ end
@@ -0,0 +1,36 @@
1
+ require "spec_helper"
2
+
3
+ describe Strongbolt::UsersTenant do
4
+
5
+ before(:all) do
6
+ define_model "TenantModel" do
7
+ self.table_name = "models"
8
+
9
+ tenant
10
+ end
11
+ define_model "Model" do
12
+ self.table_name = "models"
13
+ end
14
+ end
15
+
16
+ let(:user) { User.create! }
17
+ let(:tenant) { TenantModel.create! }
18
+
19
+ let(:users_tenant) { Strongbolt::UsersTenantModel.new user: user, tenant_model: tenant }
20
+
21
+ subject { users_tenant }
22
+
23
+ it { is_expected.to belong_to :user }
24
+ it { is_expected.to belong_to(:tenant_model).class_name("TenantModel") }
25
+
26
+ it { is_expected.to be_valid }
27
+ it { is_expected.to validate_presence_of :user }
28
+ it { is_expected.to validate_presence_of :tenant_model }
29
+
30
+ it "should ensure tenant is a Tenant" do
31
+ expect do
32
+ users_tenant = Strongbolt::UsersTenantModel.new user: user, tenant_model: Model.create!
33
+ end.to raise_error ActiveRecord::AssociationTypeMismatch
34
+ end
35
+
36
+ end
@@ -0,0 +1,274 @@
1
+ require "spec_helper"
2
+
3
+ describe Strongbolt do
4
+
5
+ #
6
+ # Important included modules
7
+ #
8
+ it "should have included Grant::Grantable in ActiveRecord::Base" do
9
+ expect(ActiveRecord::Base.included_modules).to include Grant::Grantable
10
+ end
11
+
12
+ it "should have included Bolted in ActiveRecord::Base" do
13
+ expect(ActiveRecord::Base.included_modules).to include Strongbolt::Bolted
14
+ end
15
+
16
+ it "should have included tentable" do
17
+ expect(ActiveRecord::Base.included_modules).to include Strongbolt::Tenantable
18
+ end
19
+
20
+ #
21
+ # Setting up
22
+ #
23
+
24
+ describe "it should include module" do
25
+ before do
26
+ define_model "UserModel"
27
+ Strongbolt.setup do |config|
28
+ config.user_class = "UserModel"
29
+ end
30
+ end
31
+ after do
32
+ Strongbolt.setup do |config|
33
+ config.user_class = "User"
34
+ end
35
+ end
36
+
37
+ it "should include UserAbilities" do
38
+ expect(UserModel.included_modules).to include Strongbolt::UserAbilities
39
+ end
40
+
41
+
42
+ end
43
+
44
+ #
45
+ # Access denied
46
+ #
47
+ describe "access denied" do
48
+
49
+ before do
50
+ block = double('block', :call => nil)
51
+ expect(block).to receive(:call).with 'user', 'instance', 'action', 'request_path'
52
+ Strongbolt::Configuration.access_denied do |user, instance, action, request_path|
53
+ block.call user, instance, action, request_path
54
+ end
55
+ end
56
+ after { Strongbolt::Configuration.access_denied {} }
57
+
58
+ it "should call configuration's block" do
59
+ Strongbolt.access_denied 'user', 'instance', 'action', 'request_path'
60
+ end
61
+
62
+ end
63
+
64
+
65
+
66
+ #
67
+ # Without authorization
68
+ #
69
+ describe "without_authorization" do
70
+ it "should not perform authorization" do
71
+ Strongbolt.without_authorization do
72
+ expect(Grant::Status.grant_disabled?).to eq true
73
+ end
74
+ end
75
+
76
+ describe "perform action" do
77
+ before do
78
+ @user = User.create!
79
+ Strongbolt.current_user = User.create!
80
+ end
81
+ after { Strongbolt.current_user = nil }
82
+
83
+ let(:user) { @user }
84
+
85
+ context 'with authorization' do
86
+ it "should call user can? when normal" do
87
+ expect_any_instance_of(User).to receive(:can?)
88
+ .with(:find, user).and_return true
89
+ User.find user.id
90
+ end
91
+ end
92
+
93
+ context "when without_authorization" do
94
+ it "should not call can?" do
95
+ Strongbolt.without_authorization do
96
+ expect_any_instance_of(User).not_to receive(:can?)
97
+ expect(User.find user.id).to eq user
98
+ end
99
+ end
100
+ end
101
+ end
102
+ end
103
+
104
+
105
+ #
106
+ # Perform without authorization
107
+ #
108
+ describe "perform_without_authorization" do
109
+ before do
110
+ define("AnyClass", Object) do
111
+ def method arg1, arg2, &block
112
+ raise StandardError if Grant::Status.grant_enabled?
113
+ end
114
+ end
115
+ end
116
+
117
+ context "when not skipped" do
118
+ it "should raise error" do
119
+ expect do
120
+ AnyClass.new.method("ok", "ok2") {}
121
+ end.to raise_error
122
+ end
123
+ end
124
+
125
+ context "when skipped" do
126
+ before { AnyClass.perform_without_authorization :method }
127
+
128
+ it "should skip authorization" do
129
+ expect do
130
+ AnyClass.new.method("ok", "ok2") {}
131
+ end.not_to raise_error
132
+ end
133
+ end
134
+ end
135
+
136
+
137
+ #
138
+ # Disable, enable
139
+ #
140
+ describe "disable/enable" do
141
+ before { Strongbolt.disable_authorization }
142
+ after { Strongbolt.enable_authorization }
143
+
144
+ context "disabling" do
145
+ it "should disable Grant" do
146
+ expect(Grant::Status.grant_enabled?).to eq false
147
+ expect(Strongbolt.enabled?).to eq false
148
+ end
149
+ end
150
+
151
+ context "enabling" do
152
+ it "should enable Grant" do
153
+ Strongbolt.enable_authorization
154
+ expect(Grant::Status.grant_disabled?).to eq false
155
+ expect(Strongbolt.disabled?).to eq false
156
+ end
157
+ end
158
+ end
159
+
160
+
161
+
162
+ #
163
+ # Setting the Grant user
164
+ #
165
+ describe 'setting the current user' do
166
+
167
+ context "when it is from the same class then defined (or default)" do
168
+
169
+ context "when the model doesn't have the module UserAbilities included" do
170
+ before do
171
+ define_model "UserWithout" do
172
+ self.table_name = 'users'
173
+ end
174
+
175
+ # We configure the user class
176
+ Strongbolt::Configuration.user_class = 'UserWithout'
177
+ end
178
+ after { undefine_model "UserWithout" }
179
+
180
+ let(:user) { UserWithout.new }
181
+
182
+ it "should have included the module" do
183
+ Strongbolt.current_user = user
184
+ expect(UserWithout.included_modules).to include Strongbolt::UserAbilities
185
+ end
186
+
187
+ it "should set the current user" do
188
+ Strongbolt.current_user = user
189
+ expect(Strongbolt.current_user).to eq user
190
+ expect(Grant::User.current_user).to eq user
191
+ end
192
+ end # End when User Class doesn't have the UserAbilities included
193
+
194
+ context 'when the model has the UserAbilities module included' do
195
+
196
+ before do
197
+ define_model "UserWithAbilities" do
198
+ include Strongbolt::UserAbilities
199
+ self.table_name = 'users'
200
+ end
201
+
202
+ # We configure the user class
203
+ Strongbolt::Configuration.user_class = 'UserWithAbilities'
204
+ end
205
+ after { undefine_model "UserWithAbilities" }
206
+
207
+ let(:user) { UserWithAbilities.new }
208
+
209
+ it "should set the current user" do
210
+ Strongbolt.current_user = user
211
+ expect(Strongbolt.current_user).to eq user
212
+ expect(Grant::User.current_user).to eq user
213
+ end
214
+
215
+ end # End when User class has Abilities
216
+
217
+ context "when the user model is the base class of a STI" do
218
+ before do
219
+ define_model "BaseUser" do
220
+ self.table_name = 'users'
221
+ end
222
+ define "UserWithSTI", BaseUser do
223
+ end
224
+ Strongbolt::Configuration.user_class = 'BaseUser'
225
+ end
226
+
227
+ let(:user) { UserWithSTI.new }
228
+
229
+ it "should allow setting as user a subclass" do
230
+ Strongbolt.current_user = user
231
+ expect(Strongbolt.current_user).to eq user
232
+ end
233
+ end #/ end when user model is the base class of a STI
234
+
235
+ context "when the user model is a subclass of a STI" do
236
+ before do
237
+ define_model "BaseUser" do
238
+ self.table_name = 'users'
239
+ end
240
+ define "UserWithSTI", BaseUser do
241
+ end
242
+ Strongbolt::Configuration.user_class = "UserWithSTI"
243
+ end
244
+
245
+ let(:user) { UserWithSTI.new }
246
+
247
+ it "should allow setting as user a subclass" do
248
+ Strongbolt.current_user = user
249
+ expect(Strongbolt.current_user).to eq user
250
+ end
251
+
252
+ it "should not allos the base class" do
253
+ expect do
254
+ Strongbolt.current_user = BaseUser.new
255
+ end.to raise_error Strongbolt::WrongUserClass
256
+ end
257
+ end #/ end when user model is the base class of a STI
258
+
259
+ end # End when user given is the right class
260
+
261
+ context "when the model isn't from the user class" do
262
+
263
+ it "should raise error" do
264
+ Strongbolt::Configuration.user_class = 'User'
265
+ expect do
266
+ Strongbolt.current_user = Model.new
267
+ end.to raise_error Strongbolt::WrongUserClass
268
+ end
269
+
270
+ end
271
+
272
+ end
273
+
274
+ end
@@ -0,0 +1,11 @@
1
+ module ControllerMacros
2
+
3
+ def login_user
4
+ before(:each) do
5
+ @user = Fabricate :user
6
+ sign_in @user
7
+ end
8
+ let(:current_user) { @user }
9
+ end
10
+
11
+ end
@@ -0,0 +1,134 @@
1
+ require 'active_support/core_ext'
2
+ require 'active_record'
3
+
4
+ tmpdir = File.join(File.dirname(__FILE__), '..', '..', 'tmp')
5
+ FileUtils.mkdir(tmpdir) unless File.exist?(tmpdir)
6
+ test_db = File.join(tmpdir, 'test.db')
7
+
8
+ connection_spec = {
9
+ :adapter => 'sqlite3',
10
+ :database => test_db
11
+ }
12
+
13
+ # Delete any existing instance of the test database
14
+ FileUtils.rm test_db, :force => true
15
+
16
+ # Create a new test database
17
+ ActiveRecord::Base.establish_connection(connection_spec)
18
+
19
+ # Models used during the tests
20
+
21
+ class TestsMigrations < ActiveRecord::Migration
22
+ def change
23
+ create_table :users, :force => true do |t|
24
+ t.string :username
25
+
26
+ t.timestamps
27
+ end
28
+
29
+ create_table :models, :force => true do |t|
30
+ t.string :name
31
+ t.string :value
32
+ t.integer :user_id
33
+ t.integer :parent_id
34
+
35
+ t.timestamps
36
+ end
37
+
38
+ create_table :child_models, :force => true do |t|
39
+ t.integer :model_id
40
+ t.string :model_type
41
+ t.integer :parent_id
42
+
43
+ t.timestamps
44
+ end
45
+
46
+ create_table :unowned_models, :force => true do |t|
47
+ t.string :name
48
+ t.string :value
49
+
50
+ t.timestamps
51
+ end
52
+
53
+ create_table :model_models, :force => true do |t|
54
+ t.integer :parent_id
55
+ t.integer :child_id
56
+ end
57
+
58
+ create_table :strongbolt_capabilities, :force => true do |t|
59
+ t.string :name
60
+ t.string :description
61
+ t.string :model
62
+ t.string :action
63
+ t.string :attr
64
+ t.boolean :require_ownership, :default => false, :null => false
65
+ t.boolean :require_tenant_access, :default => true, :null => false
66
+
67
+ t.timestamps
68
+ end
69
+
70
+ create_table :strongbolt_roles, :force => true do |t|
71
+ t.string :name
72
+ t.integer :parent_id
73
+ t.integer :lft
74
+ t.integer :rgt
75
+ t.string :description
76
+
77
+ t.timestamps
78
+ end
79
+
80
+ create_table :strongbolt_user_groups, :force => true do |t|
81
+ t.string :name
82
+ t.text :description
83
+
84
+ t.timestamps
85
+ end
86
+
87
+ create_table :strongbolt_user_groups_users, :force => true do |t|
88
+ t.integer :user_group_id
89
+ t.integer :user_id
90
+ end
91
+
92
+ create_table :strongbolt_roles_user_groups, :force => true do |t|
93
+ t.integer :user_group_id
94
+ t.integer :role_id
95
+ end
96
+
97
+ create_table :strongbolt_capabilities_roles, :force => true do |t|
98
+ t.integer :role_id
99
+ t.integer :capability_id
100
+ end
101
+
102
+ create_table :strongbolt_users_tenants, :force => true do |t|
103
+ t.integer :user_id
104
+ t.integer :tenant_id
105
+ t.string :type
106
+ end
107
+
108
+ # Indexes
109
+ add_index :strongbolt_roles, :parent_id
110
+ add_index :strongbolt_roles, :lft
111
+ add_index :strongbolt_roles, :rgt
112
+
113
+ add_index :strongbolt_user_groups_users, :user_group_id
114
+ add_index :strongbolt_user_groups_users, :user_id
115
+
116
+ add_index :strongbolt_roles_user_groups, :user_group_id
117
+ add_index :strongbolt_roles_user_groups, :role_id
118
+
119
+ add_index :strongbolt_capabilities_roles, :role_id
120
+ add_index :strongbolt_capabilities_roles, :capability_id
121
+
122
+ add_index :strongbolt_users_tenants, :user_id
123
+ add_index :strongbolt_users_tenants, :tenant_id
124
+ add_index :strongbolt_users_tenants, :type
125
+ add_index :strongbolt_users_tenants, [:tenant_id, :type]
126
+ end
127
+ end
128
+
129
+ class User < ActiveRecord::Base; end
130
+ class Model < ActiveRecord::Base; end
131
+ class UnownedModel < ActiveRecord::Base; end
132
+
133
+
134
+