Module: Dbviewer

Defined in:
lib/dbviewer.rb,
lib/dbviewer/engine.rb,
lib/dbviewer/version.rb,
lib/dbviewer/cache/base.rb,
lib/dbviewer/query/logger.rb,
lib/dbviewer/query/parser.rb,
lib/dbviewer/storage/base.rb,
lib/dbviewer/configuration.rb,
lib/dbviewer/validator/sql.rb,
lib/dbviewer/query/analyzer.rb,
lib/dbviewer/query/executor.rb,
lib/dbviewer/cache/in_memory.rb,
lib/dbviewer/database/manager.rb,
app/helpers/dbviewer/ui_helper.rb,
lib/dbviewer/pii_configuration.rb,
lib/dbviewer/security/sql_parser.rb,
app/jobs/dbviewer/application_job.rb,
lib/dbviewer/storage/file_storage.rb,
lib/dbviewer/datatable/query_params.rb,
app/helpers/dbviewer/database_helper.rb,
lib/dbviewer/data_privacy/pii_masker.rb,
lib/dbviewer/security/access_control.rb,
app/helpers/dbviewer/formatting_helper.rb,
app/helpers/dbviewer/navigation_helper.rb,
app/models/dbviewer/application_record.rb,
lib/dbviewer/database/metadata_manager.rb,
lib/dbviewer/storage/in_memory_storage.rb,
app/helpers/dbviewer/application_helper.rb,
app/mailers/dbviewer/application_mailer.rb,
lib/dbviewer/datatable/query_operations.rb,
app/controllers/dbviewer/home_controller.rb,
app/controllers/dbviewer/logs_controller.rb,
app/helpers/dbviewer/datatable_ui_helper.rb,
lib/generators/dbviewer/install_generator.rb,
app/controllers/dbviewer/tables_controller.rb,
lib/dbviewer/query/notification_subscriber.rb,
lib/dbviewer/validator/sql/threat_detector.rb,
lib/dbviewer/database/dynamic_model_factory.rb,
lib/dbviewer/validator/sql/query_normalizer.rb,
app/controllers/dbviewer/api/base_controller.rb,
lib/dbviewer/validator/sql/validation_config.rb,
lib/dbviewer/validator/sql/validation_result.rb,
app/helpers/dbviewer/datatable_ui_form_helper.rb,
app/controllers/dbviewer/api/tables_controller.rb,
app/helpers/dbviewer/datatable_ui_table_helper.rb,
app/controllers/dbviewer/api/queries_controller.rb,
app/controllers/dbviewer/application_controller.rb,
app/controllers/dbviewer/connections_controller.rb,
app/helpers/dbviewer/datatable_ui_filter_helper.rb,
app/controllers/dbviewer/api/database_controller.rb,
app/helpers/dbviewer/datatable_ui_sorting_helper.rb,
app/helpers/dbviewer/datatable_ui_pagination_helper.rb,
app/controllers/concerns/dbviewer/database_operations.rb,
app/controllers/concerns/dbviewer/access_control_validation.rb,
app/controllers/concerns/dbviewer/disabled_state_validation.rb,
app/controllers/dbviewer/entity_relationship_diagrams_controller.rb,
app/controllers/concerns/dbviewer/database_operations/data_export.rb,
app/controllers/dbviewer/api/entity_relationship_diagrams_controller.rb,
app/controllers/concerns/dbviewer/database_operations/query_operations.rb,
app/controllers/concerns/dbviewer/database_operations/table_operations.rb,
app/controllers/concerns/dbviewer/database_operations/database_information.rb,
app/controllers/concerns/dbviewer/database_operations/datatable_operations.rb,
app/controllers/concerns/dbviewer/database_operations/connection_management.rb,
app/controllers/concerns/dbviewer/database_operations/relationship_management.rb

Defined Under Namespace

Modules: AccessControlValidation, Api, ApplicationHelper, Cache, DataPrivacy, Database, DatabaseHelper, DatabaseOperations, Datatable, DatatableUiFilterHelper, DatatableUiFormHelper, DatatableUiHelper, DatatableUiPaginationHelper, DatatableUiSortingHelper, DatatableUiTableHelper, DisabledStateValidation, FormattingHelper, Generators, NavigationHelper, Query, Security, Storage, UiHelper, Validator Classes: ApplicationController, ApplicationJob, ApplicationMailer, ApplicationRecord, Configuration, ConnectionsController, Engine, EntityRelationshipDiagramsController, HomeController, LogsController, PiiConfigurator, TablesController

Constant Summary collapse

VERSION =
"0.9.6"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject

Get configuration settings



42
43
44
# File 'lib/dbviewer.rb', line 42

def configuration
  @configuration ||= Configuration.new
end

Class Method Details

.configure {|configuration| ... } ⇒ Object

Configure the engine with a block

Examples:

Dbviewer.configure do |config|
  config.per_page_options = [10, 25, 50]
  config.default_per_page = 25
end

Yields:



53
54
55
# File 'lib/dbviewer.rb', line 53

def configure
  yield(configuration) if block_given?
end

.configure_pii {|PiiConfigurator.new(configuration)| ... } ⇒ Object

Configure PII masking rules using a block

Examples:

Dbviewer.configure_pii do |pii|
  pii.mask 'users.email', with: :email
  pii.mask 'users.phone', with: :phone
  pii.mask 'users.ssn', with: :ssn
  pii.mask 'customers.credit_card', with: :credit_card
  pii.mask 'profiles.secret', with: :full_redact
  pii.mask 'accounts.api_key', with: ->(value) { value ? 'api_***' : value }
  pii.custom_mask :my_custom, ->(value) { "CUSTOM: #{value[0]}***" }
end

Yields:



74
75
76
# File 'lib/dbviewer.rb', line 74

def configure_pii
  yield(PiiConfigurator.new(configuration)) if block_given?
end

.reset_configurationObject

Reset configuration to defaults



58
59
60
# File 'lib/dbviewer.rb', line 58

def reset_configuration
  @configuration = Configuration.new
end

.setupObject

This class method will be called by the engine when it’s appropriate



79
80
81
82
83
84
85
86
# File 'lib/dbviewer.rb', line 79

def setup
  Dbviewer::Query::Logger.configure(
    enable_query_logging: configuration.enable_query_logging,
    query_logging_mode: configuration.query_logging_mode
  )

  Rails.logger.info "DBViewer: Initialized successfully"
end