solidus_core 4.0.0 → 4.1.0
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/README.md +1 -1
- data/app/controllers/spree/base_controller.rb +0 -2
- data/app/models/spree/order.rb +15 -19
- data/app/models/spree/order_contents.rb +2 -2
- data/app/models/spree/order_merger.rb +2 -4
- data/app/models/spree/order_updater.rb +3 -1
- data/app/models/spree/refund.rb +1 -1
- data/app/models/spree/taxon/paperclip_attachment.rb +1 -1
- data/app/models/spree/taxon.rb +1 -1
- data/bin/rails +13 -0
- data/config/locales/en.yml +0 -1
- data/lib/generators/solidus/install/app_templates/frontend/starter.rb +1 -1
- data/lib/generators/solidus/install/install_generator.rb +1 -1
- data/lib/spree/app_configuration.rb +8 -0
- data/lib/spree/bus.rb +2 -0
- data/lib/spree/core/importer/order.rb +1 -1
- data/lib/spree/core/version.rb +2 -2
- data/lib/spree/migration_helpers.rb +3 -3
- data/lib/spree/permission_sets/configuration_display.rb +19 -1
- data/lib/spree/permission_sets/configuration_management.rb +18 -1
- data/lib/spree/permission_sets/dashboard_display.rb +5 -0
- data/lib/spree/permission_sets/default_customer.rb +29 -0
- data/lib/spree/permission_sets/order_display.rb +19 -0
- data/lib/spree/permission_sets/order_management.rb +18 -0
- data/lib/spree/permission_sets/product_display.rb +14 -0
- data/lib/spree/permission_sets/product_management.rb +16 -0
- data/lib/spree/permission_sets/promotion_display.rb +10 -0
- data/lib/spree/permission_sets/promotion_management.rb +10 -0
- data/lib/spree/permission_sets/restricted_stock_display.rb +5 -0
- data/lib/spree/permission_sets/restricted_stock_management.rb +5 -0
- data/lib/spree/permission_sets/stock_display.rb +4 -0
- data/lib/spree/permission_sets/stock_management.rb +4 -0
- data/lib/spree/permission_sets/super_user.rb +5 -0
- data/lib/spree/permission_sets/user_display.rb +4 -0
- data/lib/spree/permission_sets/user_management.rb +9 -0
- data/lib/spree/testing_support/dummy_app.rb +0 -1
- data/solidus_core.gemspec +1 -1
- metadata +7 -9
- data/lib/spree/testing_support/dummy_app/assets/javascripts/spree/frontend/all.js +0 -10
- data/lib/spree/testing_support/dummy_app/assets/stylesheets/spree/frontend/all.css +0 -9
- data/lib/spree/testing_support/dummy_app/views/layouts/application.html.erb +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3e2c6952c5346f716b691621d06c35fa50cdd42a1071b449495be31f2358c15
|
4
|
+
data.tar.gz: cf282e7b402f07c2a33f300fbe61aef661fbb31f5b1a6889887149d2bfcadca1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8240824eb568d985249690d9a49382a6b25d2d4f7f5c6d8d17d30bfa2fd0cb9af579e5ee01b16828cbacdadad3b9b4524d804ce42aaab08e94b211ce08f8d439
|
7
|
+
data.tar.gz: 20b8afa05c9068af3635aadb658302f0ecee745a50bbb0b6230db6fbec758de6cb594a22ddc147e8c655e9cd1ac8babb827701979bc912836b091273f7d2e1af
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@ Solidus system depends.
|
|
5
5
|
|
6
6
|
Core models
|
7
7
|
-----------
|
8
|
-
Solidus implements over 200 [models](https://github.com/solidusio/solidus/tree/
|
8
|
+
Solidus implements over 200 [models](https://github.com/solidusio/solidus/tree/main/core/app/models/spree),
|
9
9
|
and thus a deep inspection of each in this README would be overkill. Instead,
|
10
10
|
let's take a quick look at the fundamental models upon which all else depend.
|
11
11
|
Currently, these models remain in the Spree namespace as part of the legacy of
|
data/app/models/spree/order.rb
CHANGED
@@ -154,6 +154,8 @@ module Spree
|
|
154
154
|
find_by! number: value
|
155
155
|
end
|
156
156
|
|
157
|
+
delegate :recalculate, to: :recalculator
|
158
|
+
|
157
159
|
delegate :name, to: :bill_address, prefix: true, allow_nil: true
|
158
160
|
alias_method :billing_name, :bill_address_name
|
159
161
|
|
@@ -258,13 +260,11 @@ module Spree
|
|
258
260
|
end || store&.default_cart_tax_location
|
259
261
|
end
|
260
262
|
|
261
|
-
def
|
262
|
-
@
|
263
|
-
end
|
264
|
-
|
265
|
-
def recalculate
|
266
|
-
updater.update
|
263
|
+
def recalculator
|
264
|
+
@recalculator ||= Spree::Config.order_recalculator_class.new(self)
|
267
265
|
end
|
266
|
+
alias_method :updater, :recalculator
|
267
|
+
deprecate updater: :recalculator, deprecator: Spree::Deprecation
|
268
268
|
|
269
269
|
def assign_billing_to_shipping_address
|
270
270
|
self.ship_address = bill_address if bill_address
|
@@ -397,7 +397,7 @@ module Spree
|
|
397
397
|
|
398
398
|
def fulfill!
|
399
399
|
shipments.each { |shipment| shipment.update_state if shipment.persisted? }
|
400
|
-
|
400
|
+
recalculator.update_shipment_state
|
401
401
|
save!
|
402
402
|
end
|
403
403
|
|
@@ -502,12 +502,9 @@ module Spree
|
|
502
502
|
recalculate
|
503
503
|
end
|
504
504
|
|
505
|
-
# Clean shipments and make order back to address state
|
506
|
-
#
|
507
|
-
|
508
|
-
# to delivery again so that proper updated shipments are created.
|
509
|
-
# e.g. customer goes back from payment step and changes order items
|
510
|
-
def ensure_updated_shipments
|
505
|
+
# Clean shipments and make order back to address state (or to whatever state
|
506
|
+
# is set by restart_checkout_flow in case of state machine modifications)
|
507
|
+
def check_shipments_and_restart_checkout
|
511
508
|
if !completed? && shipments.all?(&:pending?)
|
512
509
|
shipments.destroy_all
|
513
510
|
update_column(:shipment_total, 0)
|
@@ -515,6 +512,9 @@ module Spree
|
|
515
512
|
end
|
516
513
|
end
|
517
514
|
|
515
|
+
alias_method :ensure_updated_shipments, :check_shipments_and_restart_checkout
|
516
|
+
deprecate ensure_updated_shipments: :check_shipments_and_restart_checkout, deprecator: Spree::Deprecation
|
517
|
+
|
518
518
|
def restart_checkout_flow
|
519
519
|
return if state == 'cart'
|
520
520
|
|
@@ -540,9 +540,7 @@ module Spree
|
|
540
540
|
def canceled_by(user)
|
541
541
|
transaction do
|
542
542
|
cancel!
|
543
|
-
# rubocop:disable Rails/SkipsModelValidations
|
544
543
|
update_column(:canceler_id, user.id)
|
545
|
-
# rubocop:enable Rails/SkipsModelValidations
|
546
544
|
end
|
547
545
|
end
|
548
546
|
|
@@ -744,13 +742,13 @@ module Spree
|
|
744
742
|
all_adjustments.each(&:finalize!)
|
745
743
|
|
746
744
|
# update payment and shipment(s) states, and save
|
747
|
-
|
745
|
+
recalculator.update_payment_state
|
748
746
|
shipments.each do |shipment|
|
749
747
|
shipment.update_state
|
750
748
|
shipment.finalize!
|
751
749
|
end
|
752
750
|
|
753
|
-
|
751
|
+
recalculator.update_shipment_state
|
754
752
|
save!
|
755
753
|
|
756
754
|
touch :completed_at
|
@@ -833,9 +831,7 @@ module Spree
|
|
833
831
|
cancel_payments!
|
834
832
|
|
835
833
|
send_cancel_email
|
836
|
-
# rubocop:disable Rails/SkipsModelValidations
|
837
834
|
update_column(:canceled_at, Time.current)
|
838
|
-
# rubocop:enable Rails/SkipsModelValidations
|
839
835
|
recalculate
|
840
836
|
end
|
841
837
|
|
@@ -42,7 +42,7 @@ module Spree
|
|
42
42
|
# If we do not update first, then the item total will be wrong and ItemTotal
|
43
43
|
# promotion rules would not be triggered.
|
44
44
|
reload_totals
|
45
|
-
order.
|
45
|
+
order.check_shipments_and_restart_checkout
|
46
46
|
PromotionHandler::Cart.new(order).activate
|
47
47
|
end
|
48
48
|
reload_totals
|
@@ -73,7 +73,7 @@ module Spree
|
|
73
73
|
def after_add_or_remove(line_item, options = {})
|
74
74
|
reload_totals
|
75
75
|
shipment = options[:shipment]
|
76
|
-
shipment.present? ? shipment.update_amounts : order.
|
76
|
+
shipment.present? ? shipment.update_amounts : order.check_shipments_and_restart_checkout
|
77
77
|
PromotionHandler::Cart.new(order, line_item).activate
|
78
78
|
reload_totals
|
79
79
|
line_item
|
@@ -13,8 +13,6 @@ module Spree
|
|
13
13
|
# @return [Spree::Order] The order which items wll be merged into.
|
14
14
|
attr_accessor :order
|
15
15
|
|
16
|
-
delegate :updater, to: :order
|
17
|
-
|
18
16
|
# Create the OrderMerger
|
19
17
|
#
|
20
18
|
# @api public
|
@@ -133,13 +131,13 @@ module Spree
|
|
133
131
|
|
134
132
|
# Save the order totals after merge
|
135
133
|
#
|
136
|
-
# It triggers the order
|
134
|
+
# It triggers the order recalculator to ensure that item counts and totals are
|
137
135
|
# up to date.
|
138
136
|
#
|
139
137
|
# @api private
|
140
138
|
# @return [void]
|
141
139
|
def persist_merge
|
142
|
-
|
140
|
+
order.recalculate
|
143
141
|
end
|
144
142
|
end
|
145
143
|
end
|
@@ -16,7 +16,7 @@ module Spree
|
|
16
16
|
# This method should never do anything to the Order that results in a save call on the
|
17
17
|
# object with callbacks (otherwise you will end up in an infinite recursion as the
|
18
18
|
# associations try to save and then in turn try to call +update!+ again.)
|
19
|
-
def
|
19
|
+
def recalculate
|
20
20
|
order.transaction do
|
21
21
|
update_item_count
|
22
22
|
update_shipment_amounts
|
@@ -30,6 +30,8 @@ module Spree
|
|
30
30
|
persist_totals
|
31
31
|
end
|
32
32
|
end
|
33
|
+
alias_method :update, :recalculate
|
34
|
+
deprecate update: :recalculate, deprecator: Spree::Deprecation
|
33
35
|
|
34
36
|
# Updates the +shipment_state+ attribute according to the following logic:
|
35
37
|
#
|
data/app/models/spree/refund.rb
CHANGED
data/app/models/spree/taxon.rb
CHANGED
@@ -22,7 +22,7 @@ module Spree
|
|
22
22
|
validates :meta_keywords, length: { maximum: 255 }
|
23
23
|
validates :meta_description, length: { maximum: 255 }
|
24
24
|
validates :meta_title, length: { maximum: 255 }
|
25
|
-
validates :taxonomy_id, uniqueness: { message: :can_have_only_one_root }, if: -> { root? }
|
25
|
+
validates :taxonomy_id, uniqueness: { scope: :parent_id, message: :can_have_only_one_root }, if: -> { root? }
|
26
26
|
|
27
27
|
after_save :touch_ancestors_and_taxonomy
|
28
28
|
after_touch :touch_ancestors_and_taxonomy
|
data/bin/rails
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails gems
|
3
|
+
# installed from the root of your application.
|
4
|
+
|
5
|
+
ENGINE_ROOT = File.expand_path('..', __dir__)
|
6
|
+
ENGINE_PATH = File.expand_path('../lib/spree/core/engine', __dir__)
|
7
|
+
|
8
|
+
# Set up gems listed in the Gemfile.
|
9
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __dir__)
|
10
|
+
require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
|
11
|
+
|
12
|
+
require "rails/all"
|
13
|
+
require "rails/engine/commands"
|
data/config/locales/en.yml
CHANGED
@@ -1598,7 +1598,6 @@ en:
|
|
1598
1598
|
gateway_config_unavailable: Gateway unavailable for environment
|
1599
1599
|
gateway_error: Gateway Error
|
1600
1600
|
general: General
|
1601
|
-
general_settings: Store
|
1602
1601
|
google_analytics: Google Analytics
|
1603
1602
|
google_analytics_id: Analytics ID
|
1604
1603
|
group_size: Group size
|
@@ -1 +1 @@
|
|
1
|
-
apply 'https://github.com/solidusio/solidus_starter_frontend/raw/v4.
|
1
|
+
apply 'https://github.com/solidusio/solidus_starter_frontend/raw/v4.1/template.rb'
|
@@ -96,7 +96,7 @@ module Solidus
|
|
96
96
|
rake 'active_storage:install'
|
97
97
|
else
|
98
98
|
say_status :assets, "Paperclip", :green
|
99
|
-
gsub_file 'config/initializers/spree.rb', "ActiveStorageAttachment", "PaperclipAttachment"
|
99
|
+
gsub_file 'config/initializers/spree.rb', "::ActiveStorageAttachment", "::PaperclipAttachment"
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
@@ -357,6 +357,14 @@ module Spree
|
|
357
357
|
# with the same signature as Spree::OrderUpdateAttributes.
|
358
358
|
class_name_attribute :order_update_attributes_class, default: 'Spree::OrderUpdateAttributes'
|
359
359
|
|
360
|
+
# Allows providing a different order recalculator.
|
361
|
+
# @!attribute [rw] order_recalculator_class
|
362
|
+
# @see Spree::OrderUpdater
|
363
|
+
# @return [Class] an object that conforms to the API of
|
364
|
+
# the standard order recalculator class
|
365
|
+
# Spree::OrderUpdater.
|
366
|
+
class_name_attribute :order_recalculator_class, default: 'Spree::OrderUpdater'
|
367
|
+
|
360
368
|
# Allows providing your own Mailer for promotion code batch mailer.
|
361
369
|
#
|
362
370
|
# @!attribute [rw] promotion_code_batch_mailer_class
|
data/lib/spree/bus.rb
CHANGED
@@ -40,7 +40,7 @@ module Spree
|
|
40
40
|
end
|
41
41
|
|
42
42
|
# Really ensure that the order totals & states are correct
|
43
|
-
order.
|
43
|
+
order.recalculate
|
44
44
|
if shipments_attrs.present?
|
45
45
|
order.shipments.each_with_index do |shipment, index|
|
46
46
|
shipment.update_columns(cost: shipments_attrs[index][:cost].to_f) if shipments_attrs[index][:cost].present?
|
data/lib/spree/core/version.rb
CHANGED
@@ -6,9 +6,9 @@ module Spree
|
|
6
6
|
remove_index(table, column) if index_exists?(table, column)
|
7
7
|
end
|
8
8
|
|
9
|
-
def safe_add_index(table, column, options
|
10
|
-
if columns_exist?(table, column) && !index_exists?(table, column, options)
|
11
|
-
add_index(table, column, options)
|
9
|
+
def safe_add_index(table, column, **options)
|
10
|
+
if columns_exist?(table, column) && !index_exists?(table, column, **options)
|
11
|
+
add_index(table, column, **options)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -2,9 +2,27 @@
|
|
2
2
|
|
3
3
|
module Spree
|
4
4
|
module PermissionSets
|
5
|
+
# Read-only permissions for e-commerce settings.
|
6
|
+
#
|
7
|
+
# Roles with this permission will be able to view information, also from the admin
|
8
|
+
# panel, about:
|
9
|
+
#
|
10
|
+
# - Tax categories
|
11
|
+
# - Tax rates
|
12
|
+
# - Zones
|
13
|
+
# - Countries
|
14
|
+
# - States
|
15
|
+
# - Payment methods
|
16
|
+
# - Taxonomies
|
17
|
+
# - Shipping methods
|
18
|
+
# - Shipping categories
|
19
|
+
# - Stock locations
|
20
|
+
# - Stock movements
|
21
|
+
# - Refund reasons
|
22
|
+
# - Reimbursement types
|
23
|
+
# - Return reasons
|
5
24
|
class ConfigurationDisplay < PermissionSets::Base
|
6
25
|
def activate!
|
7
|
-
can [:edit, :admin], :general_settings
|
8
26
|
can [:read, :admin], Spree::TaxCategory
|
9
27
|
can [:read, :admin], Spree::TaxRate
|
10
28
|
can [:read, :admin], Spree::Zone
|
@@ -2,9 +2,26 @@
|
|
2
2
|
|
3
3
|
module Spree
|
4
4
|
module PermissionSets
|
5
|
+
# Read and write permissions for e-commerce settings.
|
6
|
+
#
|
7
|
+
# Roles with this permission set will have full control over:
|
8
|
+
#
|
9
|
+
# - Tax categories
|
10
|
+
# - Tax rates
|
11
|
+
# - Zones
|
12
|
+
# - Countries
|
13
|
+
# - States
|
14
|
+
# - Payment methods
|
15
|
+
# - Taxonomies
|
16
|
+
# - Shipping methods
|
17
|
+
# - Shipping categories
|
18
|
+
# - Stock locations
|
19
|
+
# - Stock movements
|
20
|
+
# - Refund reasons
|
21
|
+
# - Reimbursement types
|
22
|
+
# - Return reasons
|
5
23
|
class ConfigurationManagement < PermissionSets::Base
|
6
24
|
def activate!
|
7
|
-
can :manage, :general_settings
|
8
25
|
can :manage, Spree::TaxCategory
|
9
26
|
can :manage, Spree::TaxRate
|
10
27
|
can :manage, Spree::Zone
|
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
module Spree
|
4
4
|
module PermissionSets
|
5
|
+
# Permissions for viewing the admin dashboard.
|
6
|
+
#
|
7
|
+
# Roles with this permission set will be able to view the admin dashboard,
|
8
|
+
# which may or not contain sensitive information depending on
|
9
|
+
# customizations.
|
5
10
|
class DashboardDisplay < PermissionSets::Base
|
6
11
|
def activate!
|
7
12
|
can [:admin, :home], :dashboards
|
@@ -2,6 +2,35 @@
|
|
2
2
|
|
3
3
|
module Spree
|
4
4
|
module PermissionSets
|
5
|
+
# Permissions for e-commerce customers.
|
6
|
+
#
|
7
|
+
# This permission set is always added to the `:default` role, which in turn
|
8
|
+
# is the default role for all users without any explicit roles.
|
9
|
+
#
|
10
|
+
# Permissions include reading and updating orders when the ability's user
|
11
|
+
# has been assigned as the order's user, unless the order is already
|
12
|
+
# completed. Same is true for guest checkout orders.
|
13
|
+
#
|
14
|
+
# It grants read-only permissions for the following resources typically used
|
15
|
+
# during a checkout process:
|
16
|
+
#
|
17
|
+
# - Zones
|
18
|
+
# - Countries
|
19
|
+
# - States
|
20
|
+
# - Taxons
|
21
|
+
# - Taxonomies
|
22
|
+
# - Products
|
23
|
+
# - Properties
|
24
|
+
# - Product properties
|
25
|
+
# - Variants
|
26
|
+
# - Option types
|
27
|
+
# - Option values
|
28
|
+
# - Stock items
|
29
|
+
# - Stock locations
|
30
|
+
#
|
31
|
+
# Abilities with this role can also create refund authorizations for orders
|
32
|
+
# with the same user, as well as reading and updating the user record and
|
33
|
+
# their associated cards.
|
5
34
|
class DefaultCustomer < PermissionSets::Base
|
6
35
|
def activate!
|
7
36
|
can :read, Country
|
@@ -2,6 +2,25 @@
|
|
2
2
|
|
3
3
|
module Spree
|
4
4
|
module PermissionSets
|
5
|
+
# Read permissions for orders.
|
6
|
+
#
|
7
|
+
# This permission set allows users to view all related information about
|
8
|
+
# orders, also from the admin panel, including:
|
9
|
+
#
|
10
|
+
# - Orders
|
11
|
+
# - Payments
|
12
|
+
# - Shipments
|
13
|
+
# - Adjustments
|
14
|
+
# - Line items
|
15
|
+
# - Return authorizations
|
16
|
+
# - Customer returns
|
17
|
+
# - Order cancellations
|
18
|
+
# - Reimbursements
|
19
|
+
# - Return items
|
20
|
+
# - Refunds
|
21
|
+
#
|
22
|
+
# However, it does not allow any modifications to be made to any of these
|
23
|
+
# resources.
|
5
24
|
class OrderDisplay < PermissionSets::Base
|
6
25
|
def activate!
|
7
26
|
can [:read, :admin, :edit, :cart], Spree::Order
|
@@ -2,6 +2,24 @@
|
|
2
2
|
|
3
3
|
module Spree
|
4
4
|
module PermissionSets
|
5
|
+
# Full permissions for order management.
|
6
|
+
#
|
7
|
+
# This permission set grants full control over all order and related resources,
|
8
|
+
# including:
|
9
|
+
#
|
10
|
+
# - Orders
|
11
|
+
# - Payments
|
12
|
+
# - Shipments
|
13
|
+
# - Adjustments
|
14
|
+
# - Line items
|
15
|
+
# - Return authorizations
|
16
|
+
# - Customer returns
|
17
|
+
# - Order cancellations
|
18
|
+
# - Reimbursements
|
19
|
+
# - Return items
|
20
|
+
# - Refunds
|
21
|
+
#
|
22
|
+
# It also allows reading reimbursement types, but not modifying them.
|
5
23
|
class OrderManagement < PermissionSets::Base
|
6
24
|
def activate!
|
7
25
|
can :read, Spree::ReimbursementType
|
@@ -2,6 +2,20 @@
|
|
2
2
|
|
3
3
|
module Spree
|
4
4
|
module PermissionSets
|
5
|
+
# Read-only permissions for products.
|
6
|
+
#
|
7
|
+
# This permission set allows users to view all related information about
|
8
|
+
# products, also from the admin panel, including:
|
9
|
+
#
|
10
|
+
# - Products
|
11
|
+
# - Images
|
12
|
+
# - Variants
|
13
|
+
# - Option values
|
14
|
+
# - Product properties
|
15
|
+
# - Option types
|
16
|
+
# - Properties
|
17
|
+
# - Taxonomies
|
18
|
+
# - Taxons
|
5
19
|
class ProductDisplay < PermissionSets::Base
|
6
20
|
def activate!
|
7
21
|
can [:read, :admin, :edit], Spree::Product
|
@@ -2,6 +2,22 @@
|
|
2
2
|
|
3
3
|
module Spree
|
4
4
|
module PermissionSets
|
5
|
+
# Full permissions for product management.
|
6
|
+
#
|
7
|
+
# This permission set grants full control over all product and related resources,
|
8
|
+
# including:
|
9
|
+
#
|
10
|
+
# - Products
|
11
|
+
# - Images
|
12
|
+
# - Variants
|
13
|
+
# - Option values
|
14
|
+
# - Product properties
|
15
|
+
# - Option types
|
16
|
+
# - Properties
|
17
|
+
# - Taxonomies
|
18
|
+
# - Taxons
|
19
|
+
# - Classifications
|
20
|
+
# - Prices
|
5
21
|
class ProductManagement < PermissionSets::Base
|
6
22
|
def activate!
|
7
23
|
can :manage, Spree::Classification
|
@@ -2,6 +2,16 @@
|
|
2
2
|
|
3
3
|
module Spree
|
4
4
|
module PermissionSets
|
5
|
+
# Read-only permissions for promotions.
|
6
|
+
#
|
7
|
+
# This permission set allows users to view all related information about
|
8
|
+
# promotions, also from the admin panel, including:
|
9
|
+
#
|
10
|
+
# - Promotions
|
11
|
+
# - Promotion rules
|
12
|
+
# - Promotion actions
|
13
|
+
# - Promotion categories
|
14
|
+
# - Promotion codes
|
5
15
|
class PromotionDisplay < PermissionSets::Base
|
6
16
|
def activate!
|
7
17
|
can [:read, :admin, :edit], Spree::Promotion
|
@@ -2,6 +2,16 @@
|
|
2
2
|
|
3
3
|
module Spree
|
4
4
|
module PermissionSets
|
5
|
+
# Full permissions for promotion management.
|
6
|
+
#
|
7
|
+
# This permission set grants full control over all promotion and related resources,
|
8
|
+
# including:
|
9
|
+
#
|
10
|
+
# - Promotions
|
11
|
+
# - Promotion rules
|
12
|
+
# - Promotion actions
|
13
|
+
# - Promotion categories
|
14
|
+
# - Promotion codes
|
5
15
|
class PromotionManagement < PermissionSets::Base
|
6
16
|
def activate!
|
7
17
|
can :manage, Spree::Promotion
|
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
module Spree
|
4
4
|
module PermissionSets
|
5
|
+
# Read permissions for stock limited to allowed locations.
|
6
|
+
#
|
7
|
+
# This permission set allows users to view information about stock items and
|
8
|
+
# locations, both of them limited to locations they have access to.
|
9
|
+
# Permissions are also granted for the admin panel for items.
|
5
10
|
class RestrictedStockDisplay < PermissionSets::Base
|
6
11
|
def activate!
|
7
12
|
can [:read, :admin], Spree::StockItem, stock_location_id: location_ids
|
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
module Spree
|
4
4
|
module PermissionSets
|
5
|
+
# Full permissions for stock management limited to allowed locations.
|
6
|
+
#
|
7
|
+
# This permission set grants full control over all stock items a user has
|
8
|
+
# access to their locations. Those locations are also readable by the
|
9
|
+
# corresponding ability.
|
5
10
|
class RestrictedStockManagement < PermissionSets::Base
|
6
11
|
def activate!
|
7
12
|
can :manage, Spree::StockItem, stock_location_id: location_ids
|
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
module Spree
|
4
4
|
module PermissionSets
|
5
|
+
# Read-only permissions for stock.
|
6
|
+
#
|
7
|
+
# This permission set allows users to view information about stock items
|
8
|
+
# (also from the admin panel) and stock locations.
|
5
9
|
class StockDisplay < PermissionSets::Base
|
6
10
|
def activate!
|
7
11
|
can [:read, :admin], Spree::StockItem
|
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
module Spree
|
4
4
|
module PermissionSets
|
5
|
+
# Full permissions for stock management.
|
6
|
+
#
|
7
|
+
# This permission set grants full control over all stock items and read
|
8
|
+
# access to locations.
|
5
9
|
class StockManagement < PermissionSets::Base
|
6
10
|
def activate!
|
7
11
|
can :manage, Spree::StockItem
|
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
module Spree
|
4
4
|
module PermissionSets
|
5
|
+
# Full permissions for store administration.
|
6
|
+
#
|
7
|
+
# This permission set is always added to users with the `:admin` role.
|
8
|
+
#
|
9
|
+
# It grants permission to perform any read or write action on any resource.
|
5
10
|
class SuperUser < PermissionSets::Base
|
6
11
|
def activate!
|
7
12
|
can :manage, :all
|
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
module Spree
|
4
4
|
module PermissionSets
|
5
|
+
# Read-only permissions for users, roles and store credits.
|
6
|
+
#
|
7
|
+
# This permission set allows users to view all related information about
|
8
|
+
# users, roles and store credits, also from the admin panel.
|
5
9
|
class UserDisplay < PermissionSets::Base
|
6
10
|
def activate!
|
7
11
|
can [:read, :admin, :edit, :addresses, :orders, :items], Spree.user_class
|
@@ -2,6 +2,15 @@
|
|
2
2
|
|
3
3
|
module Spree
|
4
4
|
module PermissionSets
|
5
|
+
# Full permissions for user management.
|
6
|
+
#
|
7
|
+
# This permission set grants full control over all user and
|
8
|
+
# related resources, including:
|
9
|
+
#
|
10
|
+
# - Users
|
11
|
+
# - Store credits
|
12
|
+
# - Roles
|
13
|
+
# - API keys
|
5
14
|
class UserManagement < PermissionSets::Base
|
6
15
|
def activate!
|
7
16
|
can [:admin, :read, :create, :update, :save_in_address_book, :remove_from_address_book, :addresses, :orders, :items], Spree.user_class
|
@@ -119,7 +119,6 @@ module DummyApp
|
|
119
119
|
config.assets.paths << File.expand_path('dummy_app/assets/stylesheets', __dir__)
|
120
120
|
|
121
121
|
config.paths["config/database"] = File.expand_path('dummy_app/database.yml', __dir__)
|
122
|
-
config.paths['app/views'] = File.expand_path('dummy_app/views', __dir__)
|
123
122
|
config.paths['config/routes.rb'] = File.expand_path('dummy_app/routes.rb', __dir__)
|
124
123
|
|
125
124
|
ActionMailer::Base.default from: "store@example.com"
|
data/solidus_core.gemspec
CHANGED
@@ -65,7 +65,7 @@ $ bin/rails g solidus:update
|
|
65
65
|
Please, don't forget to look at the CHANGELOG to see what has changed and
|
66
66
|
whether you need to perform other tasks.
|
67
67
|
|
68
|
-
https://github.com/solidusio/solidus/blob/
|
68
|
+
https://github.com/solidusio/solidus/blob/main/CHANGELOG.md
|
69
69
|
|
70
70
|
Please report any issues at:
|
71
71
|
- https://github.com/solidusio/solidus/issues
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Solidus Team
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionmailer
|
@@ -716,6 +716,7 @@ files:
|
|
716
716
|
- app/views/spree/shared/_error_messages.html.erb
|
717
717
|
- app/views/spree/test_mailer/test_email.html.erb
|
718
718
|
- app/views/spree/test_mailer/test_email.text.erb
|
719
|
+
- bin/rails
|
719
720
|
- config/i18n-tasks.yml
|
720
721
|
- config/initializers/assets.rb
|
721
722
|
- config/initializers/friendly_id.rb
|
@@ -894,15 +895,12 @@ files:
|
|
894
895
|
- lib/spree/testing_support/controller_requests.rb
|
895
896
|
- lib/spree/testing_support/dummy_app.rb
|
896
897
|
- lib/spree/testing_support/dummy_app/assets/javascripts/spree/backend/all.js
|
897
|
-
- lib/spree/testing_support/dummy_app/assets/javascripts/spree/frontend/all.js
|
898
898
|
- lib/spree/testing_support/dummy_app/assets/stylesheets/spree/backend/all.css
|
899
|
-
- lib/spree/testing_support/dummy_app/assets/stylesheets/spree/frontend/all.css
|
900
899
|
- lib/spree/testing_support/dummy_app/database.yml
|
901
900
|
- lib/spree/testing_support/dummy_app/mailer_previews/test_mailer_preview.rb
|
902
901
|
- lib/spree/testing_support/dummy_app/migrations.rb
|
903
902
|
- lib/spree/testing_support/dummy_app/rake_tasks.rb
|
904
903
|
- lib/spree/testing_support/dummy_app/routes.rb
|
905
|
-
- lib/spree/testing_support/dummy_app/views/layouts/application.html.erb
|
906
904
|
- lib/spree/testing_support/extension_rake.rb
|
907
905
|
- lib/spree/testing_support/factories/address_factory.rb
|
908
906
|
- lib/spree/testing_support/factories/adjustment_factory.rb
|
@@ -1009,7 +1007,7 @@ post_install_message: |
|
|
1009
1007
|
Please, don't forget to look at the CHANGELOG to see what has changed and
|
1010
1008
|
whether you need to perform other tasks.
|
1011
1009
|
|
1012
|
-
https://github.com/solidusio/solidus/blob/
|
1010
|
+
https://github.com/solidusio/solidus/blob/main/CHANGELOG.md
|
1013
1011
|
|
1014
1012
|
Please report any issues at:
|
1015
1013
|
- https://github.com/solidusio/solidus/issues
|
@@ -1029,8 +1027,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1029
1027
|
- !ruby/object:Gem::Version
|
1030
1028
|
version: 1.8.23
|
1031
1029
|
requirements: []
|
1032
|
-
rubygems_version: 3.
|
1033
|
-
signing_key:
|
1030
|
+
rubygems_version: 3.3.7
|
1031
|
+
signing_key:
|
1034
1032
|
specification_version: 4
|
1035
1033
|
summary: Essential models, mailers, and classes for the Solidus e-commerce project.
|
1036
1034
|
test_files: []
|
@@ -1,10 +0,0 @@
|
|
1
|
-
// This is a manifest file that'll be compiled into including all the files listed below.
|
2
|
-
// Add new JavaScript code in separate files in this directory and they'll automatically
|
3
|
-
// be included in the compiled file accessible from http://example.com/assets/application.js
|
4
|
-
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
5
|
-
// the compiled file.
|
6
|
-
//
|
7
|
-
//= require jquery
|
8
|
-
//= require rails-ujs
|
9
|
-
//= require spree/frontend
|
10
|
-
//= require_tree .
|
@@ -1,9 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
3
|
-
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
4
|
-
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
5
|
-
*
|
6
|
-
*= require spree/frontend
|
7
|
-
*= require_self
|
8
|
-
*= require_tree .
|
9
|
-
*/
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= yield %>
|