|
ORE Studio 0.0.4
|
Reads and writes account-role assignments to data storage. More...
#include <account_role_repository.hpp>

Public Types | |
| using | context = ores::database::context |
Public Member Functions | |
| account_role_repository (context ctx) | |
| std::string | sql () |
| Returns the SQL created by sqlgen to construct the table. | |
| std::vector< domain::account_role > | read_latest () |
| Reads all active account-role assignments. | |
| std::vector< domain::account_role > | read_latest_by_account (const boost::uuids::uuid &account_id) |
| Reads all roles assigned to a specific account. | |
| std::vector< domain::account_role > | read_latest_by_role (const boost::uuids::uuid &role_id) |
| Reads all accounts assigned to a specific role. | |
| bool | exists (const boost::uuids::uuid &account_id, const boost::uuids::uuid &role_id) |
| Checks if a specific account-role assignment exists. | |
| void | remove (const boost::uuids::uuid &account_id, const boost::uuids::uuid &role_id) |
| Removes a specific account-role assignment. | |
| void | remove_all_for_account (const boost::uuids::uuid &account_id) |
| Removes all role assignments for an account. | |
| std::vector< std::string > | read_effective_permissions (const boost::uuids::uuid &account_id) |
| Gets all effective permission codes for an account in a single query. | |
| std::vector< domain::role > | read_roles_with_permissions (const boost::uuids::uuid &account_id) |
| Gets all roles assigned to an account with their permissions. | |
| void | write (const domain::account_role &account_role) |
| Writes account-role assignments to database. | |
| void | write (const std::vector< domain::account_role > &account_roles) |
Reads and writes account-role assignments to data storage.
| bool exists | ( | const boost::uuids::uuid & | account_id, |
| const boost::uuids::uuid & | role_id | ||
| ) |
Checks if a specific account-role assignment exists.
More efficient than read_latest_by_account when only checking existence.

| std::vector< std::string > read_effective_permissions | ( | const boost::uuids::uuid & | account_id | ) |
Gets all effective permission codes for an account in a single query.
This method uses JOINs to efficiently fetch all distinct permission codes assigned to an account through its roles, avoiding the N+1 query problem.

| std::vector< domain::role > read_roles_with_permissions | ( | const boost::uuids::uuid & | account_id | ) |
Gets all roles assigned to an account with their permissions.
This method efficiently fetches all roles for an account along with their permission codes in a single database query, avoiding N+1 issues.
