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

Centralized service for complete account initialization. More...

#include <account_setup_service.hpp>

Collaboration diagram for account_setup_service:
Collaboration graph

Public Member Functions

 account_setup_service (account_service &account_svc, std::shared_ptr< authorization_service > auth_svc)
 Constructs an account_setup_service with required dependencies.
 
domain::account create_account (const std::string &username, const std::string &email, const std::string &password, const std::string &recorded_by, const std::string &change_commentary="Account created")
 Creates a new account with the default Viewer role.
 
domain::account create_account_with_role (const std::string &username, const std::string &email, const std::string &password, const std::string &recorded_by, const std::string &role_name, const std::string &change_commentary="Account created")
 Creates a new account with a specific role.
 

Detailed Description

Centralized service for complete account initialization.

This service orchestrates the full account creation workflow:

  1. Creates the account record and login_info via account_service
  2. Assigns the default Viewer role via authorization_service

Use this service instead of calling account_service::create_account() directly to ensure accounts are properly initialized with roles.

Constructor & Destructor Documentation

◆ account_setup_service()

account_setup_service ( account_service account_svc,
std::shared_ptr< authorization_service auth_svc 
)

Constructs an account_setup_service with required dependencies.

Parameters
account_serviceThe service for account creation
auth_serviceThe service for role assignment

Member Function Documentation

◆ create_account()

domain::account create_account ( const std::string &  username,
const std::string &  email,
const std::string &  password,
const std::string &  recorded_by,
const std::string &  change_commentary = "Account created" 
)

Creates a new account with the default Viewer role.

This method:

  1. Creates the account via account_service
  2. Looks up the Viewer role
  3. Assigns the Viewer role to the new account
Parameters
usernameThe unique username for the account
emailThe email address for the account
passwordThe plaintext password (will be hashed)
recorded_byThe username of the person creating the account
change_commentaryOptional commentary explaining account creation
Returns
The created account with the Viewer role assigned
Exceptions
std::runtime_errorIf Viewer role is not found (RBAC not seeded)

◆ create_account_with_role()

domain::account create_account_with_role ( const std::string &  username,
const std::string &  email,
const std::string &  password,
const std::string &  recorded_by,
const std::string &  role_name,
const std::string &  change_commentary = "Account created" 
)

Creates a new account with a specific role.

This method:

  1. Creates the account via account_service
  2. Assigns the specified role to the new account
Parameters
usernameThe unique username for the account
emailThe email address for the account
passwordThe plaintext password (will be hashed)
recorded_byThe username of the person creating the account
role_nameThe name of the role to assign
change_commentaryOptional commentary explaining account creation
Returns
The created account with the specified role assigned
Exceptions
std::runtime_errorIf the specified role is not found
Here is the caller graph for this function: