avo 3.33.1 → 3.33.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 251f54888bd2cc84f404a0d397b769ab791353f9f2786b3355fbecdc2f258a6c
4
- data.tar.gz: 74010e8c3b84085a6b52b9b47f396aadeb7beea85b43eeb2f9246a5abe15605d
3
+ metadata.gz: 4b9cb8cc08448ac44a60129910cd6b45b327d5f7e04a37bc41246254abcace20
4
+ data.tar.gz: 17dbce5f6bf9f7cbf4ada94144cff41f55c9b70c42b43b16ec07fcc2f253a079
5
5
  SHA512:
6
- metadata.gz: ca5a2bb0a37b43afeb76fed59e7ace41c2ba8b2e7c8aeb498d404f82dd5bced610bb83c109ad86287f265c6ecd72615612318cb456b4cabe5147e5b391e067de
7
- data.tar.gz: bda30f213366f943b6cae6c7c7b89a09a249b8001145b52907f7e02b0941e61466b6fc50e2bd3e9d0c9771e44ad6d35dec2710e26661c874e299609c7df8bcbb
6
+ metadata.gz: 5e5ecd1cedeec3ad78b8b10ba21da2a52d5cc25c34421c6454274c596df19bba9df9fe475353d9e729cff7ce6c94c5351d13366827afa8d327e398480ee02491
7
+ data.tar.gz: a2a28d5e41f7b7ea156557eb572604af2f9711bd1eb51841f9dd3bbb5c3bdd57382453f672d7885eff8a1070849c26104ef091293464a5f096015f2006f63593
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (3.33.1)
4
+ avo (3.33.2)
5
5
  actionview (>= 6.1)
6
6
  active_link_to
7
7
  activerecord (>= 6.1)
@@ -14,6 +14,7 @@ module Avo
14
14
  before_action :set_attachment_record, only: [:create, :destroy]
15
15
  before_action :set_attach_fields, only: [:new, :create]
16
16
  before_action :authorize_index_action, only: :index
17
+ before_action :authorize_show_action, only: :show
17
18
  before_action :authorize_attach_action, only: [:new, :create]
18
19
  before_action :authorize_detach_action, only: :destroy
19
20
 
@@ -185,6 +186,11 @@ module Avo
185
186
  authorize_if_defined "view_#{@field.id}?"
186
187
  end
187
188
 
189
+ def authorize_show_action
190
+ authorize_if_defined "view_#{@field.id}?"
191
+ @related_authorization.set_record(@related_record).authorize_action :show
192
+ end
193
+
188
194
  def authorize_attach_action
189
195
  authorize_if_defined "attach_#{@field.id}?"
190
196
  end
@@ -150,7 +150,7 @@ module Avo
150
150
  @related_record = if @field.is_a? Avo::Fields::HasOneField
151
151
  @record.send association_name
152
152
  else
153
- @related_resource.find_record params[:related_id], query: @record.send(association_name), params: params
153
+ @related_resource.find_record params[:related_id], query: @related_authorization.apply_policy(@record.send(association_name)), params: params
154
154
  end
155
155
  @related_resource.hydrate(record: @related_record)
156
156
  end
@@ -12,7 +12,7 @@ module Avo
12
12
  before_action :detect_fields
13
13
  before_action :set_edit_title_and_breadcrumbs, only: [:edit, :update]
14
14
  before_action :fill_record, only: [:create, :update]
15
- # Don't run base authorizations for associations
15
+ # AssociationsController authorizes each of its actions itself, so a new action needs its own check
16
16
  before_action :authorize_base_action, except: :preview, if: -> { controller_name != "associations" }
17
17
  before_action :set_pagy_locale, only: :index
18
18
 
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "3.33.1" unless const_defined?(:VERSION)
2
+ VERSION = "3.33.2" 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: 3.33.1
4
+ version: 3.33.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Marin