Files
chatwoot/app/controllers/api/v1/accounts/base_controller.rb

14 lines
448 B
Ruby

class Api::V1::Accounts::BaseController < Api::BaseController
include SwitchLocale
include EnsureCurrentAccountHelper
before_action :current_account
before_action :validate_token_api_access, if: :authenticate_by_access_token?
around_action :switch_locale_using_account_locale
private
def validate_token_api_access
render_unauthorized('Invalid Access Token') unless Current.account.feature_enabled?('api_and_webhooks')
end
end