Get Accounts By Group
GetAccountsByGroup¶
Retrieves all accounts belonging to a specified group.
int GetAccountsByGroup(const std::string& group, std::vector<AccountRecord>* accounts);
Parameters¶
- group — string representing the group name.
- accounts — pointer to a
std::vectorof AccountRecord structures where the retrieved accounts will be stored.
Return Value¶
RET_OK— accounts found and successfully retrieved.RET_NOT_FOUND— no accounts found for the specified group.RET_*— other error codes.- Return Codes
Example¶
std::vector<AccountRecord> groupAccounts;
if (GetAccountsByGroup("demo", &groupAccounts) == RET_OK) {
// Process groupAccounts
}
Warning
- The
accountspointer must point to a validstd::vector<AccountRecord>object. - If no accounts are found, the function returns
RET_NOT_FOUNDand leavesaccountsunchanged. - Always check the return code before accessing
accounts.