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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f5460c088fcdb06944cf17960a56317ca92ce641858d0be2ae930dddbe527bd0
4
- data.tar.gz: e2973cb82ccd2a68c857be57bd18a73c45656d340574c00bb135e67ee3c999b0
3
+ metadata.gz: 4d211e0aa9d5c3fe3f6a510f52911b5e7d24ea5963461da0f5b16a3c1feb39d7
4
+ data.tar.gz: 3fa4657c6abef8ce2dcf47f162337e4aa4595b4157c0b030a5569015914821ca
5
5
  SHA512:
6
- metadata.gz: 47a6063f100b7ba2a49aac977b6d6e6961d75c3af62befac1d3e8de2154c84396021d37cae03cacc74a872f72172c9a506af332e3c2c6b025f2f9ff45f3743c3
7
- data.tar.gz: a6112c2759fddc32613f17eba6cf6ae7c3049c0abfb89ce50c314b2cd7f89d5df6b1e743fcf44663fc1f4fcfdc92f85368464ec9a13bb5b29b12b03d5ade27d5
6
+ metadata.gz: e1ce52d940902fcc78fc1303575742e25be9d8ac17985423a4a706dc38d44e3c72ebbe26acdea2dbc8cac24ae229eb43555da51cc62acb76c2b0cf33ab398719
7
+ data.tar.gz: a13952382661e3411c297507a5c4f950edfbe885ade1fb9dfffe308b0cc8134449642c78d6e22417f1d1e3aed66b97dc524d438c5007a3e6b9f7a04ff88a1e80
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (2.21.2.pre.pr1486)
4
+ avo (2.21.3.pre.pr1489)
5
5
  actionview (>= 6.0)
6
6
  active_link_to
7
7
  activerecord (>= 6.0)
@@ -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 = @authorization.apply_policy @parent_model.send(association_name)
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 = @authorization.apply_policy @attachment_class
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
@@ -26,6 +26,8 @@ app_root do
26
26
 
27
27
  header 'Installing Yarn packages'
28
28
  run! 'yarn'
29
+ run! '(cd spec/dummy; yarn)'
30
+ run! '(cp spec/dummy/.env.test.sample spec/dummy/.env.test)'
29
31
 
30
32
  if use_docker == 'y'
31
33
  header 'Creating the Docker volume'
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 Rails::VERSION::MAJOR === 6
63
- ActiveStorage::Current.host = request.base_url
64
- elsif Rails::VERSION::MAJOR === 7
65
- ActiveStorage::Current.url_options = request.base_url
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
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "2.21.2.pre.pr1486" unless const_defined?(:VERSION)
2
+ VERSION = "2.21.3.pre.pr1489" unless const_defined?(:VERSION)
3
3
  end
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.2.pre.pr1486
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-07 00:00:00.000000000 Z
12
+ date: 2022-12-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord