solidus_core 4.0.4 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +0 -1
  3. data/app/controllers/spree/base_controller.rb +0 -2
  4. data/app/models/spree/order.rb +16 -20
  5. data/app/models/spree/order_contents.rb +2 -2
  6. data/app/models/spree/order_merger.rb +2 -4
  7. data/app/models/spree/order_updater.rb +3 -1
  8. data/app/models/spree/refund.rb +1 -1
  9. data/app/models/spree/taxon/paperclip_attachment.rb +1 -1
  10. data/bin/rails +13 -0
  11. data/config/locales/en.yml +0 -1
  12. data/lib/generators/solidus/install/app_templates/frontend/starter.rb +1 -1
  13. data/lib/spree/app_configuration.rb +8 -0
  14. data/lib/spree/bus.rb +2 -0
  15. data/lib/spree/core/importer/order.rb +1 -1
  16. data/lib/spree/core/version.rb +2 -2
  17. data/lib/spree/deprecation.rb +1 -1
  18. data/lib/spree/permission_sets/configuration_display.rb +19 -1
  19. data/lib/spree/permission_sets/configuration_management.rb +18 -1
  20. data/lib/spree/permission_sets/dashboard_display.rb +5 -0
  21. data/lib/spree/permission_sets/default_customer.rb +29 -0
  22. data/lib/spree/permission_sets/order_display.rb +19 -0
  23. data/lib/spree/permission_sets/order_management.rb +18 -0
  24. data/lib/spree/permission_sets/product_display.rb +14 -0
  25. data/lib/spree/permission_sets/product_management.rb +16 -0
  26. data/lib/spree/permission_sets/promotion_display.rb +10 -0
  27. data/lib/spree/permission_sets/promotion_management.rb +10 -0
  28. data/lib/spree/permission_sets/restricted_stock_display.rb +5 -0
  29. data/lib/spree/permission_sets/restricted_stock_management.rb +5 -0
  30. data/lib/spree/permission_sets/stock_display.rb +4 -0
  31. data/lib/spree/permission_sets/stock_management.rb +4 -0
  32. data/lib/spree/permission_sets/super_user.rb +5 -0
  33. data/lib/spree/permission_sets/user_display.rb +4 -0
  34. data/lib/spree/permission_sets/user_management.rb +9 -0
  35. data/lib/spree/testing_support/dummy_app.rb +0 -1
  36. data/solidus_core.gemspec +2 -2
  37. metadata +6 -28
  38. data/lib/spree/testing_support/dummy_app/assets/javascripts/spree/frontend/all.js +0 -10
  39. data/lib/spree/testing_support/dummy_app/assets/stylesheets/spree/frontend/all.css +0 -9
  40. 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: b9cb442aaeedb3f5f1f62c48b3746980e8e0bcae402fa8434186029265f111aa
4
- data.tar.gz: 13b8cae1e4338448993f4ead860d19885525aa1c7f8ac4e59d919552ea922cc6
3
+ metadata.gz: c3e2c6952c5346f716b691621d06c35fa50cdd42a1071b449495be31f2358c15
4
+ data.tar.gz: cf282e7b402f07c2a33f300fbe61aef661fbb31f5b1a6889887149d2bfcadca1
5
5
  SHA512:
6
- metadata.gz: 8f0babaa1f2d34922afad8af6b7db62a5929c497128c39b3484bc06cc6744c4ff3ef1f6d31009b124b94b70f47a80088ea7910d1bba5275ae1f3c9fa914f723d
7
- data.tar.gz: ddffe45d919c49b42ef92af41efb8b7bc0e70297c71b3773c035e1aad9cfab5bb8406ab3bf4eae0fbdd65b1ca69aa073856fe4dce051afe7b84e3fb42c8d4098
6
+ metadata.gz: 8240824eb568d985249690d9a49382a6b25d2d4f7f5c6d8d17d30bfa2fd0cb9af579e5ee01b16828cbacdadad3b9b4524d804ce42aaab08e94b211ce08f8d439
7
+ data.tar.gz: 20b8afa05c9068af3635aadb658302f0ecee745a50bbb0b6230db6fbec758de6cb594a22ddc147e8c655e9cd1ac8babb827701979bc912836b091273f7d2e1af
data/Rakefile CHANGED
@@ -5,7 +5,6 @@ require 'rake'
5
5
  require 'rake/testtask'
6
6
  require 'rspec/core/rake_task'
7
7
  require 'spree/testing_support/dummy_app/rake_tasks'
8
- require 'bundler/gem_tasks'
9
8
 
10
9
  RSpec::Core::RakeTask.new
11
10
  task default: :spec
@@ -11,6 +11,4 @@ class Spree::BaseController < ApplicationController
11
11
  include Spree::Core::ControllerHelpers::Search
12
12
  include Spree::Core::ControllerHelpers::Store
13
13
  include Spree::Core::ControllerHelpers::StrongParameters
14
-
15
- respond_to :html
16
14
  end
@@ -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 updater
262
- @updater ||= Spree::OrderUpdater.new(self)
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
- updater.update_shipment_state
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
- # At some point the might need to force the order to transition from address
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
 
@@ -522,7 +522,7 @@ module Spree
522
522
  state: 'cart',
523
523
  updated_at: Time.current
524
524
  )
525
- self.next if line_items.any?
525
+ self.next
526
526
  end
527
527
 
528
528
  def refresh_shipment_rates
@@ -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
- updater.update_payment_state
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
- updater.update_shipment_state
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.ensure_updated_shipments
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.ensure_updated_shipments
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 updater to ensure that item counts and totals are
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
- updater.update
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 update
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
  #
@@ -90,7 +90,7 @@ module Spree
90
90
  end
91
91
 
92
92
  def update_order
93
- payment.order.updater.update
93
+ payment.order.recalculate
94
94
  end
95
95
  end
96
96
  end
@@ -25,6 +25,6 @@ module Spree::Taxon::PaperclipAttachment
25
25
  attached_file = send(definition)
26
26
  return false unless attached_file.exists?
27
27
 
28
- attached_file.destroy
28
+ attached_file.destroy && save
29
29
  end
30
30
  end
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"
@@ -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.0/template.rb'
1
+ apply 'https://github.com/solidusio/solidus_starter_frontend/raw/v4.1/template.rb'
@@ -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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'omnes'
2
4
 
3
5
  module Spree
@@ -40,7 +40,7 @@ module Spree
40
40
  end
41
41
 
42
42
  # Really ensure that the order totals & states are correct
43
- order.updater.update
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?
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spree
4
- VERSION = "4.0.4"
4
+ VERSION = "4.1.0"
5
5
 
6
6
  def self.solidus_version
7
7
  VERSION
8
8
  end
9
9
 
10
10
  def self.previous_solidus_minor_version
11
- '3.4'
11
+ '4.0'
12
12
  end
13
13
 
14
14
  def self.solidus_gem_version
@@ -3,7 +3,7 @@
3
3
  require 'active_support/deprecation'
4
4
 
5
5
  module Spree
6
- Deprecation = ActiveSupport::Deprecation.new('5.0', 'Solidus')
6
+ Deprecation = ActiveSupport::Deprecation.new('4.0', 'Solidus')
7
7
 
8
8
  # This DeprecatedInstanceVariableProxy transforms instance variable to
9
9
  # deprecated instance variable.
@@ -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
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
25
25
 
26
26
  %w[
27
27
  actionmailer actionpack actionview activejob activemodel activerecord
28
- activestorage activesupport railties
28
+ activesupport railties
29
29
  ].each do |rails_dep|
30
30
  s.add_dependency rails_dep, ['>= 7.0', '< 7.1']
31
31
  end
@@ -42,7 +42,7 @@ Gem::Specification.new do |s|
42
42
  s.add_dependency 'mini_magick', '~> 4.10'
43
43
  s.add_dependency 'monetize', '~> 1.8'
44
44
  s.add_dependency 'kt-paperclip', ['>= 6.3', '< 8']
45
- s.add_dependency 'psych', ['>= 4.0.1', '< 5.0']
45
+ s.add_dependency 'psych', ['>= 3.1.0', '< 5.0']
46
46
  s.add_dependency 'ransack', '~> 2.0'
47
47
  s.add_dependency 'sprockets-rails'
48
48
  s.add_dependency 'state_machines-activerecord', '~> 0.6'
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.0.4
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-02 00:00:00.000000000 Z
11
+ date: 2023-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer
@@ -130,26 +130,6 @@ dependencies:
130
130
  - - "<"
131
131
  - !ruby/object:Gem::Version
132
132
  version: '7.1'
133
- - !ruby/object:Gem::Dependency
134
- name: activestorage
135
- requirement: !ruby/object:Gem::Requirement
136
- requirements:
137
- - - ">="
138
- - !ruby/object:Gem::Version
139
- version: '7.0'
140
- - - "<"
141
- - !ruby/object:Gem::Version
142
- version: '7.1'
143
- type: :runtime
144
- prerelease: false
145
- version_requirements: !ruby/object:Gem::Requirement
146
- requirements:
147
- - - ">="
148
- - !ruby/object:Gem::Version
149
- version: '7.0'
150
- - - "<"
151
- - !ruby/object:Gem::Version
152
- version: '7.1'
153
133
  - !ruby/object:Gem::Dependency
154
134
  name: activesupport
155
135
  requirement: !ruby/object:Gem::Requirement
@@ -376,7 +356,7 @@ dependencies:
376
356
  requirements:
377
357
  - - ">="
378
358
  - !ruby/object:Gem::Version
379
- version: 4.0.1
359
+ version: 3.1.0
380
360
  - - "<"
381
361
  - !ruby/object:Gem::Version
382
362
  version: '5.0'
@@ -386,7 +366,7 @@ dependencies:
386
366
  requirements:
387
367
  - - ">="
388
368
  - !ruby/object:Gem::Version
389
- version: 4.0.1
369
+ version: 3.1.0
390
370
  - - "<"
391
371
  - !ruby/object:Gem::Version
392
372
  version: '5.0'
@@ -736,6 +716,7 @@ files:
736
716
  - app/views/spree/shared/_error_messages.html.erb
737
717
  - app/views/spree/test_mailer/test_email.html.erb
738
718
  - app/views/spree/test_mailer/test_email.text.erb
719
+ - bin/rails
739
720
  - config/i18n-tasks.yml
740
721
  - config/initializers/assets.rb
741
722
  - config/initializers/friendly_id.rb
@@ -914,15 +895,12 @@ files:
914
895
  - lib/spree/testing_support/controller_requests.rb
915
896
  - lib/spree/testing_support/dummy_app.rb
916
897
  - lib/spree/testing_support/dummy_app/assets/javascripts/spree/backend/all.js
917
- - lib/spree/testing_support/dummy_app/assets/javascripts/spree/frontend/all.js
918
898
  - lib/spree/testing_support/dummy_app/assets/stylesheets/spree/backend/all.css
919
- - lib/spree/testing_support/dummy_app/assets/stylesheets/spree/frontend/all.css
920
899
  - lib/spree/testing_support/dummy_app/database.yml
921
900
  - lib/spree/testing_support/dummy_app/mailer_previews/test_mailer_preview.rb
922
901
  - lib/spree/testing_support/dummy_app/migrations.rb
923
902
  - lib/spree/testing_support/dummy_app/rake_tasks.rb
924
903
  - lib/spree/testing_support/dummy_app/routes.rb
925
- - lib/spree/testing_support/dummy_app/views/layouts/application.html.erb
926
904
  - lib/spree/testing_support/extension_rake.rb
927
905
  - lib/spree/testing_support/factories/address_factory.rb
928
906
  - lib/spree/testing_support/factories/adjustment_factory.rb
@@ -1049,7 +1027,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1049
1027
  - !ruby/object:Gem::Version
1050
1028
  version: 1.8.23
1051
1029
  requirements: []
1052
- rubygems_version: 3.4.17
1030
+ rubygems_version: 3.3.7
1053
1031
  signing_key:
1054
1032
  specification_version: 4
1055
1033
  summary: Essential models, mailers, and classes for the Solidus e-commerce project.
@@ -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
- */