cancancan 1.11.0 → 2.3.0

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 (70) hide show
  1. checksums.yaml +5 -5
  2. data/cancancan.gemspec +15 -19
  3. data/lib/cancan/ability/actions.rb +91 -0
  4. data/lib/cancan/ability/rules.rb +85 -0
  5. data/lib/cancan/ability.rb +74 -136
  6. data/lib/cancan/conditions_matcher.rb +93 -0
  7. data/lib/cancan/controller_additions.rb +34 -40
  8. data/lib/cancan/controller_resource.rb +47 -212
  9. data/lib/cancan/controller_resource_builder.rb +24 -0
  10. data/lib/cancan/controller_resource_finder.rb +40 -0
  11. data/lib/cancan/controller_resource_loader.rb +116 -0
  12. data/lib/cancan/controller_resource_name_finder.rb +21 -0
  13. data/lib/cancan/controller_resource_sanitizer.rb +30 -0
  14. data/lib/cancan/exceptions.rb +7 -3
  15. data/lib/cancan/matchers.rb +12 -3
  16. data/lib/cancan/model_adapters/abstract_adapter.rb +8 -8
  17. data/lib/cancan/model_adapters/active_record_4_adapter.rb +33 -10
  18. data/lib/cancan/model_adapters/active_record_5_adapter.rb +70 -0
  19. data/lib/cancan/model_adapters/active_record_adapter.rb +41 -81
  20. data/lib/cancan/model_adapters/can_can/model_adapters/active_record_adapter/joins.rb +39 -0
  21. data/lib/cancan/model_adapters/conditions_extractor.rb +75 -0
  22. data/lib/cancan/model_additions.rb +0 -1
  23. data/lib/cancan/rule.rb +36 -92
  24. data/lib/cancan/rules_compressor.rb +20 -0
  25. data/lib/cancan/version.rb +1 -1
  26. data/lib/cancan.rb +5 -12
  27. data/lib/generators/cancan/ability/ability_generator.rb +1 -1
  28. metadata +54 -65
  29. data/.gitignore +0 -15
  30. data/.rspec +0 -1
  31. data/.travis.yml +0 -55
  32. data/Appraisals +0 -136
  33. data/CHANGELOG.rdoc +0 -503
  34. data/CONTRIBUTING.md +0 -23
  35. data/Gemfile +0 -3
  36. data/LICENSE +0 -22
  37. data/README.md +0 -188
  38. data/Rakefile +0 -9
  39. data/gemfiles/activerecord_3.0.gemfile +0 -18
  40. data/gemfiles/activerecord_3.1.gemfile +0 -20
  41. data/gemfiles/activerecord_3.2.gemfile +0 -20
  42. data/gemfiles/activerecord_4.0.gemfile +0 -17
  43. data/gemfiles/activerecord_4.1.gemfile +0 -17
  44. data/gemfiles/activerecord_4.2.gemfile +0 -18
  45. data/gemfiles/datamapper_1.x.gemfile +0 -14
  46. data/gemfiles/mongoid_2.x.gemfile +0 -20
  47. data/gemfiles/sequel_3.x.gemfile +0 -20
  48. data/lib/cancan/inherited_resource.rb +0 -20
  49. data/lib/cancan/model_adapters/active_record_3_adapter.rb +0 -47
  50. data/lib/cancan/model_adapters/data_mapper_adapter.rb +0 -34
  51. data/lib/cancan/model_adapters/mongoid_adapter.rb +0 -54
  52. data/lib/cancan/model_adapters/sequel_adapter.rb +0 -87
  53. data/spec/README.rdoc +0 -27
  54. data/spec/cancan/ability_spec.rb +0 -487
  55. data/spec/cancan/controller_additions_spec.rb +0 -141
  56. data/spec/cancan/controller_resource_spec.rb +0 -632
  57. data/spec/cancan/exceptions_spec.rb +0 -58
  58. data/spec/cancan/inherited_resource_spec.rb +0 -71
  59. data/spec/cancan/matchers_spec.rb +0 -29
  60. data/spec/cancan/model_adapters/active_record_4_adapter_spec.rb +0 -85
  61. data/spec/cancan/model_adapters/active_record_adapter_spec.rb +0 -446
  62. data/spec/cancan/model_adapters/data_mapper_adapter_spec.rb +0 -119
  63. data/spec/cancan/model_adapters/default_adapter_spec.rb +0 -7
  64. data/spec/cancan/model_adapters/mongoid_adapter_spec.rb +0 -227
  65. data/spec/cancan/model_adapters/sequel_adapter_spec.rb +0 -132
  66. data/spec/cancan/rule_spec.rb +0 -52
  67. data/spec/matchers.rb +0 -13
  68. data/spec/spec.opts +0 -2
  69. data/spec/spec_helper.rb +0 -28
  70. data/spec/support/ability.rb +0 -7
@@ -0,0 +1,75 @@
1
+ # this class is responsible of converting the hash of conditions
2
+ # in "where conditions" to generate the sql query
3
+ # it consists of a names_cache that helps calculating the next name given to the association
4
+ # it tries to reflect the bahavior of ActiveRecord when generating aliases for tables.
5
+ module CanCan
6
+ module ModelAdapters
7
+ class ConditionsExtractor
8
+ def initialize(model_class)
9
+ @names_cache = { model_class.table_name => [] }.with_indifferent_access
10
+ @root_model_class = model_class
11
+ end
12
+
13
+ def tableize_conditions(conditions, model_class = @root_model_class, path_to_key = 0)
14
+ return conditions unless conditions.is_a? Hash
15
+ conditions.each_with_object({}) do |(key, value), result_hash|
16
+ if value.is_a? Hash
17
+ result_hash.merge!(calculate_result_hash(key, model_class, path_to_key, result_hash, value))
18
+ else
19
+ result_hash[key] = value
20
+ end
21
+ result_hash
22
+ end
23
+ end
24
+
25
+ private
26
+
27
+ def calculate_result_hash(key, model_class, path_to_key, result_hash, value)
28
+ reflection = model_class.reflect_on_association(key)
29
+ unless reflection
30
+ raise WrongAssociationName, "association #{key} not defined in model #{model_class.name}"
31
+ end
32
+ nested_resulted = calculate_nested(model_class, result_hash, key, value.dup, path_to_key)
33
+ association_class = reflection.klass.name.constantize
34
+ tableize_conditions(nested_resulted, association_class, "#{path_to_key}_#{key}")
35
+ end
36
+
37
+ def calculate_nested(model_class, result_hash, relation_name, value, path_to_key)
38
+ value.each_with_object({}) do |(k, v), nested|
39
+ if v.is_a? Hash
40
+ value.delete(k)
41
+ nested[k] = v
42
+ else
43
+ table_alias = generate_table_alias(model_class, relation_name, path_to_key)
44
+ result_hash[table_alias] = value
45
+ end
46
+ nested
47
+ end
48
+ end
49
+
50
+ def generate_table_alias(model_class, relation_name, path_to_key)
51
+ table_alias = model_class.reflect_on_association(relation_name).table_name.to_sym
52
+
53
+ if alredy_used?(table_alias, relation_name, path_to_key)
54
+ table_alias = "#{relation_name.to_s.pluralize}_#{model_class.table_name}".to_sym
55
+
56
+ index = 1
57
+ while alredy_used?(table_alias, relation_name, path_to_key)
58
+ table_alias = "#{table_alias}_#{index += 1}".to_sym
59
+ end
60
+ end
61
+ add_to_cache(table_alias, relation_name, path_to_key)
62
+ end
63
+
64
+ def alredy_used?(table_alias, relation_name, path_to_key)
65
+ @names_cache[table_alias].try(:exclude?, "#{path_to_key}_#{relation_name}")
66
+ end
67
+
68
+ def add_to_cache(table_alias, relation_name, path_to_key)
69
+ @names_cache[table_alias] ||= []
70
+ @names_cache[table_alias] << "#{path_to_key}_#{relation_name}"
71
+ table_alias
72
+ end
73
+ end
74
+ end
75
+ end
@@ -1,5 +1,4 @@
1
1
  module CanCan
2
-
3
2
  # This module adds the accessible_by class method to a model. It is included in the model adapters.
4
3
  module ModelAdditions
5
4
  module ClassMethods
data/lib/cancan/rule.rb CHANGED
@@ -1,8 +1,10 @@
1
+ require_relative 'conditions_matcher.rb'
1
2
  module CanCan
2
3
  # This class is used internally and should only be called through Ability.
3
4
  # it holds the information about a "can" call made on Ability and provides
4
5
  # helpful methods to determine permission checking and conditions hash generation.
5
6
  class Rule # :nodoc:
7
+ include ConditionsMatcher
6
8
  attr_reader :base_behavior, :subjects, :actions, :conditions
7
9
  attr_writer :expanded_actions
8
10
 
@@ -11,77 +13,70 @@ module CanCan
11
13
  # and subject respectively (such as :read, @project). The third argument is a hash
12
14
  # of conditions and the last one is the block passed to the "can" call.
13
15
  def initialize(base_behavior, action, subject, conditions, block)
14
- raise Error, "You are not able to supply a block with a hash of conditions in #{action} #{subject} ability. Use either one." if conditions.kind_of?(Hash) && !block.nil?
16
+ both_block_and_hash_error = 'You are not able to supply a block with a hash of conditions in '\
17
+ "#{action} #{subject} ability. Use either one."
18
+ raise Error, both_block_and_hash_error if conditions.is_a?(Hash) && block
15
19
  @match_all = action.nil? && subject.nil?
16
20
  @base_behavior = base_behavior
17
- @actions = [action].flatten
18
- @subjects = [subject].flatten
21
+ @actions = Array(action)
22
+ @subjects = Array(subject)
19
23
  @conditions = conditions || {}
20
24
  @block = block
21
25
  end
22
26
 
27
+ def can_rule?
28
+ base_behavior
29
+ end
30
+
31
+ def cannot_catch_all?
32
+ !can_rule? && catch_all?
33
+ end
34
+
35
+ def catch_all?
36
+ [nil, false, [], {}, '', ' '].include? @conditions
37
+ end
38
+
23
39
  # Matches both the subject and action, not necessarily the conditions
24
40
  def relevant?(action, subject)
25
41
  subject = subject.values.first if subject.class == Hash
26
42
  @match_all || (matches_action?(action) && matches_subject?(subject))
27
43
  end
28
44
 
29
- # Matches the block or conditions hash
30
- def matches_conditions?(action, subject, extra_args)
31
- if @match_all
32
- call_block_with_all(action, subject, extra_args)
33
- elsif @block && !subject_class?(subject)
34
- @block.call(subject, *extra_args)
35
- elsif @conditions.kind_of?(Hash) && subject.class == Hash
36
- nested_subject_matches_conditions?(subject)
37
- elsif @conditions.kind_of?(Hash) && !subject_class?(subject)
38
- matches_conditions_hash?(subject)
39
- else
40
- # Don't stop at "cannot" definitions when there are conditions.
41
- conditions_empty? ? true : @base_behavior
42
- end
43
- end
44
-
45
45
  def only_block?
46
- conditions_empty? && !@block.nil?
46
+ conditions_empty? && @block
47
47
  end
48
48
 
49
49
  def only_raw_sql?
50
- @block.nil? && !conditions_empty? && !@conditions.kind_of?(Hash)
51
- end
52
-
53
- def conditions_empty?
54
- @conditions == {} || @conditions.nil?
50
+ @block.nil? && !conditions_empty? && !@conditions.is_a?(Hash)
55
51
  end
56
52
 
57
53
  def unmergeable?
58
54
  @conditions.respond_to?(:keys) && @conditions.present? &&
59
- (!@conditions.keys.first.kind_of? Symbol)
55
+ (!@conditions.keys.first.is_a? Symbol)
60
56
  end
61
57
 
62
58
  def associations_hash(conditions = @conditions)
63
59
  hash = {}
64
- conditions.map do |name, value|
65
- hash[name] = associations_hash(value) if value.kind_of? Hash
66
- end if conditions.kind_of? Hash
60
+ if conditions.is_a? Hash
61
+ conditions.map do |name, value|
62
+ hash[name] = associations_hash(value) if value.is_a? Hash
63
+ end
64
+ end
67
65
  hash
68
66
  end
69
67
 
70
68
  def attributes_from_conditions
71
69
  attributes = {}
72
- @conditions.each do |key, value|
73
- attributes[key] = value unless [Array, Range, Hash].include? value.class
74
- end if @conditions.kind_of? Hash
70
+ if @conditions.is_a? Hash
71
+ @conditions.each do |key, value|
72
+ attributes[key] = value unless [Array, Range, Hash].include? value.class
73
+ end
74
+ end
75
75
  attributes
76
76
  end
77
77
 
78
78
  private
79
79
 
80
- def subject_class?(subject)
81
- klass = (subject.kind_of?(Hash) ? subject.values.first : subject).class
82
- klass == Class || klass == Module
83
- end
84
-
85
80
  def matches_action?(action)
86
81
  @expanded_actions.include?(:manage) || @expanded_actions.include?(action)
87
82
  end
@@ -91,61 +86,10 @@ module CanCan
91
86
  end
92
87
 
93
88
  def matches_subject_class?(subject)
94
- @subjects.any? { |sub| sub.kind_of?(Module) && (subject.kind_of?(sub) || subject.class.to_s == sub.to_s || subject.kind_of?(Module) && subject.ancestors.include?(sub)) }
95
- end
96
-
97
- # Checks if the given subject matches the given conditions hash.
98
- # This behavior can be overriden by a model adapter by defining two class methods:
99
- # override_matching_for_conditions?(subject, conditions) and
100
- # matches_conditions_hash?(subject, conditions)
101
- def matches_conditions_hash?(subject, conditions = @conditions)
102
- return true if conditions.empty?
103
- adapter = model_adapter(subject)
104
-
105
- if adapter.override_conditions_hash_matching?(subject, conditions)
106
- return adapter.matches_conditions_hash?(subject, conditions)
107
- end
108
-
109
- conditions.all? do |name, value|
110
- if adapter.override_condition_matching?(subject, name, value)
111
- return adapter.matches_condition?(subject, name, value)
112
- end
113
-
114
- condition_match?(subject.send(name), value)
115
- end
116
- end
117
-
118
- def nested_subject_matches_conditions?(subject_hash)
119
- parent, child = subject_hash.first
120
- matches_conditions_hash?(parent, @conditions[parent.class.name.downcase.to_sym] || {})
121
- end
122
-
123
- def call_block_with_all(action, subject, extra_args)
124
- if subject.class == Class
125
- @block.call(action, subject, nil, *extra_args)
126
- else
127
- @block.call(action, subject.class, subject, *extra_args)
128
- end
129
- end
130
-
131
- def model_adapter(subject)
132
- CanCan::ModelAdapters::AbstractAdapter.adapter_class(subject_class?(subject) ? subject : subject.class)
133
- end
134
-
135
- def condition_match?(attribute, value)
136
- case value
137
- when Hash then hash_condition_match?(attribute, value)
138
- when String then attribute == value
139
- when Enumerable then value.include?(attribute)
140
- else attribute == value
141
- end
142
- end
143
-
144
- def hash_condition_match?(attribute, value)
145
- if attribute.kind_of?(Array) || (defined?(ActiveRecord) && attribute.kind_of?(ActiveRecord::Relation))
146
- attribute.any? { |element| matches_conditions_hash?(element, value) }
147
- else
148
- !attribute.nil? && matches_conditions_hash?(attribute, value)
89
+ @subjects.any? do |sub|
90
+ sub.is_a?(Module) && (subject.is_a?(sub) ||
91
+ subject.class.to_s == sub.to_s ||
92
+ (subject.is_a?(Module) && subject.ancestors.include?(sub)))
149
93
  end
150
94
  end
151
95
  end
@@ -0,0 +1,20 @@
1
+ require_relative 'conditions_matcher.rb'
2
+ module CanCan
3
+ class RulesCompressor
4
+ attr_reader :initial_rules, :rules_collapsed
5
+
6
+ def initialize(rules)
7
+ @initial_rules = rules
8
+ @rules_collapsed = compress(@initial_rules)
9
+ end
10
+
11
+ def compress(array)
12
+ idx = array.rindex(&:catch_all?)
13
+ return array unless idx
14
+ value = array[idx]
15
+ array[idx..-1]
16
+ .drop_while { |n| n.base_behavior == value.base_behavior }
17
+ .tap { |a| a.unshift(value) unless value.cannot_catch_all? }
18
+ end
19
+ end
20
+ end
@@ -1,3 +1,3 @@
1
1
  module CanCan
2
- VERSION = "1.11.0"
2
+ VERSION = '2.3.0'.freeze
3
3
  end
data/lib/cancan.rb CHANGED
@@ -1,25 +1,18 @@
1
- require "cancan/version"
1
+ require 'cancan/version'
2
2
  require 'cancan/ability'
3
3
  require 'cancan/rule'
4
4
  require 'cancan/controller_resource'
5
5
  require 'cancan/controller_additions'
6
6
  require 'cancan/model_additions'
7
7
  require 'cancan/exceptions'
8
- require 'cancan/inherited_resource'
9
8
 
10
9
  require 'cancan/model_adapters/abstract_adapter'
11
10
  require 'cancan/model_adapters/default_adapter'
11
+ require 'cancan/rules_compressor'
12
12
 
13
13
  if defined? ActiveRecord
14
+ require 'cancan/model_adapters/conditions_extractor'
14
15
  require 'cancan/model_adapters/active_record_adapter'
15
- if ActiveRecord.respond_to?(:version) &&
16
- ActiveRecord.version >= Gem::Version.new("4")
17
- require 'cancan/model_adapters/active_record_4_adapter'
18
- else
19
- require 'cancan/model_adapters/active_record_3_adapter'
20
- end
16
+ require 'cancan/model_adapters/active_record_4_adapter'
17
+ require 'cancan/model_adapters/active_record_5_adapter'
21
18
  end
22
-
23
- require 'cancan/model_adapters/data_mapper_adapter' if defined? DataMapper
24
- require 'cancan/model_adapters/mongoid_adapter' if defined?(Mongoid) && defined?(Mongoid::Document)
25
- require 'cancan/model_adapters/sequel_adapter' if defined? Sequel
@@ -4,7 +4,7 @@ module Cancan
4
4
  source_root File.expand_path('../templates', __FILE__)
5
5
 
6
6
  def generate_ability
7
- copy_file "ability.rb", "app/models/ability.rb"
7
+ copy_file 'ability.rb', 'app/models/ability.rb'
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,15 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cancancan
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
+ - Alessandro Rodi (Renuo AG)
7
8
  - Bryan Rite
8
9
  - Ryan Bates
10
+ - Richard Wilson
9
11
  autorequire:
10
12
  bindir: bin
11
13
  cert_chain: []
12
- date: 2015-06-16 00:00:00.000000000 Z
14
+ date: 2018-09-16 00:00:00.000000000 Z
13
15
  dependencies:
14
16
  - !ruby/object:Gem::Dependency
15
17
  name: bundler
@@ -26,129 +28,117 @@ dependencies:
26
28
  - !ruby/object:Gem::Version
27
29
  version: '1.3'
28
30
  - !ruby/object:Gem::Dependency
29
- name: rake
31
+ name: rubocop
30
32
  requirement: !ruby/object:Gem::Requirement
31
33
  requirements:
32
34
  - - "~>"
33
35
  - !ruby/object:Gem::Version
34
- version: 10.1.1
36
+ version: 0.48.1
35
37
  type: :development
36
38
  prerelease: false
37
39
  version_requirements: !ruby/object:Gem::Requirement
38
40
  requirements:
39
41
  - - "~>"
40
42
  - !ruby/object:Gem::Version
41
- version: 10.1.1
43
+ version: 0.48.1
42
44
  - !ruby/object:Gem::Dependency
43
- name: rspec
45
+ name: rake
44
46
  requirement: !ruby/object:Gem::Requirement
45
47
  requirements:
46
48
  - - "~>"
47
49
  - !ruby/object:Gem::Version
48
- version: 3.0.0
50
+ version: '10.1'
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 10.1.1
49
54
  type: :development
50
55
  prerelease: false
51
56
  version_requirements: !ruby/object:Gem::Requirement
52
57
  requirements:
53
58
  - - "~>"
54
59
  - !ruby/object:Gem::Version
55
- version: 3.0.0
60
+ version: '10.1'
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: 10.1.1
56
64
  - !ruby/object:Gem::Dependency
57
- name: appraisal
65
+ name: rspec
58
66
  requirement: !ruby/object:Gem::Requirement
59
67
  requirements:
68
+ - - "~>"
69
+ - !ruby/object:Gem::Version
70
+ version: '3.2'
60
71
  - - ">="
61
72
  - !ruby/object:Gem::Version
62
- version: 1.0.0
73
+ version: 3.2.0
63
74
  type: :development
64
75
  prerelease: false
65
76
  version_requirements: !ruby/object:Gem::Requirement
66
77
  requirements:
78
+ - - "~>"
79
+ - !ruby/object:Gem::Version
80
+ version: '3.2'
67
81
  - - ">="
68
82
  - !ruby/object:Gem::Version
69
- version: 1.0.0
83
+ version: 3.2.0
70
84
  - !ruby/object:Gem::Dependency
71
- name: pry
85
+ name: appraisal
72
86
  requirement: !ruby/object:Gem::Requirement
73
87
  requirements:
74
88
  - - "~>"
75
89
  - !ruby/object:Gem::Version
76
- version: 0.10.0
90
+ version: '2.0'
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: 2.0.0
77
94
  type: :development
78
95
  prerelease: false
79
96
  version_requirements: !ruby/object:Gem::Requirement
80
97
  requirements:
81
98
  - - "~>"
82
99
  - !ruby/object:Gem::Version
83
- version: 0.10.0
84
- description: Continuation of the simple authorization solution for Rails which is
85
- decoupled from user roles. All permissions are stored in a single location.
86
- email: bryan@bryanrite.com
100
+ version: '2.0'
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: 2.0.0
104
+ description: Simple authorization solution for Rails. All permissions are stored in
105
+ a single location.
106
+ email: alessandro.rodi@renuo.ch
87
107
  executables: []
88
108
  extensions: []
89
109
  extra_rdoc_files: []
90
110
  files:
91
- - ".gitignore"
92
- - ".rspec"
93
- - ".travis.yml"
94
- - Appraisals
95
- - CHANGELOG.rdoc
96
- - CONTRIBUTING.md
97
- - Gemfile
98
- - LICENSE
99
- - README.md
100
- - Rakefile
101
111
  - cancancan.gemspec
102
- - gemfiles/activerecord_3.0.gemfile
103
- - gemfiles/activerecord_3.1.gemfile
104
- - gemfiles/activerecord_3.2.gemfile
105
- - gemfiles/activerecord_4.0.gemfile
106
- - gemfiles/activerecord_4.1.gemfile
107
- - gemfiles/activerecord_4.2.gemfile
108
- - gemfiles/datamapper_1.x.gemfile
109
- - gemfiles/mongoid_2.x.gemfile
110
- - gemfiles/sequel_3.x.gemfile
111
112
  - init.rb
112
113
  - lib/cancan.rb
113
114
  - lib/cancan/ability.rb
115
+ - lib/cancan/ability/actions.rb
116
+ - lib/cancan/ability/rules.rb
117
+ - lib/cancan/conditions_matcher.rb
114
118
  - lib/cancan/controller_additions.rb
115
119
  - lib/cancan/controller_resource.rb
120
+ - lib/cancan/controller_resource_builder.rb
121
+ - lib/cancan/controller_resource_finder.rb
122
+ - lib/cancan/controller_resource_loader.rb
123
+ - lib/cancan/controller_resource_name_finder.rb
124
+ - lib/cancan/controller_resource_sanitizer.rb
116
125
  - lib/cancan/exceptions.rb
117
- - lib/cancan/inherited_resource.rb
118
126
  - lib/cancan/matchers.rb
119
127
  - lib/cancan/model_adapters/abstract_adapter.rb
120
- - lib/cancan/model_adapters/active_record_3_adapter.rb
121
128
  - lib/cancan/model_adapters/active_record_4_adapter.rb
129
+ - lib/cancan/model_adapters/active_record_5_adapter.rb
122
130
  - lib/cancan/model_adapters/active_record_adapter.rb
123
- - lib/cancan/model_adapters/data_mapper_adapter.rb
131
+ - lib/cancan/model_adapters/can_can/model_adapters/active_record_adapter/joins.rb
132
+ - lib/cancan/model_adapters/conditions_extractor.rb
124
133
  - lib/cancan/model_adapters/default_adapter.rb
125
- - lib/cancan/model_adapters/mongoid_adapter.rb
126
- - lib/cancan/model_adapters/sequel_adapter.rb
127
134
  - lib/cancan/model_additions.rb
128
135
  - lib/cancan/rule.rb
136
+ - lib/cancan/rules_compressor.rb
129
137
  - lib/cancan/version.rb
130
138
  - lib/cancancan.rb
131
139
  - lib/generators/cancan/ability/USAGE
132
140
  - lib/generators/cancan/ability/ability_generator.rb
133
141
  - lib/generators/cancan/ability/templates/ability.rb
134
- - spec/README.rdoc
135
- - spec/cancan/ability_spec.rb
136
- - spec/cancan/controller_additions_spec.rb
137
- - spec/cancan/controller_resource_spec.rb
138
- - spec/cancan/exceptions_spec.rb
139
- - spec/cancan/inherited_resource_spec.rb
140
- - spec/cancan/matchers_spec.rb
141
- - spec/cancan/model_adapters/active_record_4_adapter_spec.rb
142
- - spec/cancan/model_adapters/active_record_adapter_spec.rb
143
- - spec/cancan/model_adapters/data_mapper_adapter_spec.rb
144
- - spec/cancan/model_adapters/default_adapter_spec.rb
145
- - spec/cancan/model_adapters/mongoid_adapter_spec.rb
146
- - spec/cancan/model_adapters/sequel_adapter_spec.rb
147
- - spec/cancan/rule_spec.rb
148
- - spec/matchers.rb
149
- - spec/spec.opts
150
- - spec/spec_helper.rb
151
- - spec/support/ability.rb
152
142
  homepage: https://github.com/CanCanCommunity/cancancan
153
143
  licenses:
154
144
  - MIT
@@ -161,17 +151,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
161
151
  requirements:
162
152
  - - ">="
163
153
  - !ruby/object:Gem::Version
164
- version: 1.8.7
154
+ version: 2.2.0
165
155
  required_rubygems_version: !ruby/object:Gem::Requirement
166
156
  requirements:
167
157
  - - ">="
168
158
  - !ruby/object:Gem::Version
169
- version: 1.3.4
159
+ version: '0'
170
160
  requirements: []
171
- rubyforge_project: cancancan
172
- rubygems_version: 2.4.5
161
+ rubyforge_project:
162
+ rubygems_version: 2.7.4
173
163
  signing_key:
174
164
  specification_version: 4
175
165
  summary: Simple authorization solution for Rails.
176
- test_files:
177
- - Appraisals
166
+ test_files: []
data/.gitignore DELETED
@@ -1,15 +0,0 @@
1
- .DS_Store
2
- .idea/*
3
- *.swp
4
- **/*.swp
5
- *.gem
6
- .bundle
7
-
8
- gemfiles/*.lock
9
- Gemfile.lock
10
-
11
- .rvmrc
12
- .rbenv-version
13
- .ruby-version
14
- .ruby-gemset
15
- /tmp
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --color
data/.travis.yml DELETED
@@ -1,55 +0,0 @@
1
- rvm:
2
- - 1.8.7
3
- - 1.9.2
4
- - 1.9.3
5
- - 2.0.0
6
- - 2.1.0
7
- - 2.2.0
8
- - ree
9
- - jruby
10
- - rbx
11
- gemfile:
12
- - gemfiles/activerecord_3.0.gemfile
13
- - gemfiles/activerecord_3.1.gemfile
14
- - gemfiles/activerecord_3.2.gemfile
15
- - gemfiles/activerecord_4.0.gemfile
16
- - gemfiles/activerecord_4.1.gemfile
17
- - gemfiles/activerecord_4.2.gemfile
18
- - gemfiles/datamapper_1.x.gemfile
19
- - gemfiles/mongoid_2.x.gemfile
20
- - gemfiles/sequel_3.x.gemfile
21
- services:
22
- - mongodb
23
- matrix:
24
- allow_failures:
25
- - rvm: rbx
26
- - rvm: jruby
27
- gemfile: gemfiles/datamapper_1.x.gemfile
28
- exclude:
29
- - rvm: 1.8.7
30
- gemfile: gemfiles/activerecord_4.0.gemfile
31
- - rvm: 1.8.7
32
- gemfile: gemfiles/activerecord_4.1.gemfile
33
- - rvm: 1.8.7
34
- gemfile: gemfiles/activerecord_4.2.gemfile
35
- - rvm: 1.9.2
36
- gemfile: gemfiles/activerecord_4.0.gemfile
37
- - rvm: 1.9.2
38
- gemfile: gemfiles/activerecord_4.1.gemfile
39
- - rvm: 1.9.2
40
- gemfile: gemfiles/activerecord_4.2.gemfile
41
- - rvm: 2.2.0
42
- gemfile: gemfiles/activerecord_3.0.gemfile
43
- - rvm: 2.2.0
44
- gemfile: gemfiles/activerecord_3.1.gemfile
45
- - rvm: 2.2.0
46
- gemfile: gemfiles/activerecord_3.2.gemfile
47
- - rvm: ree
48
- gemfile: gemfiles/activerecord_4.0.gemfile
49
- - rvm: ree
50
- gemfile: gemfiles/activerecord_4.1.gemfile
51
- - rvm: ree
52
- gemfile: gemfiles/activerecord_4.2.gemfile
53
- notifications:
54
- recipients:
55
- - bryan@bryanrite.com