mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-25 05:45:15 +00:00
Rewrite enterprise contact functionality
This commit is contained in:
committed by
Rob Harrington
parent
22eae753fe
commit
ba98c7e2c5
@@ -2,6 +2,7 @@ module Api
|
||||
class EnterprisesController < Spree::Api::BaseController
|
||||
|
||||
before_filter :override_owner, only: [:create, :update]
|
||||
before_filter :set_contact, only: [:create]
|
||||
before_filter :check_type, only: :update
|
||||
before_filter :override_sells, only: [:create, :update]
|
||||
before_filter :override_visible, only: [:create, :update]
|
||||
@@ -53,6 +54,10 @@ module Api
|
||||
params[:enterprise][:owner_id] = current_api_user.id
|
||||
end
|
||||
|
||||
def set_contact
|
||||
params[:enterprise][:contact_id] = current_api_user.id
|
||||
end
|
||||
|
||||
def check_type
|
||||
params[:enterprise].delete :type unless current_api_user.admin?
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user