avo 2.21.2.pre.pr1486 → 2.22.0

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: a08f250c3df5118c161cb76f4aeb79082a1e472c833db780873077fc98563293
4
+ data.tar.gz: 0261dc8b5aa277264c3ae3e70706b11347669fc20cd9c606a4c89179589195eb
5
5
  SHA512:
6
- metadata.gz: 47a6063f100b7ba2a49aac977b6d6e6961d75c3af62befac1d3e8de2154c84396021d37cae03cacc74a872f72172c9a506af332e3c2c6b025f2f9ff45f3743c3
7
- data.tar.gz: a6112c2759fddc32613f17eba6cf6ae7c3049c0abfb89ce50c314b2cd7f89d5df6b1e743fcf44663fc1f4fcfdc92f85368464ec9a13bb5b29b12b03d5ade27d5
6
+ metadata.gz: 5f3e9b443058e4d1649539857d878672f396ec1e1716b6ecfd44b2eba3ffae8953027e3bcafb84fdc96dd8caa737826d34032df9b63198f54d754e28e3878710
7
+ data.tar.gz: 83e60548283c659a4e311454bbb0779eafa61049a7785834b512d808954c9a49debe6bdedbe67cd7faa66d0cba555978c583ba7a425d550b818b507cbac2684e
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.22.0)
5
5
  actionview (>= 6.0)
6
6
  active_link_to
7
7
  activerecord (>= 6.0)
@@ -230,7 +230,7 @@ GEM
230
230
  listen (3.7.1)
231
231
  rb-fsevent (~> 0.10, >= 0.10.3)
232
232
  rb-inotify (~> 0.9, >= 0.9.10)
233
- loofah (2.19.0)
233
+ loofah (2.19.1)
234
234
  crass (~> 1.0.2)
235
235
  nokogiri (>= 1.5.9)
236
236
  mail (2.7.1)
@@ -259,10 +259,10 @@ GEM
259
259
  net-protocol
260
260
  timeout
261
261
  nio4r (2.5.8)
262
- nokogiri (1.13.9)
262
+ nokogiri (1.13.10)
263
263
  mini_portile2 (~> 2.8.0)
264
264
  racc (~> 1.4)
265
- nokogiri (1.13.9-x86_64-linux)
265
+ nokogiri (1.13.10-x86_64-linux)
266
266
  racc (~> 1.4)
267
267
  orm_adapter (0.5.0)
268
268
  pagy (5.10.1)
@@ -276,7 +276,7 @@ GEM
276
276
  nio4r (~> 2.0)
277
277
  pundit (2.2.0)
278
278
  activesupport (>= 3.0.0)
279
- racc (1.6.0)
279
+ racc (1.6.1)
280
280
  rack (2.2.4)
281
281
  rack-test (2.0.2)
282
282
  rack (>= 1.3)
@@ -302,8 +302,8 @@ GEM
302
302
  rails-dom-testing (2.0.3)
303
303
  activesupport (>= 4.2.0)
304
304
  nokogiri (>= 1.6)
305
- rails-html-sanitizer (1.4.3)
306
- loofah (~> 2.3)
305
+ rails-html-sanitizer (1.4.4)
306
+ loofah (~> 2.19, >= 2.19.1)
307
307
  rails-i18n (7.0.5)
308
308
  i18n (>= 0.7, < 2)
309
309
  railties (>= 6.0.0, < 8)
@@ -259,7 +259,7 @@ module Avo
259
259
  end
260
260
 
261
261
  def render_unauthorized(_exception)
262
- flash.now[:notice] = t "avo.not_authorized"
262
+ flash[:notice] = t "avo.not_authorized"
263
263
 
264
264
  redirect_url = if request.referrer.blank? || (request.referrer == request.url)
265
265
  root_url
@@ -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?
@@ -13,6 +13,9 @@ module Avo
13
13
  def set_dashboard
14
14
  @dashboard = Avo::App.get_dashboard_by_id params[:id]
15
15
 
16
+ authorized = Avo::Hosts::BaseHost.new(block: @dashboard.authorize).handle
17
+ raise Avo::NotAuthorizedError.new if !authorized
18
+
16
19
  raise ActionController::RoutingError.new("Not Found") if @dashboard.nil? || @dashboard.is_hidden?
17
20
  end
18
21
  end
data/avo.gemspec CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  "public gem pushes."
28
28
  end
29
29
 
30
- spec.required_ruby_version = ">= 2.4.0"
30
+ spec.required_ruby_version = ">= 2.6.0"
31
31
  spec.post_install_message = "Thank you for using Avo 💪 Docs are available at https://docs.avohq.io"
32
32
 
33
33
  spec.files = Dir["{bin,app,config,db,lib,public}/**/*", "MIT-LICENSE", "Rakefile", "README.md", "avo.gemspec", "Gemfile", "Gemfile.lock"]
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}"
@@ -10,6 +10,7 @@ module Avo
10
10
  class_attribute :grid_cols, default: 3
11
11
  class_attribute :visible, default: true
12
12
  class_attribute :index, default: 0
13
+ class_attribute :authorize, default: -> { true }
13
14
 
14
15
  class << self
15
16
  def options_deprecation_message
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.22.0" 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.22.0
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-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -1694,7 +1694,6 @@ files:
1694
1694
  - config/credentials.yml.enc
1695
1695
  - config/i18n-tasks.yml
1696
1696
  - config/initializers/pagy.rb
1697
- - config/master.key
1698
1697
  - config/routes.rb
1699
1698
  - config/spring.rb
1700
1699
  - db/factories.rb
@@ -1947,12 +1946,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
1947
1946
  requirements:
1948
1947
  - - ">="
1949
1948
  - !ruby/object:Gem::Version
1950
- version: 2.4.0
1949
+ version: 2.6.0
1951
1950
  required_rubygems_version: !ruby/object:Gem::Requirement
1952
1951
  requirements:
1953
- - - ">"
1952
+ - - ">="
1954
1953
  - !ruby/object:Gem::Version
1955
- version: 1.3.1
1954
+ version: '0'
1956
1955
  requirements: []
1957
1956
  rubygems_version: 3.3.3
1958
1957
  signing_key:
data/config/master.key DELETED
@@ -1 +0,0 @@
1
- 2aeb23d82b909d9c6b5abb62f7058c2a