|
ORE Studio 0.0.4
|
Service for managing typed system settings. More...
#include <system_settings_service.hpp>

Public Member Functions | |
| system_settings_service (database::context ctx, std::string tenant_id={}) | |
| Constructs a system_settings_service. | |
| std::optional< domain::system_setting > | get (const std::string &name) |
| Retrieves a single setting by name (latest active version). | |
| std::vector< domain::system_setting > | get_all () |
| Retrieves all currently active settings. | |
| void | save (const domain::system_setting &setting) |
| Saves a setting using the bitemporal update pattern. | |
| void | remove (const std::string &name) |
| Logically removes a setting. | |
| std::vector< domain::system_setting > | get_history (const std::string &name) |
| Retrieves all historical versions of a setting. | |
| bool | get_bool (std::string_view name) const |
| Returns the boolean value of a setting. | |
| int | get_int (std::string_view name) const |
| Returns the integer value of a setting. | |
| std::string | get_string (std::string_view name) const |
| Returns the string value of a setting. | |
| std::string | get_json (std::string_view name) const |
| Returns the JSON value of a setting as a raw string. | |
| void | refresh () |
| Refreshes the in-memory cache by re-reading all settings from the DB. | |
| bool | is_bootstrap_mode_enabled () const |
| void | set_bootstrap_mode (bool enabled, std::string_view modified_by, std::string_view change_reason_code, std::string_view change_commentary) |
| bool | is_user_signups_enabled () const |
| void | set_user_signups (bool enabled, std::string_view modified_by, std::string_view change_reason_code, std::string_view change_commentary) |
| bool | is_signup_requires_authorization_enabled () const |
| void | set_signup_requires_authorization (bool enabled, std::string_view modified_by, std::string_view change_reason_code, std::string_view change_commentary) |
| bool | is_password_validation_disabled () const |
Service for managing typed system settings.
Service for managing typed system settings. Provides typed accessors (get_bool, get_int, get_string, get_json) that return compile-time defaults from the registry when a setting is absent from the DB.
|
explicit |
Constructs a system_settings_service.
| ctx | The database context to use for operations. |
| tenant_id | The tenant identifier used when creating new settings. Defaults to empty; must be set for convenience set_* methods to work. |
| bool get_bool | ( | std::string_view | name | ) | const |
Returns the boolean value of a setting.
Expects value to be "true" or "false" (case-insensitive). Returns the registry default if the setting is absent.
| int get_int | ( | std::string_view | name | ) | const |
Returns the integer value of a setting.
Returns the registry default if the setting is absent.

| std::string get_string | ( | std::string_view | name | ) | const |
Returns the string value of a setting.
Returns the registry default if the setting is absent.

| std::string get_json | ( | std::string_view | name | ) | const |
Returns the JSON value of a setting as a raw string.
Returns the registry default if the setting is absent. The caller is responsible for parsing the JSON.