strongbolt 0.3.12 → 0.3.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +56 -0
- data/.rubocop_todo.yml +91 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +18 -2
- data/Rakefile +1 -1
- data/app/controllers/strongbolt/capabilities_controller.rb +36 -45
- data/app/controllers/strongbolt/roles_controller.rb +39 -47
- data/app/controllers/strongbolt/security_controller.rb +2 -3
- data/app/controllers/strongbolt/user_groups_controller.rb +48 -54
- data/app/controllers/strongbolt/user_groups_users_controller.rb +2 -4
- data/app/controllers/strongbolt_controller.rb +1 -1
- data/circle.yml +13 -0
- data/lib/generators/strongbolt/fix_generator.rb +5 -6
- data/lib/generators/strongbolt/fix_unique_group_members_generator.rb +2 -3
- data/lib/generators/strongbolt/indexes_generator.rb +3 -4
- data/lib/generators/strongbolt/install_generator.rb +8 -9
- data/lib/generators/strongbolt/templates/fix_unique_group_members.rb +1 -1
- data/lib/generators/strongbolt/templates/indexes.rb +1 -1
- data/lib/generators/strongbolt/templates/migration.rb +11 -12
- data/lib/generators/strongbolt/templates/strongbolt.rb +1 -1
- data/lib/generators/strongbolt/views_generator.rb +4 -4
- data/lib/strongbolt.rb +51 -54
- data/lib/strongbolt/base.rb +1 -1
- data/lib/strongbolt/bolted.rb +12 -13
- data/lib/strongbolt/bolted_controller.rb +46 -57
- data/lib/strongbolt/capabilities_role.rb +5 -5
- data/lib/strongbolt/capability.rb +32 -31
- data/lib/strongbolt/configuration.rb +18 -19
- data/lib/strongbolt/controllers/url_helpers.rb +5 -5
- data/lib/strongbolt/engine.rb +9 -9
- data/lib/strongbolt/errors.rb +4 -4
- data/lib/strongbolt/generators/migration.rb +4 -6
- data/lib/strongbolt/helpers.rb +5 -7
- data/lib/strongbolt/rails/routes.rb +4 -4
- data/lib/strongbolt/role.rb +11 -12
- data/lib/strongbolt/roles_user_group.rb +5 -5
- data/lib/strongbolt/rspec.rb +2 -2
- data/lib/strongbolt/rspec/user.rb +13 -15
- data/lib/strongbolt/tenantable.rb +78 -80
- data/lib/strongbolt/user_abilities.rb +44 -54
- data/lib/strongbolt/user_group.rb +8 -10
- data/lib/strongbolt/user_groups_user.rb +6 -6
- data/lib/strongbolt/version.rb +1 -1
- data/lib/tasks/strongbolt_tasks.rake +4 -4
- data/spec/controllers/strongbolt/capabilities_controller_spec.rb +28 -45
- data/spec/controllers/strongbolt/roles_controller_spec.rb +39 -72
- data/spec/controllers/strongbolt/user_groups_controller_spec.rb +34 -65
- data/spec/controllers/strongbolt/user_groups_users_controller_spec.rb +11 -19
- data/spec/controllers/without_authorization_controller_spec.rb +5 -5
- data/spec/dummy/app/controllers/posts_controller.rb +2 -2
- data/spec/dummy/app/controllers/test_controller.rb +1 -1
- data/spec/dummy/app/controllers/without_authorization_controller.rb +1 -1
- data/spec/dummy/bin/rails +1 -1
- data/spec/dummy/config.ru +1 -1
- data/spec/dummy/config/application.rb +4 -5
- data/spec/dummy/config/initializers/cookies_serializer.rb +1 -1
- data/spec/dummy/config/initializers/strongbolt.rb +2 -2
- data/spec/dummy/config/routes.rb +1 -3
- data/spec/dummy/db/migrate/20150630212236_create_strongbolt_tables.rb +9 -10
- data/spec/dummy/db/migrate/20150630212251_create_strongbolt_tables_indexes.rb +2 -2
- data/spec/dummy/db/migrate/20160531110509_fix_unique_group_members.rb +1 -1
- data/spec/fabricators/capability_fabricator.rb +4 -4
- data/spec/fabricators/role_fabricator.rb +3 -3
- data/spec/fabricators/user_fabricator.rb +2 -2
- data/spec/fabricators/user_group_fabricator.rb +3 -3
- data/spec/fixtures/application.rb +6 -3
- data/spec/fixtures/controllers.rb +1 -1
- data/spec/spec_helper.rb +7 -8
- data/spec/strongbolt/bolted_controller_spec.rb +110 -208
- data/spec/strongbolt/bolted_spec.rb +26 -40
- data/spec/strongbolt/capability_spec.rb +72 -86
- data/spec/strongbolt/configuration_spec.rb +33 -46
- data/spec/strongbolt/controllers/url_helpers_spec.rb +7 -9
- data/spec/strongbolt/helpers_spec.rb +14 -16
- data/spec/strongbolt/role_spec.rb +32 -35
- data/spec/strongbolt/tenantable_spec.rb +88 -86
- data/spec/strongbolt/user_abilities_multiple_tenants_spec.rb +29 -34
- data/spec/strongbolt/user_abilities_spec.rb +142 -188
- data/spec/strongbolt/user_group_spec.rb +14 -14
- data/spec/strongbolt/users_tenant_spec.rb +10 -12
- data/spec/strongbolt_spec.rb +53 -73
- data/spec/support/controller_macros.rb +1 -3
- data/spec/support/db_setup.rb +31 -25
- data/spec/support/helpers.rb +12 -12
- data/spec/support/transactional_specs.rb +1 -3
- data/strongbolt.gemspec +14 -12
- metadata +20 -3
data/spec/support/helpers.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
module Helpers
|
2
|
-
def without_grant
|
3
|
-
Grant::Status.without_grant
|
2
|
+
def without_grant(&block)
|
3
|
+
Grant::Status.without_grant(&block)
|
4
4
|
end
|
5
5
|
|
6
|
-
def define
|
6
|
+
def define(name, klass = ActiveRecord::Base, &blk)
|
7
7
|
mod, name = module_by_name(name)
|
8
8
|
begin
|
9
9
|
mod.send :remove_const, name
|
@@ -11,25 +11,25 @@ module Helpers
|
|
11
11
|
ensure
|
12
12
|
mod.send :const_set, name, Class.new(klass)
|
13
13
|
# This ensures the class gets its name before configuring it
|
14
|
-
mod.const_get(name).class_eval
|
14
|
+
mod.const_get(name).class_eval(&blk) unless blk.nil?
|
15
15
|
# Store the right reference in the class cache
|
16
16
|
ActiveSupport::Dependencies.reference mod.const_get(name)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
def define_model
|
20
|
+
def define_model(name, &blk)
|
21
21
|
define name, ActiveRecord::Base, &blk
|
22
22
|
end
|
23
23
|
|
24
|
-
def define_controller
|
24
|
+
def define_controller(name, &blk)
|
25
25
|
define name, ActionController::Base, &blk
|
26
26
|
end
|
27
27
|
|
28
|
-
def undefine_model
|
29
|
-
undefine
|
28
|
+
def undefine_model(*names)
|
29
|
+
undefine(*names)
|
30
30
|
end
|
31
31
|
|
32
|
-
def undefine
|
32
|
+
def undefine(*names)
|
33
33
|
names.each do |name|
|
34
34
|
begin
|
35
35
|
mod, name = module_by_name(name)
|
@@ -41,9 +41,9 @@ module Helpers
|
|
41
41
|
|
42
42
|
private
|
43
43
|
|
44
|
-
def module_by_name
|
44
|
+
def module_by_name(name)
|
45
45
|
base_module = Object
|
46
|
-
splits = name.split(
|
46
|
+
splits = name.split('::')
|
47
47
|
if splits.size > 1
|
48
48
|
splits[0...(splits.size - 1)].each do |module_name|
|
49
49
|
# Get the module if it exists, or create it
|
@@ -59,4 +59,4 @@ module Helpers
|
|
59
59
|
# Returns both module and demodulized name
|
60
60
|
[base_module, splits.last]
|
61
61
|
end
|
62
|
-
end
|
62
|
+
end
|
data/strongbolt.gemspec
CHANGED
@@ -1,34 +1,36 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
|
2
3
|
lib = File.expand_path('../lib', __FILE__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'strongbolt/version'
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
8
|
+
spec.name = 'strongbolt'
|
8
9
|
spec.version = Strongbolt::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
10
|
+
spec.authors = ['Thomas Césaré-Herriau', 'Chris Frommann']
|
11
|
+
spec.email = ['thomas.cesareherriau@gmail.com', 'chris@amg.tv']
|
12
|
+
spec.summary = 'RBAC Framework for model-level authorization'
|
13
|
+
spec.description = 'Use model-level authorization with a very granular roles and permissions definition.'
|
14
|
+
spec.homepage = 'http://github.com/AnalyticsMediaGroup/strongbolt'
|
15
|
+
spec.license = 'MIT'
|
15
16
|
|
16
|
-
spec.files = `git ls-files`.split(
|
17
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
17
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = [
|
20
|
+
spec.require_paths = ['lib']
|
20
21
|
|
21
22
|
spec.add_dependency 'awesome_nested_set', '~> 3.1.0'
|
22
23
|
spec.add_dependency 'grant', '~> 3.0'
|
23
24
|
spec.add_dependency 'simple_form', '~> 3.0'
|
24
25
|
|
25
|
-
spec.add_development_dependency
|
26
|
-
spec.add_development_dependency
|
27
|
-
spec.add_development_dependency
|
26
|
+
spec.add_development_dependency 'rails', '~> 4.1.0'
|
27
|
+
spec.add_development_dependency 'bundler'
|
28
|
+
spec.add_development_dependency 'rake'
|
28
29
|
spec.add_development_dependency 'sqlite3'
|
29
30
|
spec.add_development_dependency 'shoulda-matchers', '~> 2.7.0'
|
30
31
|
spec.add_development_dependency 'fuubar'
|
31
32
|
spec.add_development_dependency 'rspec-rails'
|
32
33
|
spec.add_development_dependency 'fabrication'
|
33
34
|
spec.add_development_dependency 'database_cleaner'
|
35
|
+
spec.add_development_dependency 'rubocop'
|
34
36
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strongbolt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Césaré-Herriau
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-09-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: awesome_nested_set
|
@@ -179,6 +179,20 @@ dependencies:
|
|
179
179
|
- - ">="
|
180
180
|
- !ruby/object:Gem::Version
|
181
181
|
version: '0'
|
182
|
+
- !ruby/object:Gem::Dependency
|
183
|
+
name: rubocop
|
184
|
+
requirement: !ruby/object:Gem::Requirement
|
185
|
+
requirements:
|
186
|
+
- - ">="
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
version: '0'
|
189
|
+
type: :development
|
190
|
+
prerelease: false
|
191
|
+
version_requirements: !ruby/object:Gem::Requirement
|
192
|
+
requirements:
|
193
|
+
- - ">="
|
194
|
+
- !ruby/object:Gem::Version
|
195
|
+
version: '0'
|
182
196
|
description: Use model-level authorization with a very granular roles and permissions
|
183
197
|
definition.
|
184
198
|
email:
|
@@ -191,6 +205,8 @@ files:
|
|
191
205
|
- ".editorconfig"
|
192
206
|
- ".gitignore"
|
193
207
|
- ".rspec"
|
208
|
+
- ".rubocop.yml"
|
209
|
+
- ".rubocop_todo.yml"
|
194
210
|
- ".ruby-gemset"
|
195
211
|
- ".ruby-version"
|
196
212
|
- Gemfile
|
@@ -221,6 +237,7 @@ files:
|
|
221
237
|
- app/views/strongbolt/user_groups/index.html.erb
|
222
238
|
- app/views/strongbolt/user_groups/new.html.erb
|
223
239
|
- app/views/strongbolt/user_groups/show.html.erb
|
240
|
+
- circle.yml
|
224
241
|
- lib/generators/strongbolt/fix_generator.rb
|
225
242
|
- lib/generators/strongbolt/fix_unique_group_members_generator.rb
|
226
243
|
- lib/generators/strongbolt/indexes_generator.rb
|
@@ -355,7 +372,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
355
372
|
version: '0'
|
356
373
|
requirements: []
|
357
374
|
rubyforge_project:
|
358
|
-
rubygems_version: 2.6.
|
375
|
+
rubygems_version: 2.6.12
|
359
376
|
signing_key:
|
360
377
|
specification_version: 4
|
361
378
|
summary: RBAC Framework for model-level authorization
|