avo 3.33.0 → 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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4b9cb8cc08448ac44a60129910cd6b45b327d5f7e04a37bc41246254abcace20
|
|
4
|
+
data.tar.gz: 17dbce5f6bf9f7cbf4ada94144cff41f55c9b70c42b43b16ec07fcc2f253a079
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5e5ecd1cedeec3ad78b8b10ba21da2a52d5cc25c34421c6454274c596df19bba9df9fe475353d9e729cff7ce6c94c5351d13366827afa8d327e398480ee02491
|
|
7
|
+
data.tar.gz: a2a28d5e41f7b7ea156557eb572604af2f9711bd1eb51841f9dd3bbb5c3bdd57382453f672d7885eff8a1070849c26104ef091293464a5f096015f2006f63593
|
data/Gemfile.lock
CHANGED
|
@@ -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
|
|
@@ -223,6 +223,13 @@ module Avo
|
|
|
223
223
|
|
|
224
224
|
def _authenticate!
|
|
225
225
|
instance_eval(&Avo.configuration.authenticate)
|
|
226
|
+
return if performed?
|
|
227
|
+
|
|
228
|
+
# `?set_locale=` changes the locale for every user, so only a request the
|
|
229
|
+
# authenticate block let through may store it. Kept here, not in its own
|
|
230
|
+
# callback, so a controller that skips this one cannot store it either.
|
|
231
|
+
locale = available_locale(params[:set_locale])
|
|
232
|
+
Avo.configuration.locale = locale if locale
|
|
226
233
|
end
|
|
227
234
|
|
|
228
235
|
def render_unauthorized(exception)
|
|
@@ -259,21 +266,25 @@ module Avo
|
|
|
259
266
|
@resource.form_scope
|
|
260
267
|
end
|
|
261
268
|
|
|
262
|
-
# Sets the locale set in avo.rb initializer or if to something that the user set using the `?set_locale=pt-BR` param
|
|
269
|
+
# Sets the locale set in avo.rb initializer or if to something that the user set using the `?set_locale=pt-BR` param.
|
|
270
|
+
# Unknown locales are ignored: I18n.with_locale raises InvalidLocale on them.
|
|
263
271
|
def set_avo_locale(&action)
|
|
264
|
-
locale = Avo.configuration.default_locale
|
|
265
|
-
|
|
266
|
-
if params[:set_locale].present?
|
|
267
|
-
locale = params[:set_locale]
|
|
268
|
-
Avo.configuration.locale = locale
|
|
269
|
-
end
|
|
272
|
+
locale = available_locale(params[:set_locale]) || Avo.configuration.default_locale
|
|
270
273
|
|
|
271
274
|
I18n.with_locale(locale, &action)
|
|
272
275
|
end
|
|
273
276
|
|
|
274
277
|
# Temporary set the locale and reverting at the end of the request.
|
|
275
278
|
def set_force_locale(&action)
|
|
276
|
-
|
|
279
|
+
locale = available_locale(params[:force_locale])
|
|
280
|
+
return yield if locale.nil?
|
|
281
|
+
|
|
282
|
+
I18n.with_locale(locale, &action)
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
def available_locale(value)
|
|
286
|
+
value = value.to_s
|
|
287
|
+
value if value.present? && I18n.locale_available?(value)
|
|
277
288
|
end
|
|
278
289
|
|
|
279
290
|
def set_sidebar_open
|
|
@@ -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
|
-
#
|
|
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
metadata
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: avo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.33.
|
|
4
|
+
version: 3.33.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Adrian Marin
|
|
8
8
|
- Mihai Marin
|
|
9
9
|
- Paul Bob
|
|
10
|
-
autorequire:
|
|
11
10
|
bindir: bin
|
|
12
11
|
cert_chain: []
|
|
13
|
-
date:
|
|
12
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
14
13
|
dependencies:
|
|
15
14
|
- !ruby/object:Gem::Dependency
|
|
16
15
|
name: activerecord
|
|
@@ -1110,8 +1109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
1110
1109
|
- !ruby/object:Gem::Version
|
|
1111
1110
|
version: '0'
|
|
1112
1111
|
requirements: []
|
|
1113
|
-
rubygems_version:
|
|
1114
|
-
signing_key:
|
|
1112
|
+
rubygems_version: 4.0.1
|
|
1115
1113
|
specification_version: 4
|
|
1116
1114
|
summary: Admin panel framework and Content Management System for Ruby on Rails.
|
|
1117
1115
|
test_files: []
|