action_policy 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/action_policy/behaviour.rb +16 -7
- data/lib/action_policy/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 491af624707f597ded52f7d1cacdfc07435937250370804c0ac374f436b494ce
|
4
|
+
data.tar.gz: 33ac6abf6907738c6fce67193659e4fdb6615a2dd78a375dba4b57060c9d8f6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54e1dffffae9777c07d47f5718143cfbc546d6d100e873aadc3a51a1e8821f6495a7d869a477ac7d9d65be1ef92e1fef8bb9adde6c5177186c63eebb8dc88a94
|
7
|
+
data.tar.gz: 2b866340538957aa93c5db05a9c8bc7181b9cc4b9b178a137b58a13ad0d7a5158904b911834ab5dd2cf5af4d29bca29d7003095144c7786583375ec8d273c0d5
|
data/CHANGELOG.md
CHANGED
@@ -58,10 +58,11 @@ module ActionPolicy
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def authorization_context
|
61
|
-
|
62
|
-
|
61
|
+
@_authorization_context ||= build_authorization_context
|
62
|
+
end
|
63
63
|
|
64
|
-
|
64
|
+
def build_authorization_context
|
65
|
+
self.class.authorization_targets
|
65
66
|
.each_with_object({}) do |(key, meth), obj|
|
66
67
|
obj[key] = send(meth)
|
67
68
|
end
|
@@ -73,11 +74,19 @@ module ActionPolicy
|
|
73
74
|
policy.resolve_rule(rule)
|
74
75
|
end
|
75
76
|
|
76
|
-
def lookup_authorization_policy(record, **options) # :nodoc:
|
77
|
-
|
78
|
-
|
77
|
+
def lookup_authorization_policy(record, with: nil, **options) # :nodoc:
|
78
|
+
if record == :__undef__
|
79
|
+
record =
|
80
|
+
if with
|
81
|
+
implicit_authorization_target
|
82
|
+
else
|
83
|
+
implicit_authorization_target!
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
Kernel.raise ArgumentError, "Record or policy must be specified" if record.nil? && with.nil?
|
79
88
|
|
80
|
-
policy_for(record: record, **options)
|
89
|
+
policy_for(record: record, with: with, **options)
|
81
90
|
end
|
82
91
|
|
83
92
|
module ClassMethods # :nodoc:
|
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.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Dementyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-next-core
|
@@ -241,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
241
241
|
- !ruby/object:Gem::Version
|
242
242
|
version: '0'
|
243
243
|
requirements: []
|
244
|
-
rubygems_version: 3.3.
|
244
|
+
rubygems_version: 3.3.11
|
245
245
|
signing_key:
|
246
246
|
specification_version: 4
|
247
247
|
summary: Authorization framework for Ruby/Rails application
|