Rewrite enterprise contact functionality

This commit is contained in:
Matt-Yorkley
2017-07-28 17:03:00 +01:00
committed by Rob Harrington
parent 22eae753fe
commit ba98c7e2c5
33 changed files with 83 additions and 104 deletions

View File

@@ -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