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 +4 -4
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +5 -0
- data/README.md +3 -3
- data/action_policy.gemspec +1 -1
- data/docs/README.md +1 -1
- data/lib/action_policy.rb +1 -1
- data/lib/action_policy/base.rb +1 -1
- data/lib/action_policy/behaviours/memoized.rb +1 -1
- data/lib/action_policy/behaviours/policy_for.rb +1 -1
- data/lib/action_policy/behaviours/thread_memoized.rb +1 -1
- data/lib/action_policy/lookup_chain.rb +1 -1
- data/lib/action_policy/policy/pre_check.rb +2 -2
- data/lib/action_policy/rails/controller.rb +2 -2
- data/lib/action_policy/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1214a9618cb6a1dc99c244664e9c3bb38217c941a1a721f75c55d74bda56407d
|
4
|
+
data.tar.gz: fb2466a77823ef0db9cb422430695ae7a2ff448f47d0c39fd968bebc9ee12ddc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d17ebf03ff8c893aa63278fadeeea3c8b151ba8aff4b9fd81cee907eab03db60bfc62503636b742b8e964077c066f77967638b3fd3feebb0240de604a1e8de9
|
7
|
+
data.tar.gz: f522c4ade334c607251829e571ea502c8881dd8fb5283be9a0041a7c20370780a499466b1800ced5bce77bacb3e9a39c7dcb8d50c1729d56fc57c8bf0e59cb21
|
data/.rubocop.yml
CHANGED
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)](
|
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
|
data/action_policy.gemspec
CHANGED
@@ -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.
|
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
data/lib/action_policy/base.rb
CHANGED
@@ -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
|
@@ -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,
|
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,
|
42
|
+
__policy_thread_memoize__(record, opts) { super(record: record, **opts) }
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
@@ -44,7 +44,7 @@ module ActionPolicy
|
|
44
44
|
attr_reader :fulfilled
|
45
45
|
|
46
46
|
def initialize(val)
|
47
|
-
@fulfilled = KINDS.
|
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,
|
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,
|
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,
|
86
|
+
skip_after_action :verify_authorized, options
|
87
87
|
end
|
88
88
|
end
|
89
89
|
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.
|
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-
|
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:
|
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:
|
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.
|
203
|
+
rubygems_version: 2.7.6
|
204
204
|
signing_key:
|
205
205
|
specification_version: 4
|
206
206
|
summary: Authorization framework for Ruby/Rails application
|