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

Manages commands related to accounts. More...

#include <accounts_commands.hpp>

Collaboration diagram for accounts_commands:
Collaboration graph

Static Public Member Functions

static void register_commands (cli::Menu &root_menu, ores::nats::service::nats_client &session, pagination_context &pagination)
 Register account-related commands.
 
static void process_create_account (std::ostream &out, ores::nats::service::nats_client &session, std::string principal, std::string password, std::string totp_secret, std::string email)
 Process a create account request.
 
static void process_list_accounts (std::ostream &out, ores::nats::service::nats_client &session, pagination_context &pagination)
 Process a list accounts request.
 
static void process_login (std::ostream &out, ores::nats::service::nats_client &session, std::string principal, std::string password)
 Process a login request.
 
static void process_lock_account (std::ostream &out, ores::nats::service::nats_client &session, std::string account_id)
 Process a lock account request.
 
static void process_unlock_account (std::ostream &out, ores::nats::service::nats_client &session, std::string account_id)
 Process an unlock account request.
 
static void process_list_login_info (std::ostream &out, ores::nats::service::nats_client &session)
 Process a list login info request.
 
static void process_logout (std::ostream &out, ores::nats::service::nats_client &session)
 Process a logout request.
 
static void process_bootstrap (std::ostream &out, ores::nats::service::nats_client &session, std::string principal, std::string password, std::string email)
 Process a bootstrap request.
 
static void process_list_sessions (std::ostream &out, ores::nats::service::nats_client &session, std::string account_id="")
 Process a list sessions request.
 
static void process_active_sessions (std::ostream &out, ores::nats::service::nats_client &session)
 Process an active sessions request.
 
static void process_session_stats (std::ostream &out, ores::nats::service::nats_client &session, int days=30)
 Process a session statistics request.
 
static void process_get_account_history (std::ostream &out, ores::nats::service::nats_client &session, std::string username)
 Process a get account history request.
 
static void process_account_info (std::ostream &out, ores::nats::service::nats_client &session, std::string username)
 Process an account info request.
 

Detailed Description

Manages commands related to accounts.

Member Function Documentation

◆ register_commands()

void register_commands ( cli::Menu &  root_menu,
ores::nats::service::nats_client session,
pagination_context pagination 
)
static

Register account-related commands.

Creates the accounts submenu and adds account operations.

◆ process_create_account()

void process_create_account ( std::ostream &  out,
ores::nats::service::nats_client session,
std::string  principal,
std::string  password,
std::string  totp_secret,
std::string  email 
)
static

Process a create account request.

Creates a new account with the provided details. Note: Admin privileges are now managed via RBAC role assignments.

Parameters
outOutput stream for results
sessionClient session for connectivity.
principalAccount principal (username@hostname or just username)
passwordAccount password
totp_secretTOTP secret for 2FA
emailAccount email
Here is the caller graph for this function:

◆ process_list_accounts()

void process_list_accounts ( std::ostream &  out,
ores::nats::service::nats_client session,
pagination_context pagination 
)
static

Process a list accounts request.

Retrieves accounts from the server with pagination and displays them.

Parameters
outOutput stream for results
sessionClient session for connectivity.
paginationPagination context for state management.
Here is the caller graph for this function:

◆ process_login()

void process_login ( std::ostream &  out,
ores::nats::service::nats_client session,
std::string  principal,
std::string  password 
)
static

Process a login request.

Authenticates a user with the provided credentials.

Parameters
outOutput stream for results
sessionClient session for connectivity.
principalUser principal in format username@hostname or just username for system tenant. See login_request::principal for details.
passwordAccount password
Here is the caller graph for this function:

◆ process_lock_account()

void process_lock_account ( std::ostream &  out,
ores::nats::service::nats_client session,
std::string  account_id 
)
static

Process a lock account request.

Locks an account by account ID. Requires accounts:lock permission.

Parameters
outOutput stream for results
sessionClient session for connectivity.
account_idAccount ID UUID as a string.
Here is the caller graph for this function:

◆ process_unlock_account()

void process_unlock_account ( std::ostream &  out,
ores::nats::service::nats_client session,
std::string  account_id 
)
static

Process an unlock account request.

Unlocks a locked account by account ID. Requires accounts:unlock permission.

Parameters
outOutput stream for results
sessionClient session for connectivity.
account_idAccount ID UUID as a string.
Here is the caller graph for this function:

◆ process_list_login_info()

void process_list_login_info ( std::ostream &  out,
ores::nats::service::nats_client session 
)
static

Process a list login info request.

Retrieves all login info records from the server and displays them.

Parameters
outOutput stream for results
sessionClient session for connectivity.
Here is the caller graph for this function:

◆ process_logout()

void process_logout ( std::ostream &  out,
ores::nats::service::nats_client session 
)
static

Process a logout request.

Logs out the currently logged-in user.

Parameters
outOutput stream for results
sessionClient session for connectivity.
Here is the caller graph for this function:

◆ process_bootstrap()

void process_bootstrap ( std::ostream &  out,
ores::nats::service::nats_client session,
std::string  principal,
std::string  password,
std::string  email 
)
static

Process a bootstrap request.

Creates the initial administrator account when the system is in bootstrap mode. This command is only available when no admin accounts exist.

Parameters
outOutput stream for results
sessionClient session for connectivity.
principalUser principal in format username@hostname or just username for system tenant. See create_initial_admin_request::principal.
passwordAdmin account password
emailAdmin account email
Here is the caller graph for this function:

◆ process_list_sessions()

void process_list_sessions ( std::ostream &  out,
ores::nats::service::nats_client session,
std::string  account_id = "" 
)
static

Process a list sessions request.

Lists session history for the current user or specified account.

Parameters
outOutput stream for results
sessionClient session for connectivity.
account_idOptional account ID (empty for own sessions)
Here is the caller graph for this function:

◆ process_active_sessions()

void process_active_sessions ( std::ostream &  out,
ores::nats::service::nats_client session 
)
static

Process an active sessions request.

Lists currently active sessions for the current user.

Parameters
outOutput stream for results
sessionClient session for connectivity.
Here is the caller graph for this function:

◆ process_session_stats()

void process_session_stats ( std::ostream &  out,
ores::nats::service::nats_client session,
int  days = 30 
)
static

Process a session statistics request.

Displays session statistics for the specified time range.

Parameters
outOutput stream for results
sessionClient session for connectivity.
daysNumber of days to retrieve statistics for (default 30)
Here is the caller graph for this function:

◆ process_get_account_history()

void process_get_account_history ( std::ostream &  out,
ores::nats::service::nats_client session,
std::string  username 
)
static

Process a get account history request.

Retrieves the version history for an account by username.

Parameters
outOutput stream for results
sessionClient session for connectivity.
usernameUsername of the account
Here is the caller graph for this function:

◆ process_account_info()

void process_account_info ( std::ostream &  out,
ores::nats::service::nats_client session,
std::string  username 
)
static

Process an account info request.

Displays comprehensive account information including:

  • Account details (ID, username, email, status, tenant)
  • Assigned roles
  • Effective permissions
Parameters
outOutput stream for results
sessionClient session for connectivity.
usernameUsername of the account to display
Here is the caller graph for this function: