Class: Booth::Sessions::Index

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

Instance Method Summary collapse

Methods included from MethodObject

included

Instance Method Details

#callObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/booth/sessions/index.rb', line 9

def call
  # Booth currently doesn't support 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.
  raise "Too many sessions for Credential ID #{credential_id}" if base_scope.count > max_allowed_sessions

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