discourse/app/serializers/api_key_scope_serializer.rb

14 lines
312 B
Ruby

# frozen_string_literal: true
class ApiKeyScopeSerializer < ApplicationSerializer
attributes :resource,
:action,
:parameters,
:allowed_parameters
def parameters
ApiKeyScope.scope_mappings.dig(object.resource.to_sym, object.action.to_sym, :params).to_a
end
end