Class: LcpRuby::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/lcp_ruby/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# File 'lib/lcp_ruby/configuration.rb', line 148

def initialize
  @metadata_path = Rails.root.join("config", "lcp_ruby") if defined?(Rails)
  @role_method = :lcp_role
  @user_class = "User"
  @mount_path = "/"
  @auto_migrate = true
  @label_method_default = :to_s
  @parent_controller = "::ApplicationController"
  @strict_loading = :never
  @impersonator_roles = []
  @impersonatable_roles = nil
  @attachment_max_size = "50MB"
  @attachment_allowed_content_types = nil
  @breadcrumb_home_path = "/"
  @not_found_handler = :default
  @audit_writer = nil
  @landing_page = nil
  @menu_mode = :auto
  @model_extensions = {}
  @embed_providers = {}
  @mermaid_source = :cdn
  @webhook_allowed_hosts = nil
  @max_explicit_ids = 500
  @pagination_ends = false

  # Maximum depth of `inherits_from` cascade chains. Each level adds a
  # nested IN sub-query at scope-resolve time; deep chains stress
  # database planners (especially SQLite) and risk DoS via accidental
  # or hostile permission DSL. ConfigurationValidator enforces this
  # bound at boot. 6 covers every realistic domain (factory → line →
  # machine → reading → component → fault is already 6); raise it via
  # `LcpRuby.configuration.max_inheritance_depth = N` when justified.
  @max_inheritance_depth = 6

  # Name of the association that represents the multi-tenant boundary
  # (e.g. `:organization`, `:tenant`, `:account`). When set,
  # `ConfigurationValidator` warns at boot if any model declares a
  # `belongs_to` matching this name but is not reachable to that root
  # via the `inherits_from` cascade — i.e. silently leaks across
  # tenants. `nil` (default) disables the check; single-tenant apps
  # see no behavior change. See
  # `docs/guides/inherited-permissions.md` § "Multi-tenant cascade pattern".
  @tenant_association_name = nil

  # Theme defaults
  @theme = {
    default: :auto,
    allow_user_switch: true,
    density: { default: :comfortable },
    border_radius: { default: :rounded },
    overrides: {},
    palettes: {}
  }

  # i18n_check (lint) defaults — host overrides via
  #   LcpRuby.configuration.i18n_check = { locales: [:en, :cs], severity: :warning, ... }
  # Empty hash means "use I18nCheck::Configuration defaults" (which
  # warns when locales falls back to I18n.available_locales).
  @i18n_check = {}

  # invariant_check (boot validator) defaults — host overrides via
  #   LcpRuby.configuration.invariant_check = {
  #     severity: :error,
  #     severity_per_code: { "AUTH-005" => :off },
  #     fail_boot: true   # production-only; ignored in dev/test
  #   }
  # Lazy: nil here, the reader builds a default
  # `Authorization::InvariantCheck::Configuration` on first access so
  # host code can write `LcpRuby.configuration.invariant_check.severity`
  # directly (no Hash↔Configuration ambiguity at the API surface).
  @invariant_check = nil

  # Monitoring defaults
  @health_check = true
  @metrics_endpoint = true
  @metrics_histogram_buckets = [ 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10 ]
  @error_log_enabled = :auto
  @error_log_rate_limit = 1
  @error_log_capture_request_context = false

  # Phase 4 of type-system defaults — Decision 14. When true, presenter
  # column-set build enriches each `column :name` whose `renderer:` is
  # absent with the type-driven default from Types::TypeRegistry. So
  # `column :flag` on a :boolean field auto-renders as boolean_icon (✓/✗
  # glyph), and `column :status` on an :enum field auto-renders as a
  # badge — without the configurator writing renderer: explicitly.
  # Default false for one release (existing apps keep their current
  # rendering); flips to true thereafter and `lcp new` sets it true
  # from the start. Phase 4b runtime null_false validators are
  # unflagged because their delta is strictly additive.
  @runtime_type_renderers = false

  # Role source defaults
  @role_source = :implicit
  @role_model = "role"
  @role_model_fields = { name: "name", active: "active" }

  # Permission source defaults
  @permission_source = :yaml
  @permission_model = "permission_config"
  @permission_model_fields = { target_model: "target_model", definition: "definition", active: "active" }

  # Group source defaults
  @group_source = :none
  @group_method = :lcp_groups
  @group_model = "group"
  @group_model_fields = { name: "name", active: "active" }
  @group_membership_model = "group_membership"
  @group_membership_fields = { group: "group_id", user: "user_id" }
  @group_role_mapping_model = nil
  @group_role_mapping_fields = { group: "group_id", role: "role_name" }
  @group_adapter = nil
  @role_resolution_strategy = :merged

  # Audit model defaults
  @audit_model = "audit_log"
  @audit_model_fields = {
    auditable_type: "auditable_type",
    auditable_id: "auditable_id",
    action: "action",
    changes_data: "changes_data",
    user_id: "user_id",
    user_snapshot: "user_snapshot",
    metadata: "metadata"
  }

  # Workflow defaults
  @workflow_source = :static
  @workflow_model = "workflow_definition"
  @workflow_model_fields = {
    name: "name",
    model_name: "model_name",
    field_name: "field_name",
    states: "states",
    transitions: "transitions",
    version: "version",
    active: "active",
    audit_log: "audit_log",
    approvals: "approvals"
  }
  @workflow_provider = nil
  @approval_request_model = "workflow_approval_request"
  @approval_step_model = "workflow_approval_step"
  @approval_task_model = "workflow_approval_task"
  @hierarchy_resolver = nil
  @workflow_audit_model = "workflow_audit_log"
  @workflow_audit_model_fields = {
    record_type: "record_type",
    record_id: "record_id",
    workflow_name: "workflow_name",
    workflow_version: "workflow_version",
    transition_name: "transition_name",
    from_state: "from_state",
    to_state: "to_state",
    user_id: "user_id",
    user_snapshot: "user_snapshot",
    comment: "comment",
    metadata: "metadata"
  }

  # Background jobs defaults
  @job_source = :static
  @job_execution_model = "job_execution"
  @job_definition_model = "job_definition"
  @job_definition_model_fields = {
    name: "name", handler_type: "handler_type", handler_class: "handler_class",
    handler_config: "handler_config", queue: "queue", retry_count: "retry_count",
    retry_interval: "retry_interval", timeout: "timeout", unique_by: "unique_by",
    schedule: "schedule", active: "active"
  }
  @job_provider = nil
  @job_base_class = "ApplicationJob"
  @schedule_adapter = nil

  # Page source defaults
  @page_source = :yaml
  @page_model = "page_config"
  @page_model_fields = {
    name: "name",
    definition: "definition",
    active: "active"
  }

  # Authentication defaults
  @authentication = :external
  @auth_allow_registration = false
  @auth_password_min_length = 8
  @auth_session_timeout = nil
  @auth_lock_after_attempts = 0
  @auth_lock_duration = 30.minutes if defined?(ActiveSupport)
  @auth_mailer_sender = "noreply@example.com"
  @auth_after_login_path = "/"
  @auth_after_logout_path = nil

  # OIDC authentication hooks (used when authentication == :oidc)
  # host_url             — absolute base URL of the host app, required when any :oidc provider is configured.
  # user_provisioner     — callable (claims, provider_name) -> LcpRuby::User | nil, used when provisioning.reject_if_host_missing: true.
  # role_resolver        — callable (claim_values, provider_name, raw_claims) -> Array<String>, required when any provider has role_source: host.
  # claims_synchronizer  — callable (user, claims, provider_name, auth_hash) -> void, runs after role mapping
  #                        on every login. Mutate `user` directly (writes to columns, profile_data, attachments,
  #                        host associations …); UserResolver persists when changes are detected. Exceptions
  #                        in development raise; in production they are logged and the login continues so a
  #                        flaky external sync (e.g. Microsoft Graph timeout) doesn't lock people out.
  @host_url = nil
  @user_provisioner = nil
  @role_resolver = nil
  @claims_synchronizer = nil
end

Instance Attribute Details

#approval_request_modelObject

Returns the value of attribute approval_request_model.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def approval_request_model
  @approval_request_model
end

#approval_step_modelObject

Returns the value of attribute approval_step_model.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def approval_step_model
  @approval_step_model
end

#approval_task_modelObject

Returns the value of attribute approval_task_model.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def approval_task_model
  @approval_task_model
end

#attachment_allowed_content_typesObject

Returns the value of attribute attachment_allowed_content_types.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def attachment_allowed_content_types
  @attachment_allowed_content_types
end

#attachment_max_sizeObject

Returns the value of attribute attachment_max_size.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def attachment_max_size
  @attachment_max_size
end

#audit_modelObject

Returns the value of attribute audit_model.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def audit_model
  @audit_model
end

#audit_model_fieldsObject

Returns the value of attribute audit_model_fields.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def audit_model_fields
  @audit_model_fields
end

#audit_writerObject

Returns the value of attribute audit_writer.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def audit_writer
  @audit_writer
end

#auth_after_login_pathObject

Authentication settings



24
25
26
# File 'lib/lcp_ruby/configuration.rb', line 24

def 
  @auth_after_login_path
end

#auth_after_logout_pathObject

Authentication settings



24
25
26
# File 'lib/lcp_ruby/configuration.rb', line 24

def auth_after_logout_path
  @auth_after_logout_path
end

#auth_allow_registrationObject

Authentication settings



24
25
26
# File 'lib/lcp_ruby/configuration.rb', line 24

def auth_allow_registration
  @auth_allow_registration
end

#auth_lock_after_attemptsObject

Authentication settings



24
25
26
# File 'lib/lcp_ruby/configuration.rb', line 24

def auth_lock_after_attempts
  @auth_lock_after_attempts
end

#auth_lock_durationObject

Authentication settings



24
25
26
# File 'lib/lcp_ruby/configuration.rb', line 24

def auth_lock_duration
  @auth_lock_duration
end

#auth_mailer_senderObject

Authentication settings



24
25
26
# File 'lib/lcp_ruby/configuration.rb', line 24

def auth_mailer_sender
  @auth_mailer_sender
end

#auth_password_min_lengthObject

Authentication settings



24
25
26
# File 'lib/lcp_ruby/configuration.rb', line 24

def auth_password_min_length
  @auth_password_min_length
end

#auth_session_timeoutObject

Authentication settings



24
25
26
# File 'lib/lcp_ruby/configuration.rb', line 24

def auth_session_timeout
  @auth_session_timeout
end

#authenticationObject

Returns the value of attribute authentication.



37
38
39
# File 'lib/lcp_ruby/configuration.rb', line 37

def authentication
  @authentication
end

#auto_migrateObject

Returns the value of attribute auto_migrate.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def auto_migrate
  @auto_migrate
end

Returns the value of attribute breadcrumb_home_path.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def breadcrumb_home_path
  @breadcrumb_home_path
end

#claims_synchronizerObject

Authentication settings



24
25
26
# File 'lib/lcp_ruby/configuration.rb', line 24

def claims_synchronizer
  @claims_synchronizer
end

#dev_toolbarObject

Returns the value of attribute dev_toolbar.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def dev_toolbar
  @dev_toolbar
end

#embed_providersObject (readonly)

Returns the value of attribute embed_providers.



37
38
39
# File 'lib/lcp_ruby/configuration.rb', line 37

def embed_providers
  @embed_providers
end

#empty_valueObject

Returns the value of attribute empty_value.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def empty_value
  @empty_value
end

#error_log_capture_request_contextObject

Returns the value of attribute error_log_capture_request_context.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def error_log_capture_request_context
  @error_log_capture_request_context
end

#error_log_enabledObject

Returns the value of attribute error_log_enabled.



37
38
39
# File 'lib/lcp_ruby/configuration.rb', line 37

def error_log_enabled
  @error_log_enabled
end

#error_log_rate_limitObject

Returns the value of attribute error_log_rate_limit.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def error_log_rate_limit
  @error_log_rate_limit
end

#group_adapterObject

Returns the value of attribute group_adapter.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def group_adapter
  @group_adapter
end

#group_membership_fieldsObject

Returns the value of attribute group_membership_fields.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def group_membership_fields
  @group_membership_fields
end

#group_membership_modelObject

Returns the value of attribute group_membership_model.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def group_membership_model
  @group_membership_model
end

#group_methodObject

Returns the value of attribute group_method.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def group_method
  @group_method
end

#group_modelObject

Returns the value of attribute group_model.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def group_model
  @group_model
end

#group_model_fieldsObject

Returns the value of attribute group_model_fields.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def group_model_fields
  @group_model_fields
end

#group_role_mapping_fieldsObject

Returns the value of attribute group_role_mapping_fields.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def group_role_mapping_fields
  @group_role_mapping_fields
end

#group_role_mapping_modelObject

Returns the value of attribute group_role_mapping_model.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def group_role_mapping_model
  @group_role_mapping_model
end

#group_sourceObject

Returns the value of attribute group_source.



37
38
39
# File 'lib/lcp_ruby/configuration.rb', line 37

def group_source
  @group_source
end

#health_checkObject

Returns the value of attribute health_check.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def health_check
  @health_check
end

#hierarchy_resolverObject

Returns the value of attribute hierarchy_resolver.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def hierarchy_resolver
  @hierarchy_resolver
end

#host_urlObject

Authentication settings



24
25
26
# File 'lib/lcp_ruby/configuration.rb', line 24

def host_url
  @host_url
end

#i18n_checkObject

Returns the value of attribute i18n_check.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def i18n_check
  @i18n_check
end

#impersonatable_rolesObject

Returns the value of attribute impersonatable_roles.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def impersonatable_roles
  @impersonatable_roles
end

#impersonator_rolesObject

Returns the value of attribute impersonator_roles.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def impersonator_roles
  @impersonator_roles
end

#job_base_classObject

Returns the value of attribute job_base_class.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def job_base_class
  @job_base_class
end

#job_definition_modelObject

Returns the value of attribute job_definition_model.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def job_definition_model
  @job_definition_model
end

#job_definition_model_fieldsObject

Returns the value of attribute job_definition_model_fields.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def job_definition_model_fields
  @job_definition_model_fields
end

#job_execution_modelObject

Returns the value of attribute job_execution_model.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def job_execution_model
  @job_execution_model
end

#job_providerObject

Returns the value of attribute job_provider.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def job_provider
  @job_provider
end

#job_sourceObject

Returns the value of attribute job_source.



37
38
39
# File 'lib/lcp_ruby/configuration.rb', line 37

def job_source
  @job_source
end

#label_method_defaultObject

Returns the value of attribute label_method_default.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def label_method_default
  @label_method_default
end

#landing_pageObject

Returns the value of attribute landing_page.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def landing_page
  @landing_page
end

#max_explicit_idsObject

Returns the value of attribute max_explicit_ids.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def max_explicit_ids
  @max_explicit_ids
end

#max_inheritance_depthObject

Returns the value of attribute max_inheritance_depth.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def max_inheritance_depth
  @max_inheritance_depth
end

Returns the value of attribute menu_mode.



37
38
39
# File 'lib/lcp_ruby/configuration.rb', line 37

def menu_mode
  @menu_mode
end

#mermaid_sourceObject

Returns the value of attribute mermaid_source.



37
38
39
# File 'lib/lcp_ruby/configuration.rb', line 37

def mermaid_source
  @mermaid_source
end

#metadata_pathObject

Returns the value of attribute metadata_path.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def 
  @metadata_path
end

#metrics_endpointObject

Returns the value of attribute metrics_endpoint.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def metrics_endpoint
  @metrics_endpoint
end

#metrics_histogram_bucketsObject

Returns the value of attribute metrics_histogram_buckets.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def metrics_histogram_buckets
  @metrics_histogram_buckets
end

#model_extensionsObject (readonly)

Returns the value of attribute model_extensions.



37
38
39
# File 'lib/lcp_ruby/configuration.rb', line 37

def model_extensions
  @model_extensions
end

#mount_pathObject

Returns the value of attribute mount_path.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def mount_path
  @mount_path
end

#not_found_handlerObject

Returns the value of attribute not_found_handler.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def not_found_handler
  @not_found_handler
end

#page_modelObject

Returns the value of attribute page_model.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def page_model
  @page_model
end

#page_model_fieldsObject

Returns the value of attribute page_model_fields.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def page_model_fields
  @page_model_fields
end

#page_sourceObject

Returns the value of attribute page_source.



37
38
39
# File 'lib/lcp_ruby/configuration.rb', line 37

def page_source
  @page_source
end

#pagination_endsObject

Returns the value of attribute pagination_ends.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def pagination_ends
  @pagination_ends
end

#parent_controllerObject

Returns the value of attribute parent_controller.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def parent_controller
  @parent_controller
end

#permission_modelObject

Returns the value of attribute permission_model.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def permission_model
  @permission_model
end

#permission_model_fieldsObject

Returns the value of attribute permission_model_fields.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def permission_model_fields
  @permission_model_fields
end

#permission_sourceObject

Returns the value of attribute permission_source.



37
38
39
# File 'lib/lcp_ruby/configuration.rb', line 37

def permission_source
  @permission_source
end

#role_methodObject

Returns the value of attribute role_method.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def role_method
  @role_method
end

#role_modelObject

Returns the value of attribute role_model.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def role_model
  @role_model
end

#role_model_fieldsObject

Returns the value of attribute role_model_fields.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def role_model_fields
  @role_model_fields
end

#role_resolution_strategyObject

Returns the value of attribute role_resolution_strategy.



37
38
39
# File 'lib/lcp_ruby/configuration.rb', line 37

def role_resolution_strategy
  @role_resolution_strategy
end

#role_resolverObject

Authentication settings



24
25
26
# File 'lib/lcp_ruby/configuration.rb', line 24

def role_resolver
  @role_resolver
end

#role_sourceObject

Returns the value of attribute role_source.



37
38
39
# File 'lib/lcp_ruby/configuration.rb', line 37

def role_source
  @role_source
end

#runtime_type_renderersObject

Returns the value of attribute runtime_type_renderers.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def runtime_type_renderers
  @runtime_type_renderers
end

#schedule_adapterObject

Returns the value of attribute schedule_adapter.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def schedule_adapter
  @schedule_adapter
end

#strict_loadingObject

Returns the value of attribute strict_loading.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def strict_loading
  @strict_loading
end

#tenant_association_nameObject

Returns the value of attribute tenant_association_name.



21
22
23
# File 'lib/lcp_ruby/configuration.rb', line 21

def tenant_association_name
  @tenant_association_name
end

#themeObject

Returns the value of attribute theme.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def theme
  @theme
end

#user_classObject

Returns the value of attribute user_class.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def user_class
  @user_class
end

#user_provisionerObject

Authentication settings



24
25
26
# File 'lib/lcp_ruby/configuration.rb', line 24

def user_provisioner
  @user_provisioner
end

#webhook_allowed_hostsObject

Returns the value of attribute webhook_allowed_hosts.



5
6
7
# File 'lib/lcp_ruby/configuration.rb', line 5

def webhook_allowed_hosts
  @webhook_allowed_hosts
end

#workflow_audit_modelObject

Returns the value of attribute workflow_audit_model.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def workflow_audit_model
  @workflow_audit_model
end

#workflow_audit_model_fieldsObject

Returns the value of attribute workflow_audit_model_fields.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def workflow_audit_model_fields
  @workflow_audit_model_fields
end

#workflow_modelObject

Returns the value of attribute workflow_model.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def workflow_model
  @workflow_model
end

#workflow_model_fieldsObject

Returns the value of attribute workflow_model_fields.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def workflow_model_fields
  @workflow_model_fields
end

#workflow_providerObject

Returns the value of attribute workflow_provider.



41
42
43
# File 'lib/lcp_ruby/configuration.rb', line 41

def workflow_provider
  @workflow_provider
end

#workflow_sourceObject

Returns the value of attribute workflow_source.



37
38
39
# File 'lib/lcp_ruby/configuration.rb', line 37

def workflow_source
  @workflow_source
end

Instance Method Details

#embed_csp_sourcesObject



365
366
367
368
369
370
371
372
373
374
375
376
377
# File 'lib/lcp_ruby/configuration.rb', line 365

def embed_csp_sources
  @embed_providers.values.filter_map do |provider|
    next unless provider.respond_to?(:site_url) && provider.site_url

    uri = URI.parse(provider.site_url)
    next unless uri.scheme && uri.host

    port_suffix = uri.port && ![ 80, 443 ].include?(uri.port) ? ":#{uri.port}" : ""
    "#{uri.scheme}://#{uri.host}#{port_suffix}"
  rescue URI::InvalidURIError
    nil
  end.uniq
end

#embed_provider(name) ⇒ Object



361
362
363
# File 'lib/lcp_ruby/configuration.rb', line 361

def embed_provider(name)
  @embed_providers[name.to_s]
end

#impersonation_rolesObject

Deprecated: prefer ‘impersonator_roles` (gates who can impersonate) and `impersonatable_roles` (filters which roles appear in the dropdown — nil means “all available roles”). The old `impersonation_roles` setter only ever controlled the gate, so it now aliases `impersonator_roles`.



387
388
389
# File 'lib/lcp_ruby/configuration.rb', line 387

def impersonation_roles
  @impersonator_roles
end

#impersonation_roles=(value) ⇒ Object



391
392
393
394
395
396
397
398
# File 'lib/lcp_ruby/configuration.rb', line 391

def impersonation_roles=(value)
  Kernel.warn(
    "[LcpRuby] DEPRECATION: config.impersonation_roles is deprecated; " \
    "use impersonator_roles (gate) and/or impersonatable_roles (dropdown filter) instead.",
    uplevel: 1
  )
  @impersonator_roles = value
end

#invariant_checkObject

Boot-validator config. Lazy reader auto-constructs the default Configuration on first access (so a fresh host app can read ‘LcpRuby.configuration.invariant_check.severity` without first writing `=`). The setter accepts a Hash (built eagerly into a Configuration), an InvariantCheck::Configuration instance (stored as-is), or nil (clears; next read rebuilds the default).



406
407
408
# File 'lib/lcp_ruby/configuration.rb', line 406

def invariant_check
  @invariant_check ||= Authorization::InvariantCheck::Configuration.new
end

#invariant_check=(value) ⇒ Object



410
411
412
413
414
# File 'lib/lcp_ruby/configuration.rb', line 410

def invariant_check=(value)
  # nil clears (next read rebuilds the default). Hash and existing
  # Configuration both flow through `Configuration.coerce`.
  @invariant_check = value.nil? ? nil : Authorization::InvariantCheck::Configuration.coerce(value)
end

#on_model_ready(model_name, &block) ⇒ Object



379
380
381
# File 'lib/lcp_ruby/configuration.rb', line 379

def on_model_ready(model_name, &block)
  (@model_extensions[model_name.to_s] ||= []) << block
end

#register_embed_provider(name, instance) ⇒ Object



357
358
359
# File 'lib/lcp_ruby/configuration.rb', line 357

def register_embed_provider(name, instance)
  @embed_providers[name.to_s] = instance
end

#strict_loading_enabled?Boolean

Returns true when strict_loading should be enabled on AR scopes. Raises ActiveRecord::StrictLoadingViolationError on lazy association access.

Options:

:always      — enabled in all environments
:development — enabled in development and test environments
:never       — disabled (default)

Returns:

  • (Boolean)


423
424
425
426
427
428
429
# File 'lib/lcp_ruby/configuration.rb', line 423

def strict_loading_enabled?
  case strict_loading
  when :always then true
  when :development then defined?(Rails) && (Rails.env.development? || Rails.env.test?)
  else false
  end
end