|
ORE Studio 0.0.4
|
Service for managing system bootstrap mode state. More...
#include <bootstrap_mode_service.hpp>

Public Types | |
| using | context = ores::database::context |
Public Member Functions | |
| bootstrap_mode_service (database::context ctx, std::string tenant_id, std::shared_ptr< authorization_service > auth_service) | |
| Constructs a bootstrap_mode_service with required repositories. | |
| bool | is_in_bootstrap_mode () |
| Checks if the system is currently in bootstrap mode. | |
| void | initialize_bootstrap_state () |
| Initializes the bootstrap mode state on system startup. | |
| void | exit_bootstrap_mode () |
| Transitions the system from bootstrap mode to secure mode. | |
Service for managing system bootstrap mode state.
The bootstrap_mode_service manages the system's bootstrap mode, which is a special state where only the initial administrator account can be created. The service uses the system_settings table to persist the bootstrap mode state with the setting name "system.bootstrap_mode".
Bootstrap mode logic:
The service provides methods to:
| bootstrap_mode_service | ( | database::context | ctx, |
| std::string | tenant_id, | ||
| std::shared_ptr< authorization_service > | auth_service | ||
| ) |
Constructs a bootstrap_mode_service with required repositories.
| ctx | The database context for repository access |
| tenant_id | The tenant identifier for multi-tenancy isolation |
| auth_service | The authorization service for RBAC checks |
| bool is_in_bootstrap_mode | ( | ) |
Checks if the system is currently in bootstrap mode.
Queries the system_settings table for the system.bootstrap_mode setting. If the setting is enabled (true), the system is in bootstrap mode.
| void initialize_bootstrap_state | ( | ) |
Initializes the bootstrap mode state on system startup.
This method should be called during service initialization. It ensures the bootstrap mode system setting exists and is set correctly based on whether admin accounts exist in the system.
Logic:
| void exit_bootstrap_mode | ( | ) |
Transitions the system from bootstrap mode to secure mode.
This method is called after the first admin account is successfully created. It updates the system.bootstrap_mode system setting from enabled=true to enabled=false using bitemporal versioning.
This operation is idempotent - calling it when already in secure mode has no effect.
