chore: move cloud guard to before action

This commit is contained in:
Sojan Jose
2026-06-26 14:42:32 -07:00
parent f5d80f2064
commit c9bfc5c6a8
@@ -7,16 +7,19 @@ class Platform::Api::V1::Internal::AccountsController < ActionController::API
DEFAULT_LIMIT = 100
MAX_LIMIT = 1000
before_action :ensure_chatwoot_cloud
before_action :authenticate_internal_token!
def index
return render_not_found unless ChatwootApp.chatwoot_cloud?
@accounts = filtered_accounts.limit(limit)
end
private
def ensure_chatwoot_cloud
render_not_found unless ChatwootApp.chatwoot_cloud?
end
def authenticate_internal_token!
return if internal_token.present? && secure_token_match?(request_token, internal_token)