action_policy 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c78a946e78ef3409dd89d58e7baebaf387140ebfe2cfe8c03d761109ab08dc57
4
- data.tar.gz: 698fe734b71568ad5ea96e1eda2606459cbaee029aace9082f49baa38608cb2d
3
+ metadata.gz: 1214a9618cb6a1dc99c244664e9c3bb38217c941a1a721f75c55d74bda56407d
4
+ data.tar.gz: fb2466a77823ef0db9cb422430695ae7a2ff448f47d0c39fd968bebc9ee12ddc
5
5
  SHA512:
6
- metadata.gz: 8732afad711b12fad60018e4bb959dddf4ee881d5a6e673d37054928312d1baf0bc1abd80c7b3fc9b354f1ea4eda705dd95779890cf6ba3a0ffe5dd4129bc9c8
7
- data.tar.gz: d4b0f1ee328c97b01a22a039e39c34800fc07d0d8be49dd68aec7925cb90e0bf359c209216410446d4cf5207c59495f9568e7e163c7c753c57a936d980db0058
6
+ metadata.gz: 4d17ebf03ff8c893aa63278fadeeea3c8b151ba8aff4b9fd81cee907eab03db60bfc62503636b742b8e964077c066f77967638b3fd3feebb0240de604a1e8de9
7
+ data.tar.gz: f522c4ade334c607251829e571ea502c8881dd8fb5283be9a0041a7c20370780a499466b1800ced5bce77bacb3e9a39c7dcb8d50c1729d56fc57c8bf0e59cb21
data/.rubocop.yml CHANGED
@@ -26,6 +26,9 @@ Lint/Void:
26
26
  Exclude:
27
27
  - '**/*.md'
28
28
 
29
+ Lint/SplatKeywordArguments:
30
+ Enabled: false
31
+
29
32
  Lint/DuplicateMethods:
30
33
  Exclude:
31
34
  - '**/*.md'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## master
2
2
 
3
+ ## 0.1.3 (2018-05-20)
4
+
5
+ - Fix modules order in `ActionPolicy::Base`. ([@ilyasgaraev][])
6
+
3
7
  ## 0.1.2 (2018-05-09)
4
8
 
5
9
  - [Fix [#6](https://github.com/palkan/action_policy/issues/6)] Fix controller concern to work with API/Metal controllers. ([@palkan][])
@@ -13,3 +17,4 @@
13
17
  - Initial pre-release version. ([@palkan][])
14
18
 
15
19
  [@palkan]: https://github.com/palkan
20
+ [@ilyasgaraev]: https://github.com/ilyasgaraev
data/README.md CHANGED
@@ -1,19 +1,19 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/action_policy.svg)](https://badge.fury.io/rb/action_policy)
2
2
  [![Build Status](https://travis-ci.org/palkan/action_policy.svg?branch=master)](https://travis-ci.org/palkan/action_policy)
3
- [![Documentation](https://img.shields.io/badge/docs-link-brightgreen.svg)](http://actionpolicy.evilmartians.io)
3
+ [![Documentation](https://img.shields.io/badge/docs-link-brightgreen.svg)](https://actionpolicy.evilmartians.io)
4
4
 
5
5
  # ActionPolicy
6
6
 
7
7
  Action Policy is an authorization framework for Ruby and Rails applications.
8
8
 
9
- 📑 [Documentation][]
9
+ 📑 [Documentation][https://actionpolicy.evilmartians.io]
10
10
 
11
11
  <a href="https://evilmartians.com/?utm_source=action_policy">
12
12
  <img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54"></a>
13
13
 
14
14
  ## Resources
15
15
 
16
- - RailsConf, 2018 "Access Denied" talk [[slides](https://speakerdeck.com/palkan/railsconf-2018-access-denied-the-missing-guide-to-authorization-in-rails)]
16
+ - RailsConf, 2018 "Access Denied" talk [[video](https://www.youtube.com/watch?v=NVwx0DARDis), [slides](https://speakerdeck.com/palkan/railsconf-2018-access-denied-the-missing-guide-to-authorization-in-rails)]
17
17
 
18
18
 
19
19
  ## Installation
@@ -27,6 +27,6 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency "minitest", "~> 5.0"
28
28
  spec.add_development_dependency "rake", "~> 10.0"
29
29
  spec.add_development_dependency "rspec", "~> 3.3"
30
- spec.add_development_dependency "rubocop", "~> 0.51"
30
+ spec.add_development_dependency "rubocop", "~> 0.56.0"
31
31
  spec.add_development_dependency "rubocop-md", "~> 0.2"
32
32
  end
data/docs/README.md CHANGED
@@ -40,7 +40,7 @@ It is also worth noting that Action Policy (despite from a _Railsy_ name) is des
40
40
 
41
41
  ## Resources
42
42
 
43
- - RailsConf, 2018 "Access Denied" talk [[slides](https://speakerdeck.com/palkan/railsconf-2018-access-denied-the-missing-guide-to-authorization-in-rails)]
43
+ - RailsConf, 2018 "Access Denied" talk [[video](https://www.youtube.com/watch?v=NVwx0DARDis), [slides](https://speakerdeck.com/palkan/railsconf-2018-access-denied-the-missing-guide-to-authorization-in-rails)]
44
44
 
45
45
  <a href="https://evilmartians.com/?utm_source=action_policy">
46
46
  <img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54"></a>
data/lib/action_policy.rb CHANGED
@@ -28,7 +28,7 @@ module ActionPolicy
28
28
 
29
29
  # Find a policy class for a target
30
30
  def lookup(target, **options)
31
- LookupChain.call(target, **options) ||
31
+ LookupChain.call(target, options) ||
32
32
  raise(NotFound, target)
33
33
  end
34
34
  end
@@ -14,8 +14,8 @@ module ActionPolicy
14
14
 
15
15
  include ActionPolicy::Policy::Core
16
16
  include ActionPolicy::Policy::Authorization
17
- include ActionPolicy::Policy::Reasons
18
17
  include ActionPolicy::Policy::PreCheck
18
+ include ActionPolicy::Policy::Reasons
19
19
  include ActionPolicy::Policy::Aliases
20
20
  include ActionPolicy::Policy::Cache
21
21
  include ActionPolicy::Policy::CachedApply
@@ -32,7 +32,7 @@ module ActionPolicy
32
32
 
33
33
  module InstanceMethods # :nodoc:
34
34
  def policy_for(record:, **opts)
35
- __policy_memoize__(record, **opts) { super(record: record, **opts) }
35
+ __policy_memoize__(record, opts) { super(record: record, **opts) }
36
36
  end
37
37
  end
38
38
 
@@ -8,7 +8,7 @@ module ActionPolicy
8
8
  def policy_for(record:, with: nil, namespace: nil)
9
9
  namespace ||= authorization_namespace
10
10
  policy_class = with || ::ActionPolicy.lookup(record, namespace: namespace)
11
- policy_class.new(record, **authorization_context)
11
+ policy_class.new(record, authorization_context)
12
12
  end
13
13
 
14
14
  def authorization_context
@@ -39,7 +39,7 @@ module ActionPolicy
39
39
 
40
40
  module InstanceMethods # :nodoc:
41
41
  def policy_for(record:, **opts)
42
- __policy_thread_memoize__(record, **opts) { super(record: record, **opts) }
42
+ __policy_thread_memoize__(record, opts) { super(record: record, **opts) }
43
43
  end
44
44
  end
45
45
 
@@ -38,7 +38,7 @@ module ActionPolicy
38
38
 
39
39
  def call(record, **opts)
40
40
  chain.each do |probe|
41
- val = probe.call(record, **opts)
41
+ val = probe.call(record, opts)
42
42
  return val unless val.nil?
43
43
  end
44
44
  nil
@@ -44,7 +44,7 @@ module ActionPolicy
44
44
  attr_reader :fulfilled
45
45
 
46
46
  def initialize(val)
47
- @fulfilled = KINDS.keys.include?(val)
47
+ @fulfilled = KINDS.key?(val)
48
48
  @value = val
49
49
  end
50
50
 
@@ -175,7 +175,7 @@ module ActionPolicy
175
175
  check = pre_checks.find { |c| c.name == name }
176
176
  raise "Pre-check already defined: #{name}" unless check.nil?
177
177
 
178
- pre_checks << Check.new(self, name, **options)
178
+ pre_checks << Check.new(self, name, options)
179
179
  end
180
180
  end
181
181
 
@@ -78,12 +78,12 @@ module ActionPolicy
78
78
  # Adds after_action callback to check that
79
79
  # authorize! method has been called.
80
80
  def verify_authorized(**options)
81
- after_action :verify_authorized, **options
81
+ after_action :verify_authorized, options
82
82
  end
83
83
 
84
84
  # Skips verify_authorized after_action callback.
85
85
  def skip_verify_authorized(**options)
86
- skip_after_action :verify_authorized, **options
86
+ skip_after_action :verify_authorized, options
87
87
  end
88
88
  end
89
89
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActionPolicy
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_policy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-09 00:00:00.000000000 Z
11
+ date: 2018-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0.51'
75
+ version: 0.56.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0.51'
82
+ version: 0.56.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rubocop-md
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -200,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
200
200
  version: '0'
201
201
  requirements: []
202
202
  rubyforge_project:
203
- rubygems_version: 2.7.4
203
+ rubygems_version: 2.7.6
204
204
  signing_key:
205
205
  specification_version: 4
206
206
  summary: Authorization framework for Ruby/Rails application