Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Added :reposition to global WRITE actions of Platform API

Damian Legawiec89e571b84df4
diff --git a/api/app/controllers/spree/api/v2/platform/menu_items_controller.rb b/api/app/controllers/spree/api/v2/platform/menu_items_controller.rb
index 6442c560aa..36f80b2985 100644
--- a/api/app/controllers/spree/api/v2/platform/menu_items_controller.rb
+++ b/api/app/controllers/spree/api/v2/platform/menu_items_controller.rb
@@ -3,8 +3,6 @@ module Spree
module V2
module Platform
class MenuItemsController < ResourceController
- before_action -> { doorkeeper_authorize! :write, :admin }, only: WRITE_ACTIONS << :reposition
-
def reposition
spree_authorize! :update, @moved_item
diff --git a/api/app/controllers/spree/api/v2/platform/resource_controller.rb b/api/app/controllers/spree/api/v2/platform/resource_controller.rb
index 3656ea2c1c..b0da450f8e 100644
--- a/api/app/controllers/spree/api/v2/platform/resource_controller.rb
+++ b/api/app/controllers/spree/api/v2/platform/resource_controller.rb
@@ -4,7 +4,7 @@ module Spree
module Platform
class ResourceController < ::Spree::Api::V2::ResourceController
READ_ACTIONS = %i[show index]
- WRITE_ACTIONS = %i[create update destroy]
+ WRITE_ACTIONS = %i[create update destroy reposition]
# doorkeeper scopes usage: https://github.com/doorkeeper-gem/doorkeeper/wiki/Using-Scopes
before_action -> { doorkeeper_authorize! :read, :admin }, only: READ_ACTIONS