open-loam 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +148 -8
- data/LICENSE +1 -1
- data/README.md +27 -25
- data/app/jobs/{loam → open_loam}/custom_field_reindex_job.rb +6 -6
- data/app/jobs/{loam → open_loam}/event_delivery_job.rb +8 -8
- data/app/jobs/open_loam/event_log_prune_job.rb +15 -0
- data/app/jobs/{loam → open_loam}/event_redelivery_sweep_job.rb +4 -4
- data/app/jobs/{loam → open_loam}/webhook_delivery_job.rb +17 -8
- data/app/models/open_loam/api_token.rb +63 -0
- data/app/models/{loam → open_loam}/audit_record.rb +3 -3
- data/app/models/{loam → open_loam}/auth_attempt.rb +5 -5
- data/app/models/{loam → open_loam}/business_rule.rb +10 -10
- data/app/models/{loam → open_loam}/business_rule_run.rb +5 -5
- data/app/models/{loam → open_loam}/comment.rb +9 -9
- data/app/models/{loam → open_loam}/config.rb +7 -7
- data/app/models/{loam → open_loam}/custom_field_value.rb +5 -5
- data/app/models/{loam → open_loam}/dashboard_widget.rb +5 -5
- data/app/models/open_loam/dictionary.rb +20 -0
- data/app/models/{loam → open_loam}/dictionary_entry.rb +7 -7
- data/app/models/{loam → open_loam}/event_delivery.rb +4 -4
- data/app/models/open_loam/event_record.rb +42 -0
- data/app/models/{loam → open_loam}/field_definition.rb +8 -8
- data/app/models/{loam → open_loam}/inbound_webhook_delivery.rb +4 -4
- data/app/models/{loam → open_loam}/inbound_webhook_source.rb +13 -13
- data/app/models/{loam → open_loam}/membership.rb +6 -6
- data/app/models/{loam → open_loam}/mfa_credential.rb +8 -8
- data/app/models/{loam → open_loam}/notification.rb +10 -10
- data/app/models/{loam → open_loam}/pending_action.rb +70 -26
- data/app/models/{loam → open_loam}/perspective.rb +5 -5
- data/app/models/{loam → open_loam}/progress_job.rb +7 -7
- data/app/models/{loam → open_loam}/record_lock.rb +5 -5
- data/app/models/{loam → open_loam}/scheduled_job.rb +7 -7
- data/app/models/open_loam/search_token.rb +9 -0
- data/app/models/{loam → open_loam}/sso_identity.rb +4 -4
- data/app/models/open_loam/sso_provider.rb +66 -0
- data/app/models/open_loam/tenant.rb +20 -0
- data/app/models/{loam → open_loam}/translation.rb +5 -5
- data/app/models/open_loam/webhook_endpoint.rb +39 -0
- data/app/views/{loam → open_loam}/attachments/_attachments.html.erb +1 -1
- data/app/views/{loam → open_loam}/comments/_comments.html.erb +1 -1
- data/app/views/{loam → open_loam}/custom_fields/_fields.html.erb +6 -2
- data/lib/generators/{loam → open_loam}/entity/entity_generator.rb +9 -9
- data/lib/generators/{loam → open_loam}/entity/templates/api_controller.rb +2 -1
- data/lib/generators/{loam → open_loam}/entity/templates/controller.rb +32 -22
- data/lib/generators/{loam → open_loam}/entity/templates/entity_test.rb +12 -12
- data/lib/generators/{loam → open_loam}/entity/templates/migration.rb +5 -5
- data/lib/generators/{loam → open_loam}/entity/templates/model.rb +10 -10
- data/lib/generators/{loam → open_loam}/entity/templates/policy.rb +1 -1
- data/lib/generators/{loam → open_loam}/entity/templates/views/_form.html.erb +8 -5
- data/lib/generators/{loam → open_loam}/entity/templates/views/deleted.html.erb +7 -7
- data/lib/generators/open_loam/entity/templates/views/edit.html.erb +3 -0
- data/lib/generators/open_loam/entity/templates/views/index.html.erb +94 -0
- data/lib/generators/open_loam/entity/templates/views/new.html.erb +3 -0
- data/lib/generators/open_loam/entity/templates/views/show.html.erb +38 -0
- data/lib/generators/{loam → open_loam}/install/install_generator.rb +58 -47
- data/lib/generators/open_loam/install/templates/AGENTS.md +345 -0
- data/lib/generators/{loam → open_loam}/install/templates/admin/api_docs_controller.rb +2 -2
- data/lib/generators/{loam → open_loam}/install/templates/admin/api_docs_index.html.erb +1 -1
- data/lib/generators/open_loam/install/templates/admin/api_tokens_controller.rb +48 -0
- data/lib/generators/{loam → open_loam}/install/templates/admin/api_tokens_index.html.erb +23 -0
- data/lib/generators/{loam → open_loam}/install/templates/admin/base_controller.rb +101 -38
- data/lib/generators/{loam → open_loam}/install/templates/admin/business_rules_controller.rb +7 -7
- data/lib/generators/{loam → open_loam}/install/templates/admin/business_rules_form.html.erb +2 -2
- data/lib/generators/{loam → open_loam}/install/templates/admin/comments_controller.rb +4 -4
- data/lib/generators/{loam → open_loam}/install/templates/admin/configs_controller.rb +9 -9
- data/lib/generators/open_loam/install/templates/admin/dashboard_controller.rb +12 -0
- data/lib/generators/{loam → open_loam}/install/templates/admin/dashboard_widgets_controller.rb +5 -5
- data/lib/generators/{loam → open_loam}/install/templates/admin/dictionaries_controller.rb +5 -5
- data/lib/generators/{loam → open_loam}/install/templates/admin/dictionaries_form.html.erb +1 -1
- data/lib/generators/{loam → open_loam}/install/templates/admin/dictionary_entries_controller.rb +2 -2
- data/lib/generators/{loam → open_loam}/install/templates/admin/event_deliveries_controller.rb +5 -5
- data/lib/generators/{loam → open_loam}/install/templates/admin/event_deliveries_index.html.erb +1 -1
- data/lib/generators/{loam → open_loam}/install/templates/admin/events_controller.rb +7 -5
- data/lib/generators/{loam → open_loam}/install/templates/admin/features_controller.rb +9 -9
- data/lib/generators/{loam → open_loam}/install/templates/admin/field_definitions_controller.rb +5 -5
- data/lib/generators/{loam → open_loam}/install/templates/admin/field_definitions_new.html.erb +2 -2
- data/lib/generators/open_loam/install/templates/admin/history_controller.rb +64 -0
- data/lib/generators/{loam → open_loam}/install/templates/admin/history_index.html.erb +2 -2
- data/lib/generators/{loam → open_loam}/install/templates/admin/imports_controller.rb +25 -13
- data/lib/generators/{loam → open_loam}/install/templates/admin/inbound_webhook_sources_controller.rb +7 -7
- data/lib/generators/{loam → open_loam}/install/templates/admin/inbound_webhook_sources_new.html.erb +2 -4
- data/lib/generators/open_loam/install/templates/admin/layout.html.erb +76 -0
- data/lib/generators/{loam → open_loam}/install/templates/admin/mfa_controller.rb +11 -6
- data/lib/generators/{loam → open_loam}/install/templates/admin/notifications_controller.rb +5 -3
- data/lib/generators/{loam → open_loam}/install/templates/admin/overrides_controller.rb +3 -3
- data/lib/generators/{loam → open_loam}/install/templates/admin/overrides_index.html.erb +2 -2
- data/lib/generators/{loam → open_loam}/install/templates/admin/pending_actions_controller.rb +3 -3
- data/lib/generators/{loam → open_loam}/install/templates/admin/perspectives_controller.rb +13 -7
- data/lib/generators/{loam → open_loam}/install/templates/admin/perspectives_index.html.erb +1 -1
- data/lib/generators/open_loam/install/templates/admin/progress_jobs_controller.rb +23 -0
- data/lib/generators/{loam → open_loam}/install/templates/admin/progress_jobs_index.html.erb +1 -1
- data/lib/generators/{loam → open_loam}/install/templates/admin/record_locks_controller.rb +4 -4
- data/lib/generators/{loam → open_loam}/install/templates/admin/scheduled_jobs_controller.rb +7 -7
- data/lib/generators/{loam → open_loam}/install/templates/admin/scheduled_jobs_form.html.erb +1 -1
- data/lib/generators/{loam → open_loam}/install/templates/admin/scheduled_jobs_index.html.erb +1 -1
- data/lib/generators/{loam → open_loam}/install/templates/admin/search_controller.rb +7 -5
- data/lib/generators/{loam → open_loam}/install/templates/admin/sessions_controller.rb +33 -34
- data/lib/generators/{loam → open_loam}/install/templates/admin/sso_providers_controller.rb +6 -6
- data/lib/generators/{loam → open_loam}/install/templates/admin/sso_providers_form.html.erb +2 -2
- data/lib/generators/{loam → open_loam}/install/templates/admin/sso_providers_index.html.erb +8 -1
- data/lib/generators/{loam → open_loam}/install/templates/admin/sudo_controller.rb +7 -5
- data/lib/generators/{loam → open_loam}/install/templates/admin/sudo_new.html.erb +1 -1
- data/lib/generators/{loam → open_loam}/install/templates/admin/translations_controller.rb +7 -7
- data/lib/generators/{loam → open_loam}/install/templates/admin/translations_index.html.erb +3 -3
- data/lib/generators/{loam → open_loam}/install/templates/admin/webhook_endpoints_controller.rb +4 -4
- data/lib/generators/{loam → open_loam}/install/templates/admin/webhook_endpoints_index.html.erb +1 -1
- data/lib/generators/{loam → open_loam}/install/templates/admin.css +1 -1
- data/lib/generators/open_loam/install/templates/api_base_controller.rb +127 -0
- data/lib/generators/{loam → open_loam}/install/templates/guardrails_test.rb +17 -17
- data/lib/generators/open_loam/install/templates/import_job.rb +38 -0
- data/lib/generators/{loam → open_loam}/install/templates/inbound_webhooks_controller.rb +4 -4
- data/lib/generators/{loam → open_loam}/install/templates/initializer.rb +87 -75
- data/lib/generators/open_loam/install/templates/migrations/create_open_loam_api_tokens.rb +15 -0
- data/lib/generators/open_loam/install/templates/migrations/create_open_loam_audit_records.rb +14 -0
- data/lib/generators/{loam/install/templates/migrations/create_loam_auth_attempts.rb → open_loam/install/templates/migrations/create_open_loam_auth_attempts.rb} +3 -3
- data/lib/generators/{loam/install/templates/migrations/create_loam_business_rules.rb → open_loam/install/templates/migrations/create_open_loam_business_rules.rb} +10 -10
- data/lib/generators/open_loam/install/templates/migrations/create_open_loam_comments.rb +13 -0
- data/lib/generators/{loam/install/templates/migrations/create_loam_configs.rb → open_loam/install/templates/migrations/create_open_loam_configs.rb} +7 -7
- data/lib/generators/open_loam/install/templates/migrations/create_open_loam_custom_field_values.rb +19 -0
- data/lib/generators/open_loam/install/templates/migrations/create_open_loam_dashboard_widgets.rb +12 -0
- data/lib/generators/open_loam/install/templates/migrations/create_open_loam_dictionaries.rb +11 -0
- data/lib/generators/{loam/install/templates/migrations/create_loam_dictionary_entries.rb → open_loam/install/templates/migrations/create_open_loam_dictionary_entries.rb} +6 -6
- data/lib/generators/{loam/install/templates/migrations/create_loam_event_deliveries.rb → open_loam/install/templates/migrations/create_open_loam_event_deliveries.rb} +5 -5
- data/lib/generators/open_loam/install/templates/migrations/create_open_loam_event_records.rb +13 -0
- data/lib/generators/{loam/install/templates/migrations/create_loam_field_definitions.rb → open_loam/install/templates/migrations/create_open_loam_field_definitions.rb} +4 -4
- data/lib/generators/{loam/install/templates/migrations/create_loam_inbound_webhooks.rb → open_loam/install/templates/migrations/create_open_loam_inbound_webhooks.rb} +9 -10
- data/lib/generators/open_loam/install/templates/migrations/create_open_loam_memberships.rb +11 -0
- data/lib/generators/{loam/install/templates/migrations/create_loam_mfa_credentials.rb → open_loam/install/templates/migrations/create_open_loam_mfa_credentials.rb} +4 -4
- data/lib/generators/open_loam/install/templates/migrations/create_open_loam_notifications.rb +15 -0
- data/lib/generators/{loam/install/templates/migrations/create_loam_pending_actions.rb → open_loam/install/templates/migrations/create_open_loam_pending_actions.rb} +9 -9
- data/lib/generators/{loam/install/templates/migrations/create_loam_perspectives.rb → open_loam/install/templates/migrations/create_open_loam_perspectives.rb} +5 -5
- data/lib/generators/{loam/install/templates/migrations/create_loam_progress_jobs.rb → open_loam/install/templates/migrations/create_open_loam_progress_jobs.rb} +5 -5
- data/lib/generators/open_loam/install/templates/migrations/create_open_loam_record_locks.rb +16 -0
- data/lib/generators/{loam/install/templates/migrations/create_loam_scheduled_jobs.rb → open_loam/install/templates/migrations/create_open_loam_scheduled_jobs.rb} +5 -5
- data/lib/generators/open_loam/install/templates/migrations/create_open_loam_search_tokens.rb +18 -0
- data/lib/generators/{loam/install/templates/migrations/create_loam_sso_providers.rb → open_loam/install/templates/migrations/create_open_loam_sso_providers.rb} +15 -12
- data/lib/generators/open_loam/install/templates/migrations/create_open_loam_tenants.rb +9 -0
- data/lib/generators/open_loam/install/templates/migrations/create_open_loam_translations.rb +15 -0
- data/lib/generators/open_loam/install/templates/migrations/create_open_loam_webhook_endpoints.rb +13 -0
- data/lib/generators/{loam → open_loam}/install/templates/migrations/create_users.rb +1 -1
- data/lib/generators/{loam → open_loam}/install/templates/user.rb +5 -5
- data/lib/generators/{loam → open_loam}/primary_key_options.rb +23 -23
- data/lib/open-loam.rb +2 -2
- data/lib/{loam → open_loam}/attachable.rb +4 -4
- data/lib/{loam → open_loam}/auditable.rb +23 -23
- data/lib/{loam → open_loam}/auth_throttle.rb +20 -12
- data/lib/{loam → open_loam}/base32.rb +1 -1
- data/lib/{loam → open_loam}/bulk.rb +7 -7
- data/lib/{loam → open_loam}/business_rules/actions.rb +7 -7
- data/lib/{loam → open_loam}/business_rules/condition.rb +5 -5
- data/lib/{loam → open_loam}/business_rules.rb +19 -19
- data/lib/{loam → open_loam}/commentable.rb +6 -6
- data/lib/{loam → open_loam}/configs.rb +19 -19
- data/lib/{loam → open_loam}/cron.rb +2 -2
- data/lib/{loam → open_loam}/csv.rb +2 -2
- data/lib/{loam → open_loam}/current.rb +5 -5
- data/lib/{loam → open_loam}/custom_field_index.rb +33 -30
- data/lib/{loam → open_loam}/custom_fields.rb +17 -17
- data/lib/{loam → open_loam}/dashboard.rb +5 -5
- data/lib/{loam → open_loam}/dictionaries.rb +12 -12
- data/lib/{loam → open_loam}/durable_events.rb +19 -19
- data/lib/{loam → open_loam}/encryptable.rb +39 -34
- data/lib/{loam → open_loam}/encryption/cipher.rb +3 -3
- data/lib/{loam → open_loam}/encryption/key_provider.rb +19 -3
- data/lib/{loam → open_loam}/encryption.rb +58 -15
- data/lib/open_loam/engine.rb +65 -0
- data/lib/{loam → open_loam}/enrichers.rb +5 -5
- data/lib/{loam → open_loam}/errors.rb +20 -10
- data/lib/{loam → open_loam}/eval.rb +2 -2
- data/lib/open_loam/event_log.rb +77 -0
- data/lib/{loam → open_loam}/event_stream.rb +14 -14
- data/lib/{loam → open_loam}/eventful.rb +12 -12
- data/lib/{loam → open_loam}/events.rb +5 -5
- data/lib/{loam → open_loam}/export.rb +12 -12
- data/lib/{loam → open_loam}/features.rb +15 -15
- data/lib/{loam → open_loam}/generated_key.rb +6 -6
- data/lib/{loam → open_loam}/import.rb +12 -15
- data/lib/{loam → open_loam}/inbound_webhooks.rb +19 -18
- data/lib/{loam → open_loam}/lifecycle.rb +54 -25
- data/lib/{loam/locales/loam.en.yml → open_loam/locales/open_loam.en.yml} +5 -5
- data/lib/{loam → open_loam}/mcp/server.rb +9 -9
- data/lib/{loam → open_loam}/mcp.rb +31 -22
- data/lib/{loam → open_loam}/notifications.rb +5 -5
- data/lib/{loam → open_loam}/open_api.rb +16 -16
- data/lib/open_loam/outbound_url.rb +100 -0
- data/lib/{loam → open_loam}/overrides.rb +10 -10
- data/lib/{loam → open_loam}/pending_actions.rb +9 -9
- data/lib/{loam → open_loam}/permissions.rb +8 -8
- data/lib/{loam → open_loam}/perspectives.rb +9 -9
- data/lib/{loam → open_loam}/policy.rb +21 -8
- data/lib/{loam → open_loam}/progress.rb +6 -6
- data/lib/{loam → open_loam}/record_locks.rb +9 -9
- data/lib/{loam → open_loam}/scheduler.rb +20 -20
- data/lib/{loam → open_loam}/search/driver.rb +3 -3
- data/lib/{loam → open_loam}/search/like_driver.rb +5 -5
- data/lib/{loam → open_loam}/search/token_driver.rb +16 -16
- data/lib/{loam → open_loam}/search.rb +5 -5
- data/lib/{loam → open_loam}/searchable.rb +22 -22
- data/lib/{loam → open_loam}/soft_deletable.rb +10 -10
- data/lib/{loam → open_loam}/sso/claims.rb +1 -1
- data/lib/{loam → open_loam}/sso/fake_provider.rb +1 -1
- data/lib/open_loam/sso/http_client.rb +51 -0
- data/lib/{loam → open_loam}/sso/oidc_provider.rb +2 -2
- data/lib/{loam → open_loam}/sso.rb +39 -18
- data/lib/{loam → open_loam}/telemetry.rb +6 -6
- data/lib/{loam → open_loam}/tenant_record.rb +10 -10
- data/lib/{loam → open_loam}/test_helpers.rb +4 -4
- data/lib/{loam → open_loam}/totp.rb +3 -3
- data/lib/{loam → open_loam}/translatable.rb +24 -24
- data/lib/{loam → open_loam}/undo.rb +11 -11
- data/lib/open_loam/version.rb +3 -0
- data/lib/{loam → open_loam}/webhooks.rb +4 -4
- data/lib/{loam → open_loam}/widgets.rb +9 -9
- data/lib/{loam → open_loam}/workflow.rb +45 -45
- data/lib/open_loam.rb +124 -0
- data/lib/tasks/open_loam.rake +203 -0
- data/lib/tasks/{loam_eval.rake → open_loam_eval.rake} +7 -7
- data/lib/tasks/open_loam_mcp.rake +20 -0
- metadata +247 -242
- data/app/models/loam/api_token.rb +0 -40
- data/app/models/loam/dictionary.rb +0 -20
- data/app/models/loam/search_token.rb +0 -9
- data/app/models/loam/sso_provider.rb +0 -35
- data/app/models/loam/tenant.rb +0 -20
- data/app/models/loam/webhook_endpoint.rb +0 -26
- data/lib/generators/loam/entity/templates/views/edit.html.erb +0 -3
- data/lib/generators/loam/entity/templates/views/index.html.erb +0 -90
- data/lib/generators/loam/entity/templates/views/new.html.erb +0 -3
- data/lib/generators/loam/entity/templates/views/show.html.erb +0 -36
- data/lib/generators/loam/install/templates/AGENTS.md +0 -341
- data/lib/generators/loam/install/templates/admin/api_tokens_controller.rb +0 -30
- data/lib/generators/loam/install/templates/admin/dashboard_controller.rb +0 -10
- data/lib/generators/loam/install/templates/admin/history_controller.rb +0 -38
- data/lib/generators/loam/install/templates/admin/layout.html.erb +0 -76
- data/lib/generators/loam/install/templates/admin/progress_jobs_controller.rb +0 -19
- data/lib/generators/loam/install/templates/api_base_controller.rb +0 -90
- data/lib/generators/loam/install/templates/import_job.rb +0 -25
- data/lib/generators/loam/install/templates/migrations/create_loam_api_tokens.rb +0 -15
- data/lib/generators/loam/install/templates/migrations/create_loam_audit_records.rb +0 -14
- data/lib/generators/loam/install/templates/migrations/create_loam_comments.rb +0 -13
- data/lib/generators/loam/install/templates/migrations/create_loam_custom_field_values.rb +0 -19
- data/lib/generators/loam/install/templates/migrations/create_loam_dashboard_widgets.rb +0 -12
- data/lib/generators/loam/install/templates/migrations/create_loam_dictionaries.rb +0 -11
- data/lib/generators/loam/install/templates/migrations/create_loam_memberships.rb +0 -11
- data/lib/generators/loam/install/templates/migrations/create_loam_notifications.rb +0 -15
- data/lib/generators/loam/install/templates/migrations/create_loam_record_locks.rb +0 -16
- data/lib/generators/loam/install/templates/migrations/create_loam_search_tokens.rb +0 -18
- data/lib/generators/loam/install/templates/migrations/create_loam_tenants.rb +0 -9
- data/lib/generators/loam/install/templates/migrations/create_loam_translations.rb +0 -15
- data/lib/generators/loam/install/templates/migrations/create_loam_webhook_endpoints.rb +0 -13
- data/lib/loam/engine.rb +0 -57
- data/lib/loam/sso/http_client.rb +0 -42
- data/lib/loam/version.rb +0 -3
- data/lib/loam.rb +0 -122
- data/lib/tasks/loam.rake +0 -171
- data/lib/tasks/loam_mcp.rake +0 -20
- /data/lib/generators/{loam → open_loam}/install/templates/admin/business_rules_edit.html.erb +0 -0
- /data/lib/generators/{loam → open_loam}/install/templates/admin/business_rules_index.html.erb +0 -0
- /data/lib/generators/{loam → open_loam}/install/templates/admin/business_rules_new.html.erb +0 -0
- /data/lib/generators/{loam → open_loam}/install/templates/admin/configs_edit.html.erb +0 -0
- /data/lib/generators/{loam → open_loam}/install/templates/admin/configs_index.html.erb +0 -0
- /data/lib/generators/{loam → open_loam}/install/templates/admin/dashboard_index.html.erb +0 -0
- /data/lib/generators/{loam → open_loam}/install/templates/admin/dashboard_widgets_index.html.erb +0 -0
- /data/lib/generators/{loam → open_loam}/install/templates/admin/dictionaries_edit.html.erb +0 -0
- /data/lib/generators/{loam → open_loam}/install/templates/admin/dictionaries_index.html.erb +0 -0
- /data/lib/generators/{loam → open_loam}/install/templates/admin/dictionaries_new.html.erb +0 -0
- /data/lib/generators/{loam → open_loam}/install/templates/admin/features_index.html.erb +0 -0
- /data/lib/generators/{loam → open_loam}/install/templates/admin/field_definitions_index.html.erb +0 -0
- /data/lib/generators/{loam → open_loam}/install/templates/admin/imports_new.html.erb +0 -0
- /data/lib/generators/{loam → open_loam}/install/templates/admin/imports_preview.html.erb +0 -0
- /data/lib/generators/{loam → open_loam}/install/templates/admin/imports_summary.html.erb +0 -0
- /data/lib/generators/{loam → open_loam}/install/templates/admin/inbound_webhook_sources_index.html.erb +0 -0
- /data/lib/generators/{loam → open_loam}/install/templates/admin/mfa_activated.html.erb +0 -0
- /data/lib/generators/{loam → open_loam}/install/templates/admin/mfa_new.html.erb +0 -0
- /data/lib/generators/{loam → open_loam}/install/templates/admin/mfa_show.html.erb +0 -0
- /data/lib/generators/{loam → open_loam}/install/templates/admin/notifications_index.html.erb +0 -0
- /data/lib/generators/{loam → open_loam}/install/templates/admin/pagination.rb +0 -0
- /data/lib/generators/{loam → open_loam}/install/templates/admin/pending_actions_index.html.erb +0 -0
- /data/lib/generators/{loam → open_loam}/install/templates/admin/scheduled_jobs_edit.html.erb +0 -0
- /data/lib/generators/{loam → open_loam}/install/templates/admin/scheduled_jobs_new.html.erb +0 -0
- /data/lib/generators/{loam → open_loam}/install/templates/admin/search_index.html.erb +0 -0
- /data/lib/generators/{loam → open_loam}/install/templates/admin/sessions_mfa_challenge.html.erb +0 -0
- /data/lib/generators/{loam → open_loam}/install/templates/admin/sessions_new.html.erb +0 -0
- /data/lib/generators/{loam → open_loam}/install/templates/admin/sso_providers_edit.html.erb +0 -0
- /data/lib/generators/{loam → open_loam}/install/templates/admin/sso_providers_new.html.erb +0 -0
- /data/lib/generators/{loam → open_loam}/install/templates/admin/webhook_endpoints_new.html.erb +0 -0
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
class
|
|
1
|
+
class CreateOpenLoamBusinessRules < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STRING.to_f %>]
|
|
2
2
|
def change
|
|
3
|
-
create_table :
|
|
4
|
-
t.references :tenant, null: false, foreign_key: { to_table: :
|
|
3
|
+
create_table :open_loam_business_rules<%= open_loam_id_option %> do |t|
|
|
4
|
+
t.references :tenant, null: false, foreign_key: { to_table: :open_loam_tenants }<%= open_loam_type_option %>
|
|
5
5
|
t.string :name, null: false
|
|
6
6
|
t.string :entity_type # the entity this rule watches (nil = event-only)
|
|
7
|
-
t.string :trigger, null: false # an event pattern (
|
|
7
|
+
t.string :trigger, null: false # an event pattern (OpenLoam::Events.pattern_matches?)
|
|
8
8
|
t.json :condition, null: false, default: {} # a safe condition tree (data, never code)
|
|
9
9
|
t.json :actions, null: false, default: [] # an ordered list of typed action descriptors
|
|
10
10
|
t.boolean :active, null: false, default: true
|
|
11
11
|
t.integer :priority, null: false, default: 0
|
|
12
12
|
t.timestamps
|
|
13
13
|
end
|
|
14
|
-
add_index :
|
|
14
|
+
add_index :open_loam_business_rules, %i[tenant_id active]
|
|
15
15
|
|
|
16
|
-
create_table :
|
|
17
|
-
t.references :tenant, null: false, foreign_key: { to_table: :
|
|
18
|
-
t.references :business_rule, null: false, foreign_key: { to_table: :
|
|
16
|
+
create_table :open_loam_business_rule_runs<%= open_loam_id_option %> do |t|
|
|
17
|
+
t.references :tenant, null: false, foreign_key: { to_table: :open_loam_tenants }<%= open_loam_type_option %>
|
|
18
|
+
t.references :business_rule, null: false, foreign_key: { to_table: :open_loam_business_rules }<%= open_loam_type_option %>
|
|
19
19
|
t.string :subject_type
|
|
20
|
-
t.<%=
|
|
20
|
+
t.<%= open_loam_key_column_type %> :subject_id<%= open_loam_key_limit_option %>
|
|
21
21
|
t.string :event_name
|
|
22
22
|
t.boolean :matched, null: false, default: false
|
|
23
23
|
t.json :actions_taken, null: false, default: []
|
|
24
24
|
t.text :error
|
|
25
25
|
t.timestamps
|
|
26
26
|
end
|
|
27
|
-
add_index :
|
|
27
|
+
add_index :open_loam_business_rule_runs, %i[tenant_id business_rule_id created_at]
|
|
28
28
|
end
|
|
29
29
|
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class CreateOpenLoamComments < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STRING.to_f %>]
|
|
2
|
+
def change
|
|
3
|
+
create_table :open_loam_comments<%= open_loam_id_option %> do |t|
|
|
4
|
+
t.references :tenant, null: false, foreign_key: { to_table: :open_loam_tenants }<%= open_loam_type_option %>
|
|
5
|
+
t.string :commentable_type, null: false
|
|
6
|
+
t.<%= open_loam_key_column_type %> :commentable_id<%= open_loam_key_limit_option %>, null: false
|
|
7
|
+
t.references :author, null: false, foreign_key: { to_table: :users }<%= open_loam_type_option %>
|
|
8
|
+
t.text :body, null: false
|
|
9
|
+
t.timestamps
|
|
10
|
+
end
|
|
11
|
+
add_index :open_loam_comments, %i[tenant_id commentable_type commentable_id]
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
class
|
|
1
|
+
class CreateOpenLoamConfigs < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STRING.to_f %>]
|
|
2
2
|
def change
|
|
3
|
-
create_table :
|
|
3
|
+
create_table :open_loam_configs<%= open_loam_id_option %> do |t|
|
|
4
4
|
t.string :key, null: false
|
|
5
5
|
# Nullable: a NULL tenant_id is the GLOBAL row; a set one is a per-tenant
|
|
6
6
|
# override. So this is NOT a tenant-scoped table.
|
|
7
|
-
t.references :tenant, null: true, foreign_key: { to_table: :
|
|
7
|
+
t.references :tenant, null: true, foreign_key: { to_table: :open_loam_tenants }<%= open_loam_type_option %>
|
|
8
8
|
# Any JSON-able value under one key. Nullable on purpose: row existence is
|
|
9
9
|
# the "is it set" signal, and JSON null is itself a storable value.
|
|
10
10
|
t.json :value_json
|
|
@@ -12,10 +12,10 @@ class CreateLoamConfigs < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STR
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
# One global row per key (partial: only where there is no tenant).
|
|
15
|
-
add_index :
|
|
16
|
-
name: "
|
|
15
|
+
add_index :open_loam_configs, :key, unique: true, where: "tenant_id IS NULL",
|
|
16
|
+
name: "index_open_loam_configs_global_key"
|
|
17
17
|
# One override row per key per tenant.
|
|
18
|
-
add_index :
|
|
19
|
-
name: "
|
|
18
|
+
add_index :open_loam_configs, %i[key tenant_id], unique: true,
|
|
19
|
+
name: "index_open_loam_configs_on_key_and_tenant"
|
|
20
20
|
end
|
|
21
21
|
end
|
data/lib/generators/open_loam/install/templates/migrations/create_open_loam_custom_field_values.rb
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
class CreateOpenLoamCustomFieldValues < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STRING.to_f %>]
|
|
2
|
+
def change
|
|
3
|
+
create_table :open_loam_custom_field_values<%= open_loam_id_option %> do |t|
|
|
4
|
+
t.references :tenant, null: false, foreign_key: { to_table: :open_loam_tenants }<%= open_loam_type_option %>
|
|
5
|
+
t.string :indexable_type, null: false
|
|
6
|
+
t.<%= open_loam_key_column_type %> :indexable_id<%= open_loam_key_limit_option %>, null: false
|
|
7
|
+
t.string :field_key, null: false
|
|
8
|
+
t.text :value_text # canonical string form (contains/present/eq)
|
|
9
|
+
t.decimal :value_number # integer/decimal fields (range queries)
|
|
10
|
+
t.boolean :value_boolean # boolean fields
|
|
11
|
+
t.datetime :value_datetime # date/datetime fields
|
|
12
|
+
t.timestamps
|
|
13
|
+
end
|
|
14
|
+
add_index :open_loam_custom_field_values, %i[indexable_type indexable_id field_key],
|
|
15
|
+
unique: true, name: "index_open_loam_cfv_unique"
|
|
16
|
+
add_index :open_loam_custom_field_values, %i[tenant_id indexable_type field_key value_text], name: "index_open_loam_cfv_text"
|
|
17
|
+
add_index :open_loam_custom_field_values, %i[tenant_id indexable_type field_key value_number], name: "index_open_loam_cfv_number"
|
|
18
|
+
end
|
|
19
|
+
end
|
data/lib/generators/open_loam/install/templates/migrations/create_open_loam_dashboard_widgets.rb
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
class CreateOpenLoamDashboardWidgets < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STRING.to_f %>]
|
|
2
|
+
def change
|
|
3
|
+
create_table :open_loam_dashboard_widgets<%= open_loam_id_option %> do |t|
|
|
4
|
+
t.references :tenant, null: false, foreign_key: { to_table: :open_loam_tenants }<%= open_loam_type_option %>
|
|
5
|
+
t.string :widget_key, null: false # a registered OpenLoam::Widgets key
|
|
6
|
+
t.integer :position, null: false, default: 0
|
|
7
|
+
t.boolean :active, null: false, default: true
|
|
8
|
+
t.timestamps
|
|
9
|
+
end
|
|
10
|
+
add_index :open_loam_dashboard_widgets, %i[tenant_id widget_key], unique: true
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
class CreateOpenLoamDictionaries < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STRING.to_f %>]
|
|
2
|
+
def change
|
|
3
|
+
create_table :open_loam_dictionaries<%= open_loam_id_option %> do |t|
|
|
4
|
+
t.references :tenant, null: false, foreign_key: { to_table: :open_loam_tenants }<%= open_loam_type_option %>
|
|
5
|
+
t.string :key, null: false # the code the field def / API references (e.g. "damage_severity")
|
|
6
|
+
t.string :name, null: false # human label for the list
|
|
7
|
+
t.timestamps
|
|
8
|
+
end
|
|
9
|
+
add_index :open_loam_dictionaries, %i[tenant_id key], unique: true
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
class
|
|
1
|
+
class CreateOpenLoamDictionaryEntries < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STRING.to_f %>]
|
|
2
2
|
def change
|
|
3
|
-
create_table :
|
|
4
|
-
t.references :tenant, null: false, foreign_key: { to_table: :
|
|
5
|
-
t.references :dictionary, null: false, foreign_key: { to_table: :
|
|
3
|
+
create_table :open_loam_dictionary_entries<%= open_loam_id_option %> do |t|
|
|
4
|
+
t.references :tenant, null: false, foreign_key: { to_table: :open_loam_tenants }<%= open_loam_type_option %>
|
|
5
|
+
t.references :dictionary, null: false, foreign_key: { to_table: :open_loam_dictionaries }<%= open_loam_type_option %>
|
|
6
6
|
t.string :value, null: false # the stored code
|
|
7
7
|
t.string :label, null: false # display text
|
|
8
8
|
t.string :color # optional hex
|
|
@@ -12,7 +12,7 @@ class CreateLoamDictionaryEntries < ActiveRecord::Migration[<%= ActiveRecord::VE
|
|
|
12
12
|
t.boolean :active, null: false, default: true
|
|
13
13
|
t.timestamps
|
|
14
14
|
end
|
|
15
|
-
add_index :
|
|
16
|
-
add_index :
|
|
15
|
+
add_index :open_loam_dictionary_entries, %i[dictionary_id value], unique: true
|
|
16
|
+
add_index :open_loam_dictionary_entries, %i[tenant_id dictionary_id position]
|
|
17
17
|
end
|
|
18
18
|
end
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
class
|
|
1
|
+
class CreateOpenLoamEventDeliveries < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STRING.to_f %>]
|
|
2
2
|
def change
|
|
3
|
-
create_table :
|
|
4
|
-
t.references :tenant, null: false, foreign_key: { to_table: :
|
|
5
|
-
t.string :subscriber_key, null: false # a registered
|
|
3
|
+
create_table :open_loam_event_deliveries<%= open_loam_id_option %> do |t|
|
|
4
|
+
t.references :tenant, null: false, foreign_key: { to_table: :open_loam_tenants }<%= open_loam_type_option %>
|
|
5
|
+
t.string :subscriber_key, null: false # a registered OpenLoam::DurableEvents subscriber
|
|
6
6
|
t.string :event_name, null: false
|
|
7
7
|
t.json :payload, null: false # JSON-scalar event payload
|
|
8
8
|
t.string :status, null: false, default: "pending" # pending | delivered | dead
|
|
@@ -12,6 +12,6 @@ class CreateLoamEventDeliveries < ActiveRecord::Migration[<%= ActiveRecord::VERS
|
|
|
12
12
|
t.datetime :delivered_at
|
|
13
13
|
t.timestamps
|
|
14
14
|
end
|
|
15
|
-
add_index :
|
|
15
|
+
add_index :open_loam_event_deliveries, %i[tenant_id status next_attempt_at]
|
|
16
16
|
end
|
|
17
17
|
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class CreateOpenLoamEventRecords < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STRING.to_f %>]
|
|
2
|
+
def change
|
|
3
|
+
create_table :open_loam_event_records<%= open_loam_id_option %> do |t|
|
|
4
|
+
t.references :tenant, null: false, foreign_key: { to_table: :open_loam_tenants }<%= open_loam_type_option %>
|
|
5
|
+
t.string :name, null: false # "rental.equipment.created"
|
|
6
|
+
t.json :payload, null: false # JSON-scalar event payload, as published
|
|
7
|
+
t.datetime :occurred_at, null: false # publish time, not row-write time
|
|
8
|
+
t.timestamps
|
|
9
|
+
end
|
|
10
|
+
# Matches OpenLoam::EventLog.read: tenant, then name or prefix, in time order.
|
|
11
|
+
add_index :open_loam_event_records, %i[tenant_id name occurred_at]
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
class
|
|
1
|
+
class CreateOpenLoamFieldDefinitions < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STRING.to_f %>]
|
|
2
2
|
def change
|
|
3
|
-
create_table :
|
|
4
|
-
t.references :tenant, null: false, foreign_key: { to_table: :
|
|
3
|
+
create_table :open_loam_field_definitions<%= open_loam_id_option %> do |t|
|
|
4
|
+
t.references :tenant, null: false, foreign_key: { to_table: :open_loam_tenants }<%= open_loam_type_option %>
|
|
5
5
|
t.string :entity_type, null: false
|
|
6
6
|
t.string :name, null: false
|
|
7
7
|
t.string :field_type, null: false
|
|
@@ -10,6 +10,6 @@ class CreateLoamFieldDefinitions < ActiveRecord::Migration[<%= ActiveRecord::VER
|
|
|
10
10
|
t.json :config, null: false, default: {} # type-specific settings (e.g. a dictionary field's key)
|
|
11
11
|
t.timestamps
|
|
12
12
|
end
|
|
13
|
-
add_index :
|
|
13
|
+
add_index :open_loam_field_definitions, %i[tenant_id entity_type name], unique: true, name: "index_open_loam_field_definitions_on_tenant_entity_name"
|
|
14
14
|
end
|
|
15
15
|
end
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
class
|
|
1
|
+
class CreateOpenLoamInboundWebhooks < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STRING.to_f %>]
|
|
2
2
|
def change
|
|
3
|
-
create_table :
|
|
4
|
-
t.references :tenant, null: false, foreign_key: { to_table: :
|
|
3
|
+
create_table :open_loam_inbound_webhook_sources<%= open_loam_id_option %> do |t|
|
|
4
|
+
t.references :tenant, null: false, foreign_key: { to_table: :open_loam_tenants }<%= open_loam_type_option %>
|
|
5
5
|
t.string :name, null: false
|
|
6
6
|
t.string :token, null: false # unguessable URL id: /webhooks/:token
|
|
7
7
|
t.string :secret, null: false # HMAC key (authenticates the call)
|
|
8
|
-
t.string :signature_header, null: false, default: "X-
|
|
9
|
-
t.string :delivery_id_header # optional: external delivery-id for dedupe
|
|
8
|
+
t.string :signature_header, null: false, default: "X-OpenLoam-Signature"
|
|
10
9
|
t.string :timestamp_header # optional: enables the freshness window
|
|
11
10
|
t.integer :timestamp_tolerance # seconds; nil = default 300
|
|
12
11
|
t.string :event_name, null: false # what to publish on the bus
|
|
13
12
|
t.boolean :active, null: false, default: true
|
|
14
13
|
t.timestamps
|
|
15
14
|
end
|
|
16
|
-
add_index :
|
|
15
|
+
add_index :open_loam_inbound_webhook_sources, :token, unique: true
|
|
17
16
|
|
|
18
|
-
create_table :
|
|
19
|
-
t.references :tenant, null: false, foreign_key: { to_table: :
|
|
20
|
-
t.references :source, null: false, foreign_key: { to_table: :
|
|
17
|
+
create_table :open_loam_inbound_webhook_deliveries<%= open_loam_id_option %> do |t|
|
|
18
|
+
t.references :tenant, null: false, foreign_key: { to_table: :open_loam_tenants }<%= open_loam_type_option %>
|
|
19
|
+
t.references :source, null: false, foreign_key: { to_table: :open_loam_inbound_webhook_sources }<%= open_loam_type_option %>
|
|
21
20
|
t.string :external_id, null: false # delivery-id header, or a body hash
|
|
22
21
|
t.string :event_name, null: false
|
|
23
22
|
t.string :status, null: false, default: "received"
|
|
@@ -26,6 +25,6 @@ class CreateLoamInboundWebhooks < ActiveRecord::Migration[<%= ActiveRecord::VERS
|
|
|
26
25
|
t.timestamps
|
|
27
26
|
end
|
|
28
27
|
# The idempotency ledger: a replayed (source, external_id) can't be inserted twice.
|
|
29
|
-
add_index :
|
|
28
|
+
add_index :open_loam_inbound_webhook_deliveries, %i[source_id external_id], unique: true
|
|
30
29
|
end
|
|
31
30
|
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
class CreateOpenLoamMemberships < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STRING.to_f %>]
|
|
2
|
+
def change
|
|
3
|
+
create_table :open_loam_memberships<%= open_loam_id_option %> do |t|
|
|
4
|
+
t.references :tenant, null: false, foreign_key: { to_table: :open_loam_tenants }<%= open_loam_type_option %>
|
|
5
|
+
t.references :user, null: false, foreign_key: true<%= open_loam_type_option %>
|
|
6
|
+
t.string :role, null: false
|
|
7
|
+
t.timestamps
|
|
8
|
+
end
|
|
9
|
+
add_index :open_loam_memberships, %i[tenant_id user_id], unique: true
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
class
|
|
1
|
+
class CreateOpenLoamMfaCredentials < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STRING.to_f %>]
|
|
2
2
|
def change
|
|
3
|
-
create_table :
|
|
3
|
+
create_table :open_loam_mfa_credentials<%= open_loam_id_option %> do |t|
|
|
4
4
|
# Per USER, not per tenant — MFA belongs to the person (no tenant_id).
|
|
5
|
-
t.references :user, null: false, foreign_key: { to_table: :users }, index: { unique: true }<%=
|
|
6
|
-
t.text :totp_secret # encrypted at rest, user-scoped (
|
|
5
|
+
t.references :user, null: false, foreign_key: { to_table: :users }, index: { unique: true }<%= open_loam_type_option %>
|
|
6
|
+
t.text :totp_secret # encrypted at rest, user-scoped (OpenLoam::Encryptable)
|
|
7
7
|
t.text :recovery_codes # JSON: [{ digest, used_at }], codes stored hashed
|
|
8
8
|
t.datetime :activated_at # nil until the user confirms a live code
|
|
9
9
|
t.bigint :last_totp_step # last accepted TOTP timestep — rejects replays
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class CreateOpenLoamNotifications < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STRING.to_f %>]
|
|
2
|
+
def change
|
|
3
|
+
create_table :open_loam_notifications<%= open_loam_id_option %> do |t|
|
|
4
|
+
t.references :tenant, null: false, foreign_key: { to_table: :open_loam_tenants }<%= open_loam_type_option %>
|
|
5
|
+
t.references :user, null: false, foreign_key: true<%= open_loam_type_option %>
|
|
6
|
+
t.string :title, null: false
|
|
7
|
+
t.text :body
|
|
8
|
+
t.datetime :read_at
|
|
9
|
+
t.string :source_type
|
|
10
|
+
t.<%= open_loam_key_column_type %> :source_id<%= open_loam_key_limit_option %>
|
|
11
|
+
t.timestamps
|
|
12
|
+
end
|
|
13
|
+
add_index :open_loam_notifications, %i[tenant_id user_id read_at]
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
class
|
|
1
|
+
class CreateOpenLoamPendingActions < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STRING.to_f %>]
|
|
2
2
|
def change
|
|
3
|
-
create_table :
|
|
4
|
-
t.references :tenant, null: false, foreign_key: { to_table: :
|
|
5
|
-
t.<%=
|
|
3
|
+
create_table :open_loam_pending_actions<%= open_loam_id_option %> do |t|
|
|
4
|
+
t.references :tenant, null: false, foreign_key: { to_table: :open_loam_tenants }<%= open_loam_type_option %>
|
|
5
|
+
t.<%= open_loam_key_column_type %> :actor_id<%= open_loam_key_limit_option %> # who staged it (the proposer)
|
|
6
6
|
t.string :status, null: false, default: "pending"
|
|
7
7
|
t.string :action_type, null: false # create / update / destroy
|
|
8
8
|
t.string :target_type # the model being mutated
|
|
9
|
-
t.<%=
|
|
9
|
+
t.<%= open_loam_key_column_type %> :target_id<%= open_loam_key_limit_option %> # null for a staged create
|
|
10
10
|
t.text :changeset # encrypted JSON of the proposed changes
|
|
11
11
|
t.text :summary, null: false # human-readable description
|
|
12
12
|
t.string :idempotency_key, null: false # keyed HMAC; same proposal collapses to one row
|
|
13
|
-
t.<%=
|
|
13
|
+
t.<%= open_loam_key_column_type %> :reviewed_by_id<%= open_loam_key_limit_option %> # the approving/rejecting manager
|
|
14
14
|
t.datetime :reviewed_at
|
|
15
15
|
t.text :result # execution outcome, or "rejected: <reason>"
|
|
16
16
|
t.text :error # execution failure message
|
|
@@ -19,8 +19,8 @@ class CreateLoamPendingActions < ActiveRecord::Migration[<%= ActiveRecord::VERSI
|
|
|
19
19
|
# One row per distinct proposal per tenant.
|
|
20
20
|
# Only ONE PENDING row per proposal per tenant — a rejected/executed row with
|
|
21
21
|
# the same key may coexist, so a rejected proposal can be re-staged later.
|
|
22
|
-
add_index :
|
|
23
|
-
where: "status = 'pending'", name: "
|
|
24
|
-
add_index :
|
|
22
|
+
add_index :open_loam_pending_actions, %i[tenant_id idempotency_key], unique: true,
|
|
23
|
+
where: "status = 'pending'", name: "index_open_loam_pending_actions_pending_key"
|
|
24
|
+
add_index :open_loam_pending_actions, %i[tenant_id status]
|
|
25
25
|
end
|
|
26
26
|
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
class
|
|
1
|
+
class CreateOpenLoamPerspectives < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STRING.to_f %>]
|
|
2
2
|
def change
|
|
3
|
-
create_table :
|
|
4
|
-
t.references :tenant, null: false, foreign_key: { to_table: :
|
|
3
|
+
create_table :open_loam_perspectives<%= open_loam_id_option %> do |t|
|
|
4
|
+
t.references :tenant, null: false, foreign_key: { to_table: :open_loam_tenants }<%= open_loam_type_option %>
|
|
5
5
|
t.string :entity_type, null: false # which entity this view is for
|
|
6
6
|
t.string :name, null: false # human label
|
|
7
|
-
t.<%=
|
|
7
|
+
t.<%= open_loam_key_column_type %> :owner_id<%= open_loam_key_limit_option %> # the user who owns a private view
|
|
8
8
|
t.string :visibility, null: false, default: "private" # private / role / tenant
|
|
9
9
|
t.string :role # set when visibility is "role"
|
|
10
10
|
t.boolean :is_default, null: false, default: false
|
|
@@ -12,6 +12,6 @@ class CreateLoamPerspectives < ActiveRecord::Migration[<%= ActiveRecord::VERSION
|
|
|
12
12
|
t.integer :lock_version, null: false, default: 0 # optimistic locking
|
|
13
13
|
t.timestamps
|
|
14
14
|
end
|
|
15
|
-
add_index :
|
|
15
|
+
add_index :open_loam_perspectives, %i[tenant_id entity_type]
|
|
16
16
|
end
|
|
17
17
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
class
|
|
1
|
+
class CreateOpenLoamProgressJobs < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STRING.to_f %>]
|
|
2
2
|
def change
|
|
3
|
-
create_table :
|
|
4
|
-
t.references :tenant, null: false, foreign_key: { to_table: :
|
|
3
|
+
create_table :open_loam_progress_jobs<%= open_loam_id_option %> do |t|
|
|
4
|
+
t.references :tenant, null: false, foreign_key: { to_table: :open_loam_tenants }<%= open_loam_type_option %>
|
|
5
5
|
t.string :key # optional caller-chosen id (e.g. "reindex:Gadget")
|
|
6
6
|
t.string :name, null: false # human label
|
|
7
7
|
t.string :status, null: false, default: "running" # running / completed / failed / cancelled
|
|
@@ -9,12 +9,12 @@ class CreateLoamProgressJobs < ActiveRecord::Migration[<%= ActiveRecord::VERSION
|
|
|
9
9
|
t.integer :completed, null: false, default: 0
|
|
10
10
|
t.text :message # latest status line
|
|
11
11
|
t.text :error # set when failed
|
|
12
|
-
t.<%=
|
|
12
|
+
t.<%= open_loam_key_column_type %> :actor_id<%= open_loam_key_limit_option %> # who started it
|
|
13
13
|
t.datetime :started_at
|
|
14
14
|
t.datetime :finished_at
|
|
15
15
|
t.json :result # structured result for a finished job (e.g. an import summary)
|
|
16
16
|
t.timestamps # updated_at is the heartbeat
|
|
17
17
|
end
|
|
18
|
-
add_index :
|
|
18
|
+
add_index :open_loam_progress_jobs, %i[tenant_id status]
|
|
19
19
|
end
|
|
20
20
|
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
class CreateOpenLoamRecordLocks < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STRING.to_f %>]
|
|
2
|
+
def change
|
|
3
|
+
create_table :open_loam_record_locks<%= open_loam_id_option %> do |t|
|
|
4
|
+
t.references :tenant, null: false, foreign_key: { to_table: :open_loam_tenants }<%= open_loam_type_option %>
|
|
5
|
+
t.string :lockable_type, null: false
|
|
6
|
+
t.<%= open_loam_key_column_type %> :lockable_id<%= open_loam_key_limit_option %>, null: false
|
|
7
|
+
t.references :locked_by, null: false, foreign_key: { to_table: :users }<%= open_loam_type_option %>
|
|
8
|
+
t.string :token, null: false
|
|
9
|
+
t.datetime :expires_at, null: false # TTL; an expired lock is treated as free
|
|
10
|
+
t.timestamps # updated_at is the heartbeat
|
|
11
|
+
end
|
|
12
|
+
# One advisory lock per record.
|
|
13
|
+
add_index :open_loam_record_locks, %i[tenant_id lockable_type lockable_id], unique: true,
|
|
14
|
+
name: "index_open_loam_record_locks_on_lockable"
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
class
|
|
1
|
+
class CreateOpenLoamScheduledJobs < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STRING.to_f %>]
|
|
2
2
|
def change
|
|
3
|
-
create_table :
|
|
4
|
-
t.references :tenant, null: false, foreign_key: { to_table: :
|
|
3
|
+
create_table :open_loam_scheduled_jobs<%= open_loam_id_option %> do |t|
|
|
4
|
+
t.references :tenant, null: false, foreign_key: { to_table: :open_loam_tenants }<%= open_loam_type_option %>
|
|
5
5
|
t.string :key, null: false # unique per tenant
|
|
6
6
|
t.string :name, null: false
|
|
7
7
|
t.string :job_class, null: false # a whitelisted ActiveJob class name
|
|
@@ -14,7 +14,7 @@ class CreateLoamScheduledJobs < ActiveRecord::Migration[<%= ActiveRecord::VERSIO
|
|
|
14
14
|
t.boolean :active, null: false, default: true
|
|
15
15
|
t.timestamps
|
|
16
16
|
end
|
|
17
|
-
add_index :
|
|
18
|
-
add_index :
|
|
17
|
+
add_index :open_loam_scheduled_jobs, %i[tenant_id key], unique: true
|
|
18
|
+
add_index :open_loam_scheduled_jobs, %i[active next_run_at locked_until]
|
|
19
19
|
end
|
|
20
20
|
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
class CreateOpenLoamSearchTokens < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STRING.to_f %>]
|
|
2
|
+
def change
|
|
3
|
+
create_table :open_loam_search_tokens<%= open_loam_id_option %> do |t|
|
|
4
|
+
t.references :tenant, null: false, foreign_key: { to_table: :open_loam_tenants }<%= open_loam_type_option %>
|
|
5
|
+
t.string :searchable_type, null: false # the entity class name (e.g. "Gadget")
|
|
6
|
+
t.<%= open_loam_key_column_type %> :searchable_id<%= open_loam_key_limit_option %>, null: false # the record it indexes
|
|
7
|
+
t.string :token, null: false # one normalized word
|
|
8
|
+
end
|
|
9
|
+
# The match subquery filters by (tenant, type, token); index maintenance
|
|
10
|
+
# deletes by (tenant, type, record). One index each — no timestamps: these
|
|
11
|
+
# are plumbing rows written with insert_all/delete_all.
|
|
12
|
+
#
|
|
13
|
+
# Shipped even though the default LikeDriver never uses it, so switching to
|
|
14
|
+
# OpenLoam::Search::TokenDriver is a one-line initializer change, not a migration.
|
|
15
|
+
add_index :open_loam_search_tokens, %i[tenant_id searchable_type token]
|
|
16
|
+
add_index :open_loam_search_tokens, %i[tenant_id searchable_type searchable_id]
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
class
|
|
1
|
+
class CreateOpenLoamSsoProviders < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STRING.to_f %>]
|
|
2
2
|
def change
|
|
3
|
-
create_table :
|
|
4
|
-
t.references :tenant, null: false, foreign_key: { to_table: :
|
|
3
|
+
create_table :open_loam_sso_providers<%= open_loam_id_option %> do |t|
|
|
4
|
+
t.references :tenant, null: false, foreign_key: { to_table: :open_loam_tenants }<%= open_loam_type_option %>
|
|
5
5
|
t.string :name, null: false
|
|
6
6
|
t.string :protocol, null: false, default: "oidc" # "oidc" shipped; "saml" is a seam
|
|
7
7
|
t.string :issuer # OIDC discovery base (.well-known)
|
|
@@ -9,26 +9,29 @@ class CreateLoamSsoProviders < ActiveRecord::Migration[<%= ActiveRecord::VERSION
|
|
|
9
9
|
t.text :client_secret # ENCRYPTED at rest (tenant-scoped key)
|
|
10
10
|
t.string :domain, null: false # email domain for home-realm discovery
|
|
11
11
|
t.string :jit_role, null: false, default: "employee" # role for JIT-provisioned users
|
|
12
|
-
t.json :group_role_map, null: false, default: {} # IdP group ->
|
|
12
|
+
t.json :group_role_map, null: false, default: {} # IdP group -> OpenLoam role (first match wins)
|
|
13
13
|
t.boolean :active, null: false, default: true
|
|
14
|
+
# Proof of domain ownership, stamped by an operator (rake
|
|
15
|
+
# open_loam:sso:verify_domain) — never by the manager who typed the domain.
|
|
16
|
+
t.datetime :domain_verified_at
|
|
14
17
|
t.timestamps
|
|
15
18
|
end
|
|
16
19
|
# HRD resolves a provider by email domain, cross-tenant, before login — so the
|
|
17
20
|
# domain is globally unique (one owning IdP per domain).
|
|
18
|
-
add_index :
|
|
19
|
-
add_index :
|
|
21
|
+
add_index :open_loam_sso_providers, :domain, unique: true
|
|
22
|
+
add_index :open_loam_sso_providers, %i[tenant_id active]
|
|
20
23
|
|
|
21
24
|
# The durable link between an external identity (provider + subject) and a
|
|
22
25
|
# local User — the primary lookup on callback (email can change at the IdP,
|
|
23
26
|
# `sub` does not).
|
|
24
|
-
create_table :
|
|
25
|
-
t.references :tenant, null: false, foreign_key: { to_table: :
|
|
26
|
-
t.references :sso_provider, null: false, foreign_key: { to_table: :
|
|
27
|
-
t.<%=
|
|
27
|
+
create_table :open_loam_sso_identities<%= open_loam_id_option %> do |t|
|
|
28
|
+
t.references :tenant, null: false, foreign_key: { to_table: :open_loam_tenants }<%= open_loam_type_option %>
|
|
29
|
+
t.references :sso_provider, null: false, foreign_key: { to_table: :open_loam_sso_providers }<%= open_loam_type_option %>
|
|
30
|
+
t.<%= open_loam_key_column_type %> :user_id<%= open_loam_key_limit_option %>, null: false # the local User this identity belongs to
|
|
28
31
|
t.string :sub, null: false # the IdP's stable subject identifier
|
|
29
32
|
t.timestamps
|
|
30
33
|
end
|
|
31
|
-
add_index :
|
|
32
|
-
add_index :
|
|
34
|
+
add_index :open_loam_sso_identities, %i[sso_provider_id sub], unique: true
|
|
35
|
+
add_index :open_loam_sso_identities, :user_id
|
|
33
36
|
end
|
|
34
37
|
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
class CreateOpenLoamTenants < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STRING.to_f %>]
|
|
2
|
+
def change
|
|
3
|
+
create_table :open_loam_tenants<%= open_loam_id_option %> do |t|
|
|
4
|
+
t.string :name, null: false
|
|
5
|
+
t.string :slug, null: false, index: { unique: true }
|
|
6
|
+
t.timestamps
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class CreateOpenLoamTranslations < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STRING.to_f %>]
|
|
2
|
+
def change
|
|
3
|
+
create_table :open_loam_translations<%= open_loam_id_option %> do |t|
|
|
4
|
+
t.references :tenant, null: false, foreign_key: { to_table: :open_loam_tenants }<%= open_loam_type_option %>
|
|
5
|
+
t.string :translatable_type, null: false
|
|
6
|
+
t.<%= open_loam_key_column_type %> :translatable_id<%= open_loam_key_limit_option %>, null: false
|
|
7
|
+
t.string :locale, null: false # "en", "de", "pl"
|
|
8
|
+
t.string :field, null: false # the translated attribute
|
|
9
|
+
t.text :value # the per-locale content
|
|
10
|
+
t.timestamps
|
|
11
|
+
end
|
|
12
|
+
add_index :open_loam_translations, %i[translatable_type translatable_id locale field],
|
|
13
|
+
unique: true, name: "index_open_loam_translations_unique"
|
|
14
|
+
end
|
|
15
|
+
end
|
data/lib/generators/open_loam/install/templates/migrations/create_open_loam_webhook_endpoints.rb
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class CreateOpenLoamWebhookEndpoints < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STRING.to_f %>]
|
|
2
|
+
def change
|
|
3
|
+
create_table :open_loam_webhook_endpoints<%= open_loam_id_option %> do |t|
|
|
4
|
+
t.references :tenant, null: false, foreign_key: { to_table: :open_loam_tenants }<%= open_loam_type_option %>
|
|
5
|
+
t.string :url, null: false
|
|
6
|
+
t.string :event_pattern, null: false
|
|
7
|
+
t.string :secret, null: false
|
|
8
|
+
t.boolean :active, null: false, default: true
|
|
9
|
+
t.timestamps
|
|
10
|
+
end
|
|
11
|
+
add_index :open_loam_webhook_endpoints, %i[tenant_id active]
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
class CreateUsers < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STRING.to_f %>]
|
|
2
2
|
def change
|
|
3
|
-
create_table :users<%=
|
|
3
|
+
create_table :users<%= open_loam_id_option %> do |t|
|
|
4
4
|
t.string :name, null: false
|
|
5
5
|
t.string :email, null: false
|
|
6
6
|
t.string :password_digest, null: false
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# Minimal actor model. Deliberately NOT tenant-scoped: a user can belong to
|
|
2
|
-
# many tenants via
|
|
3
|
-
# auth (Devise, OmniAuth, SSO) later —
|
|
2
|
+
# many tenants via OpenLoam::Membership (role is per tenant). Swap in your real
|
|
3
|
+
# auth (Devise, OmniAuth, SSO) later — OpenLoam only needs an `id` and, for the
|
|
4
4
|
# bundled admin login, something that answers `authenticate_by`.
|
|
5
5
|
class User < ApplicationRecord
|
|
6
|
-
#
|
|
6
|
+
# OpenLoam's foreign keys point at this table, so its key has to be generated
|
|
7
7
|
# the same way theirs are when the app does not use integer keys.
|
|
8
|
-
include
|
|
8
|
+
include OpenLoam::GeneratedKey
|
|
9
9
|
|
|
10
10
|
has_secure_password
|
|
11
11
|
|
|
12
|
-
has_many :
|
|
12
|
+
has_many :open_loam_memberships, class_name: "OpenLoam::Membership"
|
|
13
13
|
|
|
14
14
|
validates :name, presence: true
|
|
15
15
|
validates :email, presence: true, uniqueness: true
|