Class: Eco::API::UseCases::GraphQL::Helpers::AccessLogs::Base::Reader

Inherits:
Object
  • Object
show all
Includes:
Base::ConnectionReader
Defined in:
lib/eco/api/usecases/graphql/helpers/access_logs/base/reader.rb

Overview

NATIVE reader over currentOrganization.activityLogs (the ActivityLogUnion behind the web "System Access Logs" page). Lazily paginates and yields Model::ActivityLog records.

Exposes the full server filter set. Construct via Helpers::AccessLogs::Base#access_logs:

access_logs(source: 'web', resource_type: 'view_dashboard').each { |log| ... }
access_logs(date_filter: { from: from_iso, to: to_iso }).to_a(limit: 500)

Constant Summary

Constants included from Base::ConnectionReader

Base::ConnectionReader::DEFAULT_PAGE_SIZE

Instance Method Summary collapse

Methods included from Base::ConnectionReader

#each, #page_size, #page_size=, #to_a

Constructor Details

#initialize(graphql, user_ids: nil, resource_ids: nil, filter_superusers: nil, activity_type: nil, resource_type: nil, source: nil, date_filter: nil) ⇒ Reader

Returns a new instance of Reader.

Parameters:

  • graphql (Ecoportal::API::GraphQL)

    the active gem client.

  • user_ids (Array<String>, nil) (defaults to: nil)
  • resource_ids (Array<String>, nil) (defaults to: nil)
  • filter_superusers (Boolean, nil) (defaults to: nil)
  • activity_type (String, nil) (defaults to: nil)

    free-text activity type filter.

  • resource_type (String, nil) (defaults to: nil)

    ActivityLogTypesEnum value (e.g. 'view_dashboard').

  • source (String, nil) (defaults to: nil)

    SourceEnum value (e.g. 'web', 'api').

  • date_filter (Hash, nil) (defaults to: nil)

    { from:, to: } (ISO8601), maps to DateRange.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/eco/api/usecases/graphql/helpers/access_logs/base/reader.rb', line 20

def initialize(
  graphql,
  user_ids:          nil,
  resource_ids:      nil,
  filter_superusers: nil,
  activity_type:     nil,
  resource_type:     nil,
  source:            nil,
  date_filter:       nil
)
  @graphql           = graphql
  @user_ids          = user_ids
  @resource_ids      = resource_ids
  @filter_superusers = filter_superusers
  @activity_type     = activity_type
  @resource_type     = resource_type
  @source            = source
  @date_filter       = date_filter
end