Class: Booth::Core::Sessions::Index

Inherits:
Object
  • Object
show all
Includes:
Calls
Defined in:
lib/booth/core/sessions/index.rb

Instance Method Summary collapse

Instance Method Details

#callObject



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/booth/core/sessions/index.rb', line 28

def call
  # Booth currently doesn't perform pagination.
  # To avoid an attacking vector that could bring our database down,
  # we simply pull the handbrake when trying to fetch too many sessions.
  # Nobody should have that many active concurrent sessions.
  if base_scope.count > max_allowed_sessions
    raise "Too many sessions for Credential ID #{credential_id}"
  end

  base_scope.map do |session|
    ::Booth::ToStruct.call(exposed_attributes(session))
  end
end