ORE Studio 0.0.4
Loading...
Searching...
No Matches
Public Member Functions | List of all members
system_settings_service Class Reference

Service for managing typed system settings. More...

#include <system_settings_service.hpp>

Collaboration diagram for system_settings_service:
Collaboration graph

Public Member Functions

 system_settings_service (database::context ctx, std::string tenant_id={})
 Constructs a system_settings_service.
 
std::optional< domain::system_settingget (const std::string &name)
 Retrieves a single setting by name (latest active version).
 
std::vector< domain::system_settingget_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_settingget_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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ system_settings_service()

system_settings_service ( database::context  ctx,
std::string  tenant_id = {} 
)
explicit

Constructs a system_settings_service.

Parameters
ctxThe database context to use for operations.
tenant_idThe tenant identifier used when creating new settings. Defaults to empty; must be set for convenience set_* methods to work.

Member Function Documentation

◆ get_bool()

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.

◆ get_int()

int get_int ( std::string_view  name) const

Returns the integer value of a setting.

Returns the registry default if the setting is absent.

Here is the caller graph for this function:

◆ get_string()

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.

Here is the caller graph for this function:

◆ get_json()

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.