pundit 1.1.0 → 2.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a2c188098c86ad5a0804044f80219014564501ef
4
- data.tar.gz: 2ab7f79275d9ae66e5d04cf980c11e2c2983a4ef
2
+ SHA256:
3
+ metadata.gz: 82606dec60dec4ddb9086a4d1a71447bda39f9f17fd5e38025937f0fdb7b9b1a
4
+ data.tar.gz: e154a0dadc701871c49687ff843117e590011362be4cf3dfa7bc63ea4e5e698b
5
5
  SHA512:
6
- metadata.gz: 55fbbf71ad514c0cfe4f8933dea59915314f749efa53ab5579f2da9dfcf2b4786343cefa53d3a35e26f4a346776c1c513884595a39561d280b259e6b6fb9b31a
7
- data.tar.gz: bbcf9417801b22deac78afe2d5ea8a268193daf0e011f861006c25b1d0124d1f462aa37d4d38e623b9d438cb29ceb52b250575118e053862b74561795bbdd7a4
6
+ metadata.gz: 0414e7e35eb8e2aa3bac79a75f2d8ae4e45f5cf4152150be239664f620560732990b3547aeac678b50e4b62036ab25c45170f12ca1897c6bf41938589e5ef0bd
7
+ data.tar.gz: 964d660d1f79b36b8ace58452ca0adfef4f5ea68a7436f6373ae248f33cda7f017db5d5c5fbd0efca26fb5ee88a507cf900edc8bd0d7dad89a676cb308bd7bd1
data/.gitignore CHANGED
@@ -2,6 +2,7 @@
2
2
  *.rbc
3
3
  .bundle
4
4
  .config
5
+ .coverage
5
6
  .yardoc
6
7
  Gemfile.lock
7
8
  InstalledFiles
data/.rubocop.yml CHANGED
@@ -1,16 +1,23 @@
1
1
  AllCops:
2
+ TargetRubyVersion: 2.6
2
3
  Exclude:
3
- - "gemfiles/**/*"
4
- - "vendor/**/*"
5
- - "lib/generators/**/*"
4
+ - "lib/generators/**/templates/**/*"
5
+ SuggestExtensions: false
6
+ NewCops: disable
7
+
8
+ Metrics/BlockLength:
9
+ Exclude:
10
+ - "**/*_spec.rb"
6
11
 
7
12
  Metrics/MethodLength:
8
13
  Max: 40
9
14
 
10
15
  Metrics/ModuleLength:
11
16
  Max: 200
17
+ Exclude:
18
+ - "**/*_spec.rb"
12
19
 
13
- Metrics/LineLength:
20
+ Layout/LineLength:
14
21
  Max: 120
15
22
 
16
23
  Metrics/AbcSize:
@@ -22,74 +29,44 @@ Metrics/CyclomaticComplexity:
22
29
  Metrics/PerceivedComplexity:
23
30
  Enabled: false
24
31
 
25
- Style/StructInheritance:
26
- Enabled: false
32
+ Gemspec/RequiredRubyVersion:
33
+ Enabled: false
27
34
 
28
- Style/AlignParameters:
35
+ Layout/ParameterAlignment:
29
36
  EnforcedStyle: with_fixed_indentation
30
37
 
31
- Style/StringLiterals:
32
- EnforcedStyle: double_quotes
33
-
34
- Style/StringLiteralsInInterpolation:
35
- EnforcedStyle: double_quotes
36
-
37
- Style/ClosingParenthesisIndentation:
38
- Enabled: false
39
-
40
- Style/OneLineConditional:
41
- Enabled: false
42
-
43
- Style/AndOr:
44
- Enabled: false
45
-
46
- Style/Not:
47
- Enabled: false
48
-
49
- Documentation:
50
- Enabled: false # TODO: Enable again once we have more docs
51
-
52
- Style/CaseIndentation:
53
- IndentWhenRelativeTo: case
38
+ Layout/CaseIndentation:
39
+ EnforcedStyle: case
54
40
  SupportedStyles:
55
41
  - case
56
42
  - end
57
43
  IndentOneStep: true
58
44
 
45
+ Layout/EndAlignment:
46
+ EnforcedStyleAlignWith: variable
47
+
59
48
  Style/PercentLiteralDelimiters:
60
49
  PreferredDelimiters:
61
50
  '%w': "[]"
62
51
  '%W': "[]"
63
52
 
64
- Style/AccessModifierIndentation:
65
- EnforcedStyle: outdent
66
-
67
- Style/SignalException:
68
- Enabled: false
69
-
70
- Style/IndentationWidth:
71
- Enabled: false
72
-
73
- Style/TrivialAccessors:
74
- ExactNameMatch: true
75
-
76
- Lint/EndAlignment:
77
- AlignWith: variable
78
-
79
- Lint/DefEndAlignment:
80
- Enabled: false
53
+ Style/StringLiterals:
54
+ EnforcedStyle: double_quotes
81
55
 
82
- Lint/HandleExceptions:
83
- Enabled: false
56
+ Style/StringLiteralsInInterpolation:
57
+ EnforcedStyle: double_quotes
84
58
 
85
- Style/SpecialGlobalVars:
59
+ Style/StructInheritance:
86
60
  Enabled: false
87
61
 
88
- Style/TrivialAccessors:
62
+ Style/AndOr:
89
63
  Enabled: false
90
64
 
91
- Style/IndentHash:
65
+ Style/Not:
92
66
  Enabled: false
93
67
 
94
68
  Style/DoubleNegation:
95
69
  Enabled: false
70
+
71
+ Style/Documentation:
72
+ Enabled: false # TODO: Enable again once we have more docs
data/.travis.yml CHANGED
@@ -1,11 +1,26 @@
1
1
  language: ruby
2
- sudo: false
3
- rvm:
4
- - 2.0.0
5
- - 2.1
6
- - 2.2
7
- - jruby-19mode
8
- - rbx-2
9
- env:
10
- - RSPEC_VERSION="<2.99"
11
- - RSPEC_VERSION="~>3.0
2
+ dist: focal
3
+
4
+ matrix:
5
+ include:
6
+ - name: "RuboCop lint on pre-installed Ruby version"
7
+ rvm: 2.7.1 # Pre-installed Ruby version
8
+ before_install:
9
+ - gem install bundler
10
+ script: bundle exec rake rubocop # ONLY lint once, first
11
+ - rvm: 2.6.7
12
+ before_script:
13
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
14
+ - chmod +x ./cc-test-reporter
15
+ - ./cc-test-reporter before-build
16
+ after_script:
17
+ - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
18
+ - rvm: 2.7.3
19
+ - rvm: 3.0.1
20
+ - rvm: 3.1.0
21
+ - rvm: jruby-9.2.17.0
22
+ env:
23
+ - JRUBY_OPTS="--debug"
24
+ - rvm: truffleruby-head
25
+ allow_failures:
26
+ - rvm: truffleruby-head
data/CHANGELOG.md CHANGED
@@ -1,5 +1,87 @@
1
1
  # Pundit
2
2
 
3
+ ## 2.2.0 (2022-02-11)
4
+
5
+ ### Fixed
6
+
7
+ - Using `policy_class` and a namespaced record now passes only the record when instantiating the policy. (#697, #689, #694, #666)
8
+
9
+ ### Changed
10
+
11
+ - Require users to explicitly define Scope#resolve in generated policies (#711, #722)
12
+
13
+ ### Deprecated
14
+
15
+ - Deprecate `include Pundit` in favor of `include Pundit::Authorization` (#621)
16
+
17
+ ## 2.1.1 (2021-08-13)
18
+
19
+ Friday 13th-release!
20
+
21
+ Careful! The bugfix below (#626) could break existing code. If you rely on the
22
+ return value for `authorize` and namespaced policies you might need to do some
23
+ changes.
24
+
25
+ ### Fixed
26
+
27
+ - `.authorize` and `#authorize` return the instance, even for namespaced
28
+ policies (#626)
29
+
30
+ ### Changed
31
+
32
+ - Generate application scope with `protected` attr_readers. (#616)
33
+
34
+ ### Removed
35
+
36
+ - Dropped support for Ruby end-of-life versions: 2.1 and 2.2. (#604)
37
+ - Dropped support for Ruby end-of-life versions: 2.3 (#633)
38
+ - Dropped support for Ruby end-of-life versions: 2.4, 2.5 and JRuby 9.1 (#676)
39
+ - Dropped support for RSpec 2 (#615)
40
+
41
+ ## 2.1.0 (2019-08-14)
42
+
43
+ ### Fixed
44
+
45
+ - Avoid name clashes with the Error class. (#590)
46
+
47
+ ### Changed
48
+
49
+ - Return a safer default NotAuthorizedError message. (#583)
50
+
51
+ ## 2.0.1 (2019-01-18)
52
+
53
+ ### Breaking changes
54
+
55
+ None
56
+
57
+ ### Other changes
58
+
59
+ - Improve exception handling for `#policy_scope` and `#policy_scope!`. (#550)
60
+ - Add `:policy` metadata to RSpec template. (#566)
61
+
62
+ ## 2.0.0 (2018-07-21)
63
+
64
+ No changes since beta1
65
+
66
+ ## 2.0.0.beta1 (2018-07-04)
67
+
68
+ ### Breaking changes
69
+
70
+ - Only pass last element of "namespace array" to policy and scope. (#529)
71
+ - Raise `InvalidConstructorError` if a policy or policy scope with an invalid constructor is called. (#462)
72
+ - Return passed object from `#authorize` method to make chaining possible. (#385)
73
+
74
+ ### Other changes
75
+
76
+ - Add `policy_class` option to `authorize` to be able to override the policy. (#441)
77
+ - Add `policy_scope_class` option to `authorize` to be able to override the policy scope. (#441)
78
+ - Fix `param_key` issue when passed an array. (#529)
79
+ - Allow specification of a `NilClassPolicy`. (#525)
80
+ - Make sure `policy_class` override is called when passed an array. (#475)
81
+
82
+ - Use `action_name` instead of `params[:action]`. (#419)
83
+ - Add `pundit_params_for` method to make it easy to customize params fetching. (#502)
84
+
3
85
  ## 1.1.0 (2016-01-14)
4
86
 
5
87
  - Can retrieve policies via an array of symbols/objects.
data/Gemfile CHANGED
@@ -1,4 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
 
3
- gem "rspec", ENV["RSPEC_VERSION"] unless ENV["RSPEC_VERSION"].to_s.empty?
5
+ ruby RUBY_VERSION
6
+
4
7
  gemspec
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 Jonas Nicklas, Elabs AB
1
+ Copyright (c) 2019 Jonas Nicklas, Varvet AB
2
2
 
3
3
  MIT License
4
4