avo 2.17.1.pre.2.customauthorizationclients → 2.17.1.pre.3
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 +4 -4
- data/Gemfile.lock +6 -5
- data/app/components/avo/button_component.rb +2 -2
- data/app/components/avo/fields/common/single_file_viewer_component.html.erb +3 -3
- data/app/components/avo/fields/date_field/edit_component.html.erb +2 -0
- data/app/components/avo/fields/date_field/index_component.html.erb +1 -0
- data/app/components/avo/fields/date_field/show_component.html.erb +1 -0
- data/app/components/avo/fields/date_time_field/edit_component.html.erb +2 -0
- data/app/components/avo/fields/date_time_field/index_component.html.erb +1 -0
- data/app/components/avo/fields/date_time_field/show_component.html.erb +1 -0
- data/app/components/avo/fields/time_field/edit_component.html.erb +40 -0
- data/app/components/avo/fields/time_field/edit_component.rb +4 -0
- data/app/components/avo/fields/time_field/index_component.html.erb +15 -0
- data/app/components/avo/fields/time_field/index_component.rb +4 -0
- data/app/components/avo/fields/time_field/show_component.html.erb +15 -0
- data/app/components/avo/fields/time_field/show_component.rb +4 -0
- data/app/components/avo/index/resource_controls_component.html.erb +2 -2
- data/app/components/avo/panel_component.html.erb +2 -4
- data/app/components/avo/panel_component.rb +2 -4
- data/app/components/avo/sidebar_profile_component.html.erb +4 -1
- data/app/components/avo/tab_switcher_component.html.erb +1 -1
- data/app/components/avo/tab_switcher_component.rb +2 -0
- data/app/components/avo/views/resource_edit_component.html.erb +10 -12
- data/app/components/avo/views/resource_show_component.html.erb +21 -25
- data/app/controllers/avo/application_controller.rb +17 -9
- data/app/controllers/avo/associations_controller.rb +1 -1
- data/app/helpers/avo/application_helper.rb +4 -0
- data/app/javascript/js/controllers/fields/date_field_controller.js +61 -21
- data/app/javascript/js/controllers/search_controller.js +3 -0
- data/avo.gemspec +1 -1
- data/db/factories.rb +1 -0
- data/lib/avo/concerns/handles_field_args.rb +4 -0
- data/lib/avo/configuration.rb +0 -2
- data/lib/avo/fields/base_field.rb +5 -1
- data/lib/avo/fields/date_field.rb +2 -0
- data/lib/avo/fields/time_field.rb +55 -0
- data/lib/avo/services/authorization_service.rb +62 -43
- data/lib/avo/version.rb +1 -1
- data/lib/avo.rb +0 -4
- data/lib/generators/avo/templates/initializer/avo.tt +0 -1
- data/lib/generators/avo/templates/locales/avo.nb.yml +1 -1
- data/lib/generators/avo/templates/locales/avo.nn.yml +7 -7
- data/public/avo-assets/avo.base.css +12 -6
- data/public/avo-assets/avo.base.js +64 -64
- data/public/avo-assets/avo.base.js.map +2 -2
- metadata +12 -6
- data/lib/avo/services/authorization_clients/pundit_client.rb +0 -51
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.17.1.pre.
|
4
|
+
version: 2.17.1.pre.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Marin
|
@@ -127,16 +127,16 @@ dependencies:
|
|
127
127
|
name: view_component
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
|
-
- -
|
130
|
+
- - ">="
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
version: '
|
132
|
+
version: '0'
|
133
133
|
type: :runtime
|
134
134
|
prerelease: false
|
135
135
|
version_requirements: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
|
-
- -
|
137
|
+
- - ">="
|
138
138
|
- !ruby/object:Gem::Version
|
139
|
-
version: '
|
139
|
+
version: '0'
|
140
140
|
- !ruby/object:Gem::Dependency
|
141
141
|
name: turbo-rails
|
142
142
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1556,6 +1556,12 @@ files:
|
|
1556
1556
|
- app/components/avo/fields/textarea_field/edit_component.rb
|
1557
1557
|
- app/components/avo/fields/textarea_field/show_component.html.erb
|
1558
1558
|
- app/components/avo/fields/textarea_field/show_component.rb
|
1559
|
+
- app/components/avo/fields/time_field/edit_component.html.erb
|
1560
|
+
- app/components/avo/fields/time_field/edit_component.rb
|
1561
|
+
- app/components/avo/fields/time_field/index_component.html.erb
|
1562
|
+
- app/components/avo/fields/time_field/index_component.rb
|
1563
|
+
- app/components/avo/fields/time_field/show_component.html.erb
|
1564
|
+
- app/components/avo/fields/time_field/show_component.rb
|
1559
1565
|
- app/components/avo/fields/trix_field/edit_component.html.erb
|
1560
1566
|
- app/components/avo/fields/trix_field/edit_component.rb
|
1561
1567
|
- app/components/avo/fields/trix_field/show_component.html.erb
|
@@ -1809,6 +1815,7 @@ files:
|
|
1809
1815
|
- lib/avo/fields/tags_field.rb
|
1810
1816
|
- lib/avo/fields/text_field.rb
|
1811
1817
|
- lib/avo/fields/textarea_field.rb
|
1818
|
+
- lib/avo/fields/time_field.rb
|
1812
1819
|
- lib/avo/fields/trix_field.rb
|
1813
1820
|
- lib/avo/filters/base_filter.rb
|
1814
1821
|
- lib/avo/filters/boolean_filter.rb
|
@@ -1862,7 +1869,6 @@ files:
|
|
1862
1869
|
- lib/avo/resources/controls/execution_context.rb
|
1863
1870
|
- lib/avo/resources/controls/items_holder.rb
|
1864
1871
|
- lib/avo/resources/controls/link_to.rb
|
1865
|
-
- lib/avo/services/authorization_clients/pundit_client.rb
|
1866
1872
|
- lib/avo/services/authorization_service.rb
|
1867
1873
|
- lib/avo/services/encryption_service.rb
|
1868
1874
|
- lib/avo/services/uri_service.rb
|
@@ -1,51 +0,0 @@
|
|
1
|
-
module Avo
|
2
|
-
module Services
|
3
|
-
module AuthorizationClients
|
4
|
-
class PunditClient
|
5
|
-
def authorize(user, record, action, policy_class: nil)
|
6
|
-
Pundit.authorize(user, record, action, policy_class: policy_class)
|
7
|
-
rescue Pundit::NotDefinedError
|
8
|
-
raise NoPolicyError
|
9
|
-
rescue Pundit::NotAuthorizedError
|
10
|
-
raise NotAuthorizedError
|
11
|
-
end
|
12
|
-
|
13
|
-
def policy(user, record)
|
14
|
-
Pundit.policy(user, record)
|
15
|
-
end
|
16
|
-
|
17
|
-
def policy!(user, record)
|
18
|
-
Pundit.policy!(user, record)
|
19
|
-
rescue Pundit::NotDefinedError
|
20
|
-
raise NoPolicyError
|
21
|
-
end
|
22
|
-
|
23
|
-
def apply_policy(user, model, policy_class: nil)
|
24
|
-
# Try and figure out the scope from a given policy or auto-detected one
|
25
|
-
scope_from_policy_class = scope_for_policy_class(policy_class)
|
26
|
-
|
27
|
-
# If we discover one use it.
|
28
|
-
# Else fallback to pundit.
|
29
|
-
if scope_from_policy_class.present?
|
30
|
-
scope_from_policy_class.new(user, model).resolve
|
31
|
-
else
|
32
|
-
Pundit.policy_scope!(user, model)
|
33
|
-
end
|
34
|
-
rescue Pundit::NotDefinedError => error
|
35
|
-
raise NoPolicyError
|
36
|
-
end
|
37
|
-
|
38
|
-
private
|
39
|
-
|
40
|
-
# Fetches the scope for a given policy
|
41
|
-
def scope_for_policy_class(policy_class = nil)
|
42
|
-
return if policy_class.blank?
|
43
|
-
|
44
|
-
if policy_class.present? && defined?(policy_class::Scope)
|
45
|
-
policy_class::Scope
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|