solidus_backend 4.8.0 → 4.8.1
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 +4 -4
- data/app/controllers/spree/admin/adjustment_reasons_controller.rb +5 -0
- data/app/controllers/spree/admin/adjustments_controller.rb +4 -0
- data/app/controllers/spree/admin/images_controller.rb +7 -0
- data/app/controllers/spree/admin/option_types_controller.rb +10 -0
- data/app/controllers/spree/admin/payment_methods_controller.rb +6 -1
- data/app/controllers/spree/admin/prices_controller.rb +6 -0
- data/app/controllers/spree/admin/product_properties_controller.rb +4 -0
- data/app/controllers/spree/admin/products_controller.rb +16 -0
- data/app/controllers/spree/admin/properties_controller.rb +4 -0
- data/app/controllers/spree/admin/refund_reasons_controller.rb +5 -0
- data/app/controllers/spree/admin/refunds_controller.rb +5 -1
- data/app/controllers/spree/admin/reimbursements_controller.rb +6 -0
- data/app/controllers/spree/admin/resource_controller.rb +17 -3
- data/app/controllers/spree/admin/return_authorizations_controller.rb +12 -0
- data/app/controllers/spree/admin/return_items_controller.rb +4 -0
- data/app/controllers/spree/admin/return_reasons_controller.rb +5 -0
- data/app/controllers/spree/admin/search_controller.rb +0 -2
- data/app/controllers/spree/admin/shipping_categories_controller.rb +5 -0
- data/app/controllers/spree/admin/shipping_methods_controller.rb +16 -0
- data/app/controllers/spree/admin/stock_locations_controller.rb +7 -0
- data/app/controllers/spree/admin/store_credit_reasons_controller.rb +5 -0
- data/app/controllers/spree/admin/stores_controller.rb +8 -8
- data/app/controllers/spree/admin/tax_categories_controller.rb +5 -0
- data/app/controllers/spree/admin/tax_rates_controller.rb +15 -0
- data/app/controllers/spree/admin/taxonomies_controller.rb +4 -0
- data/app/controllers/spree/admin/variants_controller.rb +4 -0
- data/app/controllers/spree/admin/zones_controller.rb +4 -0
- data/lib/spree/backend_configuration.rb +2 -0
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1e2dd21b6547ad72960f07baf7639d4ed147cc00caa2a161f905ae28f024c25b
|
|
4
|
+
data.tar.gz: 4fc08f6ece484c6dff419fa64cf9894342adf70a03f259bf6500abccab6b11d5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 050c816b101d8f3566b6b1555271844a619bb86cd6a8f02a08602a7ddd7842161236aa9a4bb177c445123235fea8da1ad0e7d3a46e4744efc48ef2160a2d0531
|
|
7
|
+
data.tar.gz: 6af99a26aad693f48612ca4f4a0846485cbfa3b3a1526618c977beb8dc796f7a9b0dd13c3b2e9604f35c1f0af0160936f20d310f266645c601a712bb8a62ebed
|
|
@@ -21,6 +21,10 @@ module Spree
|
|
|
21
21
|
|
|
22
22
|
private
|
|
23
23
|
|
|
24
|
+
def permitted_resource_params
|
|
25
|
+
params.require(:adjustment).permit(:amount, :label, :adjustment_reason_id)
|
|
26
|
+
end
|
|
27
|
+
|
|
24
28
|
def find_adjustment
|
|
25
29
|
# Need to assign to @object here to keep ResourceController happy
|
|
26
30
|
@adjustment = @object = parent.all_adjustments.find(params[:id])
|
|
@@ -9,6 +9,13 @@ module Spree
|
|
|
9
9
|
|
|
10
10
|
private
|
|
11
11
|
|
|
12
|
+
def permitted_resource_params
|
|
13
|
+
# We remove viewable_type because it is explicitly set by set_viewable.
|
|
14
|
+
# The field isn't editable with the current UI, so we don't want to
|
|
15
|
+
# allow it to be set via mass assignment.
|
|
16
|
+
params.require(:image).permit(permitted_image_attributes - [:viewable_type])
|
|
17
|
+
end
|
|
18
|
+
|
|
12
19
|
def location_after_destroy
|
|
13
20
|
admin_product_images_url(@product)
|
|
14
21
|
end
|
|
@@ -17,6 +17,16 @@ module Spree
|
|
|
17
17
|
|
|
18
18
|
private
|
|
19
19
|
|
|
20
|
+
def permitted_resource_params
|
|
21
|
+
attributes = permitted_option_type_attributes.map do |attribute|
|
|
22
|
+
next attribute unless attribute.is_a?(Hash) && attribute.key?(:option_values_attributes)
|
|
23
|
+
|
|
24
|
+
attribute.merge(option_values_attributes: [:id, *permitted_option_value_attributes])
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
params.require(:option_type).permit(attributes)
|
|
28
|
+
end
|
|
29
|
+
|
|
20
30
|
def location_after_save
|
|
21
31
|
edit_admin_option_type_url(@option_type)
|
|
22
32
|
end
|
|
@@ -67,7 +67,12 @@ module Spree
|
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
def payment_method_params
|
|
70
|
-
params.require(:payment_method).permit
|
|
70
|
+
params.require(:payment_method).permit(
|
|
71
|
+
:name, :description, :type, :preference_source, :auto_capture,
|
|
72
|
+
:active, :available_to_admin, :available_to_users,
|
|
73
|
+
*@payment_method_type.permitted_preference_attributes,
|
|
74
|
+
store_ids: []
|
|
75
|
+
)
|
|
71
76
|
end
|
|
72
77
|
|
|
73
78
|
def build_resource
|
|
@@ -47,6 +47,22 @@ module Spree
|
|
|
47
47
|
|
|
48
48
|
private
|
|
49
49
|
|
|
50
|
+
def permitted_resource_params
|
|
51
|
+
# update_before may clear params[:product] when removing all product properties
|
|
52
|
+
params.require(:product).permit(
|
|
53
|
+
*(permitted_attributes.product_attributes - [:deleted_at, :option_values_hash]),
|
|
54
|
+
:slug, :meta_title, :rebuild_vat_prices, :promotionable, :track_inventory,
|
|
55
|
+
taxon_ids: [],
|
|
56
|
+
option_type_ids: [],
|
|
57
|
+
product_properties_attributes: [:id, *permitted_product_properties_attributes],
|
|
58
|
+
variant_property_rules_attributes: [
|
|
59
|
+
:id, :apply_to_all,
|
|
60
|
+
option_value_ids: [],
|
|
61
|
+
values_attributes: [:id, :property_name, :value]
|
|
62
|
+
]
|
|
63
|
+
)
|
|
64
|
+
end
|
|
65
|
+
|
|
50
66
|
def set_default_tax_category
|
|
51
67
|
@product.tax_category_id ||= @default_tax_category&.id
|
|
52
68
|
end
|
|
@@ -50,7 +50,11 @@ module Spree
|
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
def refund_params
|
|
53
|
-
params.require(:refund).permit
|
|
53
|
+
params.require(:refund).permit(:amount, :refund_reason_id)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def permitted_resource_params
|
|
57
|
+
params.require(:refund).permit(:refund_reason_id)
|
|
54
58
|
end
|
|
55
59
|
|
|
56
60
|
def build_resource
|
|
@@ -20,6 +20,12 @@ module Spree
|
|
|
20
20
|
|
|
21
21
|
private
|
|
22
22
|
|
|
23
|
+
def permitted_resource_params
|
|
24
|
+
params.fetch(:reimbursement, {}).permit(
|
|
25
|
+
return_items_attributes: [:id, :amount, :override_reimbursement_type_id, :exchange_variant_id]
|
|
26
|
+
)
|
|
27
|
+
end
|
|
28
|
+
|
|
23
29
|
def recalculate_order
|
|
24
30
|
@reimbursement.order.recalculate
|
|
25
31
|
end
|
|
@@ -274,11 +274,25 @@ class Spree::Admin::ResourceController < Spree::Admin::BaseController
|
|
|
274
274
|
spree
|
|
275
275
|
end
|
|
276
276
|
|
|
277
|
-
#
|
|
277
|
+
# Any subclasses should override it to limit the params to a safe list of
|
|
278
|
+
# attributes.
|
|
278
279
|
#
|
|
279
|
-
#
|
|
280
|
+
# Previously, this method would permit all attributes, but that is not safe.
|
|
281
|
+
# That legacy behaviour is preserved here behind a configuration flag. We
|
|
282
|
+
# strongly recommend disabling the flag and implementing this method in your
|
|
283
|
+
# controller to explicitly permit only the attributes you want to allow.
|
|
280
284
|
def permitted_resource_params
|
|
281
|
-
|
|
285
|
+
if Spree::Backend::Config.permit_all_resource_params_fallback
|
|
286
|
+
Spree.deprecator.warn(
|
|
287
|
+
"Using `permit_all_resource_params_fallback` is not safe and will be " \
|
|
288
|
+
"removed in a future version of Solidus. Please implement " \
|
|
289
|
+
"`permitted_resource_params` in your controller to explicitly permit only " \
|
|
290
|
+
"the attributes you want to allow."
|
|
291
|
+
)
|
|
292
|
+
params[object_name].present? ? params.require(object_name).permit! : ActionController::Parameters.new.permit!
|
|
293
|
+
else
|
|
294
|
+
raise NotImplementedError, "You must implement permitted_resource_params in your controller"
|
|
295
|
+
end
|
|
282
296
|
end
|
|
283
297
|
|
|
284
298
|
def collection_actions
|
|
@@ -26,6 +26,18 @@ module Spree
|
|
|
26
26
|
|
|
27
27
|
private
|
|
28
28
|
|
|
29
|
+
def permitted_resource_params
|
|
30
|
+
attributes = permitted_return_authorization_attributes.map do |attribute|
|
|
31
|
+
next attribute unless attribute.is_a?(Hash) && attribute.key?(:return_items_attributes)
|
|
32
|
+
|
|
33
|
+
attribute.except(:customer_metadata).merge(
|
|
34
|
+
return_items_attributes: [:id, :_destroy, :amount, *attribute[:return_items_attributes]]
|
|
35
|
+
)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
params.require(:return_authorization).permit(attributes)
|
|
39
|
+
end
|
|
40
|
+
|
|
29
41
|
def load_form_data
|
|
30
42
|
load_return_items
|
|
31
43
|
load_reimbursement_types
|
|
@@ -5,6 +5,10 @@ module Spree
|
|
|
5
5
|
class ReturnItemsController < ResourceController
|
|
6
6
|
private
|
|
7
7
|
|
|
8
|
+
def permitted_resource_params
|
|
9
|
+
params.require(:return_item).permit(:acceptance_status, :reception_status_event)
|
|
10
|
+
end
|
|
11
|
+
|
|
8
12
|
def location_after_save
|
|
9
13
|
url_for([:edit, :admin, @return_item.customer_return.order, @return_item.customer_return])
|
|
10
14
|
end
|
|
@@ -20,6 +20,22 @@ module Spree
|
|
|
20
20
|
|
|
21
21
|
private
|
|
22
22
|
|
|
23
|
+
def permitted_resource_params
|
|
24
|
+
params.require(:shipping_method).permit(
|
|
25
|
+
:name, :admin_name, :code, :carrier, :service_level, :tracking_url,
|
|
26
|
+
:available_to_all, :available_to_users, :tax_category_id, :calculator_type,
|
|
27
|
+
store_ids: [],
|
|
28
|
+
stock_location_ids: [],
|
|
29
|
+
calculator_attributes: [:id, *calculator_attributes]
|
|
30
|
+
)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def calculator_attributes
|
|
34
|
+
@calculators.flat_map do |calculator_class|
|
|
35
|
+
calculator_class.permitted_preference_attributes
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
23
39
|
def set_shipping_category
|
|
24
40
|
return true if params["shipping_method"][:shipping_categories] == ""
|
|
25
41
|
@shipping_method.shipping_categories = Spree::ShippingCategory.where(id: params["shipping_method"][:shipping_categories])
|
|
@@ -7,6 +7,13 @@ module Spree
|
|
|
7
7
|
|
|
8
8
|
private
|
|
9
9
|
|
|
10
|
+
def permitted_resource_params
|
|
11
|
+
params.require(:stock_location).permit(
|
|
12
|
+
*permitted_stock_location_attributes,
|
|
13
|
+
:code, :admin_name, :default, :restock_inventory, :fulfillable, :check_stock_on_transfer
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
10
17
|
def set_country
|
|
11
18
|
@stock_location.country = Spree::Country.default
|
|
12
19
|
rescue ActiveRecord::RecordNotFound
|
|
@@ -14,18 +14,18 @@ module Spree
|
|
|
14
14
|
private
|
|
15
15
|
|
|
16
16
|
def permitted_resource_params
|
|
17
|
-
|
|
18
|
-
without_address_parameters =
|
|
19
|
-
|
|
17
|
+
store_params.tap do |permitted|
|
|
18
|
+
without_address_parameters = permitted[:address_attributes]&.except(:country_id, :state_id, :reverse_charge_status)&.compact_blank&.empty?
|
|
19
|
+
permitted.delete(:address_attributes) if without_address_parameters
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def store_params
|
|
24
|
-
params.require(:store).permit(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
params.require(:store).permit(
|
|
25
|
+
*permitted_store_attributes,
|
|
26
|
+
:code,
|
|
27
|
+
available_locales: []
|
|
28
|
+
)
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
end
|
|
@@ -7,6 +7,21 @@ module Spree
|
|
|
7
7
|
|
|
8
8
|
private
|
|
9
9
|
|
|
10
|
+
def permitted_resource_params
|
|
11
|
+
params.require(:tax_rate).permit(
|
|
12
|
+
:name, :amount, :included_in_price, :level, :zone_id, :show_rate_in_label,
|
|
13
|
+
:starts_at, :expires_at, :calculator_type,
|
|
14
|
+
tax_category_ids: [],
|
|
15
|
+
calculator_attributes: [:id, *calculator_attributes]
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def calculator_attributes
|
|
20
|
+
@calculators.flat_map do |calculator_class|
|
|
21
|
+
calculator_class.permitted_preference_attributes
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
10
25
|
def load_data
|
|
11
26
|
@available_zones = Spree::Zone.order(:name)
|
|
12
27
|
@available_categories = Spree::TaxCategory.order(:name)
|
|
@@ -5,6 +5,10 @@ module Spree
|
|
|
5
5
|
class TaxonomiesController < ResourceController
|
|
6
6
|
private
|
|
7
7
|
|
|
8
|
+
def permitted_resource_params
|
|
9
|
+
params.require(:taxonomy).permit(permitted_taxonomy_attributes)
|
|
10
|
+
end
|
|
11
|
+
|
|
8
12
|
def location_after_save
|
|
9
13
|
if @taxonomy.created_at == @taxonomy.updated_at
|
|
10
14
|
edit_admin_taxonomy_url(@taxonomy)
|
|
@@ -12,6 +12,10 @@ module Spree
|
|
|
12
12
|
|
|
13
13
|
private
|
|
14
14
|
|
|
15
|
+
def permitted_resource_params
|
|
16
|
+
params.require(:variant).permit(permitted_variant_attributes)
|
|
17
|
+
end
|
|
18
|
+
|
|
15
19
|
def new_before
|
|
16
20
|
@object.attributes = @object.product.master.attributes.except("id", "created_at", "deleted_at",
|
|
17
21
|
"sku", "is_master")
|
|
@@ -7,6 +7,8 @@ module Spree
|
|
|
7
7
|
class BackendConfiguration < Preferences::Configuration
|
|
8
8
|
preference :locale, :string, default: I18n.default_locale
|
|
9
9
|
|
|
10
|
+
preference :permit_all_resource_params_fallback, :boolean, default: false
|
|
11
|
+
|
|
10
12
|
# @!attribute [rw] themes
|
|
11
13
|
# @return [Hash] A hash containing the themes that are available for the admin panel
|
|
12
14
|
preference :themes, :hash, default: {
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: solidus_backend
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.8.
|
|
4
|
+
version: 4.8.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Solidus Team
|
|
@@ -15,28 +15,28 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - '='
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 4.8.
|
|
18
|
+
version: 4.8.1
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - '='
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 4.8.
|
|
25
|
+
version: 4.8.1
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: solidus_core
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
30
|
- - '='
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: 4.8.
|
|
32
|
+
version: 4.8.1
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - '='
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: 4.8.
|
|
39
|
+
version: 4.8.1
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: font-awesome-rails
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -880,7 +880,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
880
880
|
- !ruby/object:Gem::Version
|
|
881
881
|
version: 1.8.23
|
|
882
882
|
requirements: []
|
|
883
|
-
rubygems_version: 4.0.
|
|
883
|
+
rubygems_version: 4.0.10
|
|
884
884
|
specification_version: 4
|
|
885
885
|
summary: Admin interface for the Solidus e-commerce framework.
|
|
886
886
|
test_files: []
|