avo 2.21.2.pre.pr1486 → 2.21.3.pre.pr1489
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of avo might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/app/controllers/avo/associations_controller.rb +2 -2
- data/bin/init +2 -0
- data/lib/avo/app.rb +6 -4
- data/lib/avo/services/authorization_service.rb +2 -1
- data/lib/avo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d211e0aa9d5c3fe3f6a510f52911b5e7d24ea5963461da0f5b16a3c1feb39d7
|
4
|
+
data.tar.gz: 3fa4657c6abef8ce2dcf47f162337e4aa4595b4157c0b030a5569015914821ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1ce52d940902fcc78fc1303575742e25be9d8ac17985423a4a706dc38d44e3c72ebbe26acdea2dbc8cac24ae229eb43555da51cc62acb76c2b0cf33ab398719
|
7
|
+
data.tar.gz: a13952382661e3411c297507a5c4f950edfbe885ade1fb9dfffe308b0cc8134449642c78d6e22417f1d1e3aed66b97dc524d438c5007a3e6b9f7a04ff88a1e80
|
data/Gemfile.lock
CHANGED
@@ -24,7 +24,7 @@ module Avo
|
|
24
24
|
@parent_model = @parent_resource.class.find_scope.find(params[:id])
|
25
25
|
@parent_resource.hydrate(model: @parent_model)
|
26
26
|
association_name = BaseResource.valid_association_name(@parent_model, params[:related_name])
|
27
|
-
@query = @
|
27
|
+
@query = @related_authorization.apply_policy @parent_model.send(association_name)
|
28
28
|
@association_field = @parent_resource.get_field params[:related_name]
|
29
29
|
|
30
30
|
if @association_field.present? && @association_field.scope.present?
|
@@ -46,7 +46,7 @@ module Avo
|
|
46
46
|
@resource.hydrate(model: @model)
|
47
47
|
|
48
48
|
if @field.present? && !@field.searchable
|
49
|
-
query = @
|
49
|
+
query = @related_authorization.apply_policy @attachment_class
|
50
50
|
|
51
51
|
# Add the association scope to the query scope
|
52
52
|
if @field.attach_scope.present?
|
data/bin/init
CHANGED
data/lib/avo/app.rb
CHANGED
@@ -59,10 +59,12 @@ module Avo
|
|
59
59
|
|
60
60
|
# Set the current host for ActiveStorage
|
61
61
|
begin
|
62
|
-
if
|
63
|
-
|
64
|
-
|
65
|
-
|
62
|
+
if defined?(ActiveStorage::Current)
|
63
|
+
if Rails::VERSION::MAJOR === 6
|
64
|
+
ActiveStorage::Current.host = request.base_url
|
65
|
+
elsif Rails::VERSION::MAJOR === 7
|
66
|
+
ActiveStorage::Current.url_options = request.base_url
|
67
|
+
end
|
66
68
|
end
|
67
69
|
rescue => exception
|
68
70
|
Rails.logger.debug "[Avo] Failed to set ActiveStorage::Current.url_options, #{exception.inspect}"
|
@@ -29,6 +29,7 @@ module Avo
|
|
29
29
|
|
30
30
|
def authorize(user, record, action, policy_class: nil, **args)
|
31
31
|
return true if skip_authorization
|
32
|
+
return true if user.nil?
|
32
33
|
|
33
34
|
client.authorize user, record, action, policy_class: policy_class
|
34
35
|
|
@@ -63,7 +64,7 @@ module Avo
|
|
63
64
|
end
|
64
65
|
|
65
66
|
def apply_policy(user, model, policy_class: nil)
|
66
|
-
return model if skip_authorization
|
67
|
+
return model if skip_authorization || user.nil?
|
67
68
|
|
68
69
|
client.apply_policy(user, model, policy_class: policy_class)
|
69
70
|
rescue NoPolicyError => error
|
data/lib/avo/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.21.
|
4
|
+
version: 2.21.3.pre.pr1489
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Marin
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-12-
|
12
|
+
date: 2022-12-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|