avo 3.32.2 → 3.32.4
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0f28594c5b85e9c195d101136003422d6ddc321255474393a02313a54cc0aa86
|
|
4
|
+
data.tar.gz: 9e483c35a6ca7cddc0173c63526bed3370d7a81d3d7f356813a98e838c11664e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c5b5123b31107a6acc2456f46d36982af364f665b9593a23cdfc8f45f2edbe32bcc01448dccdbbe406f0c6ae5b3c49bd021e795d2baabbb81cc560228cc84843
|
|
7
|
+
data.tar.gz: cb4c91879fb962f4a0267a60e768ff2f49ce915a361201564a4b5325797839dcebf99a8ad9acfa13dd06cbac72ad361916bbc105aa06d8af4ccb15f38e4447d6
|
data/Gemfile.lock
CHANGED
|
@@ -62,6 +62,7 @@ class Avo::Fields::BelongsToField::EditComponent < Avo::Fields::EditComponent
|
|
|
62
62
|
|
|
63
63
|
helpers.new_resource_path(**{
|
|
64
64
|
via_relation: @field.id.to_s,
|
|
65
|
+
via_relation_class: resource.model_class.to_s,
|
|
65
66
|
resource: target_resource || @field.target_resource,
|
|
66
67
|
via_record_id: resource.record.persisted? ? resource.record.to_param : nil,
|
|
67
68
|
via_belongs_to_resource_class: resource.class.name
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
module Avo
|
|
2
2
|
class MediaLibraryController < ApplicationController
|
|
3
3
|
include Pagy::Backend
|
|
4
|
+
|
|
4
5
|
before_action :authorize_access!
|
|
5
6
|
|
|
6
7
|
def index
|
|
@@ -37,6 +38,13 @@ module Avo
|
|
|
37
38
|
|
|
38
39
|
def authorize_access!
|
|
39
40
|
raise_404 if Avo::MediaLibrary.configuration.disabled?
|
|
41
|
+
|
|
42
|
+
# `visible` is the per-user gate for the whole feature, not just the
|
|
43
|
+
# sidebar item. It reads like access control -- a block returning false
|
|
44
|
+
# for a user is plainly meant to keep that user out -- so it has to be
|
|
45
|
+
# enforced here, or every Media Library route stays reachable by URL to
|
|
46
|
+
# anyone who can sign in to Avo.
|
|
47
|
+
raise_404 unless Avo::MediaLibrary.configuration.visible?
|
|
40
48
|
end
|
|
41
49
|
end
|
|
42
50
|
end
|
data/lib/avo/resources/base.rb
CHANGED
|
@@ -575,16 +575,16 @@ module Avo
|
|
|
575
575
|
|
|
576
576
|
reflection = @record.class.reflect_on_association(@params[:via_relation]) if @params[:via_relation].present?
|
|
577
577
|
|
|
578
|
-
if field.polymorphic_as.present? && field.types.map(&:to_s).include?(@params[:via_relation_class])
|
|
578
|
+
if field.polymorphic_as.present? && field.types.map(&:to_s).include?(@params[:via_relation_class]) && @params[:via_record_id].present?
|
|
579
579
|
# set the value to the actual record
|
|
580
580
|
via_resource = Avo.resource_manager.get_resource_by_model_class(@params[:via_relation_class])
|
|
581
|
-
value = via_resource.find_record(@params[:via_record_id])
|
|
582
|
-
elsif reflection.present? && reflection.foreign_key.present? && field.id.to_s == @params[:via_relation].to_s
|
|
581
|
+
value = via_resource.find_record(@params[:via_record_id]) if via_resource.present?
|
|
582
|
+
elsif reflection.present? && reflection.foreign_key.present? && field.id.to_s == @params[:via_relation].to_s && @params[:via_record_id].present?
|
|
583
583
|
resource = Avo.resource_manager.get_resource_by_model_class params[:via_relation_class]
|
|
584
|
-
record = resource.find_record @params[:via_record_id], params: params
|
|
584
|
+
record = resource.find_record @params[:via_record_id], params: params if resource.present?
|
|
585
585
|
id_param = reflection.options[:primary_key] || :id
|
|
586
586
|
|
|
587
|
-
value = record.send(id_param)
|
|
587
|
+
value = record.send(id_param) if record.present?
|
|
588
588
|
end
|
|
589
589
|
end
|
|
590
590
|
|
data/lib/avo/version.rb
CHANGED