strongbolt 0.3.12 → 0.3.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +56 -0
  3. data/.rubocop_todo.yml +91 -0
  4. data/Gemfile +1 -1
  5. data/Gemfile.lock +18 -2
  6. data/Rakefile +1 -1
  7. data/app/controllers/strongbolt/capabilities_controller.rb +36 -45
  8. data/app/controllers/strongbolt/roles_controller.rb +39 -47
  9. data/app/controllers/strongbolt/security_controller.rb +2 -3
  10. data/app/controllers/strongbolt/user_groups_controller.rb +48 -54
  11. data/app/controllers/strongbolt/user_groups_users_controller.rb +2 -4
  12. data/app/controllers/strongbolt_controller.rb +1 -1
  13. data/circle.yml +13 -0
  14. data/lib/generators/strongbolt/fix_generator.rb +5 -6
  15. data/lib/generators/strongbolt/fix_unique_group_members_generator.rb +2 -3
  16. data/lib/generators/strongbolt/indexes_generator.rb +3 -4
  17. data/lib/generators/strongbolt/install_generator.rb +8 -9
  18. data/lib/generators/strongbolt/templates/fix_unique_group_members.rb +1 -1
  19. data/lib/generators/strongbolt/templates/indexes.rb +1 -1
  20. data/lib/generators/strongbolt/templates/migration.rb +11 -12
  21. data/lib/generators/strongbolt/templates/strongbolt.rb +1 -1
  22. data/lib/generators/strongbolt/views_generator.rb +4 -4
  23. data/lib/strongbolt.rb +51 -54
  24. data/lib/strongbolt/base.rb +1 -1
  25. data/lib/strongbolt/bolted.rb +12 -13
  26. data/lib/strongbolt/bolted_controller.rb +46 -57
  27. data/lib/strongbolt/capabilities_role.rb +5 -5
  28. data/lib/strongbolt/capability.rb +32 -31
  29. data/lib/strongbolt/configuration.rb +18 -19
  30. data/lib/strongbolt/controllers/url_helpers.rb +5 -5
  31. data/lib/strongbolt/engine.rb +9 -9
  32. data/lib/strongbolt/errors.rb +4 -4
  33. data/lib/strongbolt/generators/migration.rb +4 -6
  34. data/lib/strongbolt/helpers.rb +5 -7
  35. data/lib/strongbolt/rails/routes.rb +4 -4
  36. data/lib/strongbolt/role.rb +11 -12
  37. data/lib/strongbolt/roles_user_group.rb +5 -5
  38. data/lib/strongbolt/rspec.rb +2 -2
  39. data/lib/strongbolt/rspec/user.rb +13 -15
  40. data/lib/strongbolt/tenantable.rb +78 -80
  41. data/lib/strongbolt/user_abilities.rb +44 -54
  42. data/lib/strongbolt/user_group.rb +8 -10
  43. data/lib/strongbolt/user_groups_user.rb +6 -6
  44. data/lib/strongbolt/version.rb +1 -1
  45. data/lib/tasks/strongbolt_tasks.rake +4 -4
  46. data/spec/controllers/strongbolt/capabilities_controller_spec.rb +28 -45
  47. data/spec/controllers/strongbolt/roles_controller_spec.rb +39 -72
  48. data/spec/controllers/strongbolt/user_groups_controller_spec.rb +34 -65
  49. data/spec/controllers/strongbolt/user_groups_users_controller_spec.rb +11 -19
  50. data/spec/controllers/without_authorization_controller_spec.rb +5 -5
  51. data/spec/dummy/app/controllers/posts_controller.rb +2 -2
  52. data/spec/dummy/app/controllers/test_controller.rb +1 -1
  53. data/spec/dummy/app/controllers/without_authorization_controller.rb +1 -1
  54. data/spec/dummy/bin/rails +1 -1
  55. data/spec/dummy/config.ru +1 -1
  56. data/spec/dummy/config/application.rb +4 -5
  57. data/spec/dummy/config/initializers/cookies_serializer.rb +1 -1
  58. data/spec/dummy/config/initializers/strongbolt.rb +2 -2
  59. data/spec/dummy/config/routes.rb +1 -3
  60. data/spec/dummy/db/migrate/20150630212236_create_strongbolt_tables.rb +9 -10
  61. data/spec/dummy/db/migrate/20150630212251_create_strongbolt_tables_indexes.rb +2 -2
  62. data/spec/dummy/db/migrate/20160531110509_fix_unique_group_members.rb +1 -1
  63. data/spec/fabricators/capability_fabricator.rb +4 -4
  64. data/spec/fabricators/role_fabricator.rb +3 -3
  65. data/spec/fabricators/user_fabricator.rb +2 -2
  66. data/spec/fabricators/user_group_fabricator.rb +3 -3
  67. data/spec/fixtures/application.rb +6 -3
  68. data/spec/fixtures/controllers.rb +1 -1
  69. data/spec/spec_helper.rb +7 -8
  70. data/spec/strongbolt/bolted_controller_spec.rb +110 -208
  71. data/spec/strongbolt/bolted_spec.rb +26 -40
  72. data/spec/strongbolt/capability_spec.rb +72 -86
  73. data/spec/strongbolt/configuration_spec.rb +33 -46
  74. data/spec/strongbolt/controllers/url_helpers_spec.rb +7 -9
  75. data/spec/strongbolt/helpers_spec.rb +14 -16
  76. data/spec/strongbolt/role_spec.rb +32 -35
  77. data/spec/strongbolt/tenantable_spec.rb +88 -86
  78. data/spec/strongbolt/user_abilities_multiple_tenants_spec.rb +29 -34
  79. data/spec/strongbolt/user_abilities_spec.rb +142 -188
  80. data/spec/strongbolt/user_group_spec.rb +14 -14
  81. data/spec/strongbolt/users_tenant_spec.rb +10 -12
  82. data/spec/strongbolt_spec.rb +53 -73
  83. data/spec/support/controller_macros.rb +1 -3
  84. data/spec/support/db_setup.rb +31 -25
  85. data/spec/support/helpers.rb +12 -12
  86. data/spec/support/transactional_specs.rb +1 -3
  87. data/strongbolt.gemspec +14 -12
  88. metadata +20 -3
@@ -1,9 +1,9 @@
1
1
  module Helpers
2
- def without_grant &block
3
- Grant::Status.without_grant &block
2
+ def without_grant(&block)
3
+ Grant::Status.without_grant(&block)
4
4
  end
5
5
 
6
- def define name, klass = ActiveRecord::Base, &blk
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 &blk unless blk.nil?
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 name, &blk
20
+ def define_model(name, &blk)
21
21
  define name, ActiveRecord::Base, &blk
22
22
  end
23
23
 
24
- def define_controller name, &blk
24
+ def define_controller(name, &blk)
25
25
  define name, ActionController::Base, &blk
26
26
  end
27
27
 
28
- def undefine_model *names
29
- undefine *names
28
+ def undefine_model(*names)
29
+ undefine(*names)
30
30
  end
31
31
 
32
- def undefine *names
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 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
@@ -1,5 +1,4 @@
1
1
  module TransactionalSpecs
2
-
3
2
  def self.included(base)
4
3
  base.class_eval do
5
4
  around(:each) do |spec|
@@ -13,5 +12,4 @@ module TransactionalSpecs
13
12
  end
14
13
  end
15
14
  end
16
-
17
- end
15
+ end
@@ -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 = "strongbolt"
8
+ spec.name = 'strongbolt'
8
9
  spec.version = Strongbolt::VERSION
9
- spec.authors = ["Thomas Césaré-Herriau", "Chris Frommann"]
10
- spec.email = ["thomas.cesareherriau@gmail.com", "chris@amg.tv"]
11
- spec.summary = "RBAC Framework for model-level authorization"
12
- spec.description = "Use model-level authorization with a very granular roles and permissions definition."
13
- spec.homepage = "http://github.com/AnalyticsMediaGroup/strongbolt"
14
- spec.license = "MIT"
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 = ["lib"]
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 "rails", "~> 4.1.0"
26
- spec.add_development_dependency "bundler"
27
- spec.add_development_dependency "rake"
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.12
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-05-31 00:00:00.000000000 Z
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.8
375
+ rubygems_version: 2.6.12
359
376
  signing_key:
360
377
  specification_version: 4
361
378
  summary: RBAC Framework for model-level authorization