action_policy 0.7.6 → 0.7.7
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +4 -3
- data/lib/action_policy/behaviour.rb +1 -1
- data/lib/action_policy/rails/ext/active_record.rb +11 -0
- data/lib/action_policy/railtie.rb +1 -1
- data/lib/action_policy/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dd9504fed879c71d0ebb7025a8bf8ced503b3ed6dfd2d41b1585db47ca2d5548
|
|
4
|
+
data.tar.gz: 0c494eaae0d4283a604494af6f3e61326a21402e9ef98321840e755b585a0273
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: acdb59593707dc6f0f28b6f3c75f770386a1db35662eea95ae1eb0932fc1900e8a384c10c4e88eb70e3fde853e88414e3442f4994c59a364f94e50efb6c97cf7
|
|
7
|
+
data.tar.gz: a2deccf57e2c97b5c3dae5730ae7deecf487b49bb08cfcf488034ad3ff94e80495f3d76ad4553d76cf3f7b8f1322157c3c8f9b45179779af14212a4c9d18ce51
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## master
|
|
4
4
|
|
|
5
|
+
## 0.7.7 (2026-09-03)
|
|
6
|
+
|
|
7
|
+
- Fix caching non-persistent Active Record objects as the same entry ([@palkan][])
|
|
8
|
+
|
|
9
|
+
- Fix initializer racing condition with Rails 8.1 ([@inkstak][])
|
|
10
|
+
|
|
5
11
|
## 0.7.6 (2025-01-13)
|
|
6
12
|
|
|
7
13
|
- Execute proc passed to the `:through` option of `authorize` against `self` ([@Pagehey][])
|
data/README.md
CHANGED
|
@@ -15,8 +15,9 @@ Composable. Extensible. Performant.
|
|
|
15
15
|
|
|
16
16
|
📑 [Documentation](https://actionpolicy.evilmartians.io)
|
|
17
17
|
|
|
18
|
-
<
|
|
19
|
-
|
|
18
|
+
<br/>
|
|
19
|
+
|
|
20
|
+
<img src="https://cdn.evilmartians.com/badges/logo-no-label.svg" alt="Evil Martians logo" width="22" height="16" /> <b>Action Policy</b> is built by <b><a href="https://evilmartians.com/">Evil Martians</a></b>, an American design and engineering consultancy for <b>developer tools, AI, and cybersecurity startups</b>.
|
|
20
21
|
|
|
21
22
|
## Resources
|
|
22
23
|
|
|
@@ -118,7 +119,7 @@ Read more in our [Documentation][].
|
|
|
118
119
|
|
|
119
120
|
There are [many authorization libraries](https://www.ruby-toolbox.com/categories/rails_authorization) for Ruby/Rails applications.
|
|
120
121
|
|
|
121
|
-
What makes Action Policy different? See [this section](https://actionpolicy.evilmartians.io
|
|
122
|
+
What makes Action Policy different? See [this section](https://actionpolicy.evilmartians.io/guide/#what-about-the-existing-solutions) in our docs.
|
|
122
123
|
|
|
123
124
|
## Contributing
|
|
124
125
|
|
|
@@ -65,7 +65,7 @@ module ActionPolicy
|
|
|
65
65
|
private def build_authorization_context
|
|
66
66
|
self.class.authorization_targets
|
|
67
67
|
.each_with_object({}) do |(key, method_or_proc), obj|
|
|
68
|
-
|
|
68
|
+
obj[key] = method_or_proc.is_a?(Proc) ? instance_exec(&method_or_proc) : send(method_or_proc)
|
|
69
69
|
end
|
|
70
70
|
end
|
|
71
71
|
|
|
@@ -15,3 +15,14 @@ ActiveRecord::Relation.include(Module.new do
|
|
|
15
15
|
nil
|
|
16
16
|
end
|
|
17
17
|
end)
|
|
18
|
+
|
|
19
|
+
# Ensure non-persistent models are not cached as a single entry
|
|
20
|
+
ActiveRecord::Base.include(Module.new do
|
|
21
|
+
def policy_cache_key
|
|
22
|
+
if persisted?
|
|
23
|
+
cache_key_with_version
|
|
24
|
+
else
|
|
25
|
+
object_id.to_s
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end)
|
|
@@ -61,7 +61,7 @@ module ActionPolicy # :nodoc:
|
|
|
61
61
|
app.executor.to_complete { ActionPolicy::PerThreadCache.clear_all }
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
-
initializer "action_policy.extensions" do |app|
|
|
64
|
+
initializer "action_policy.extensions", after: :load_config_initializers do |app|
|
|
65
65
|
if app.config.action_policy.instrumentation_enabled
|
|
66
66
|
require "action_policy/rails/policy/instrumentation"
|
|
67
67
|
require "action_policy/rails/authorizer"
|