ORE Studio 0.0.4
Loading...
Searching...
No Matches
rbac_commands.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2025 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef ORES_COMMS_SHELL_APP_COMMANDS_RBAC_COMMANDS_HPP
21#define ORES_COMMS_SHELL_APP_COMMANDS_RBAC_COMMANDS_HPP
22
23#include <string>
24#include "ores.logging/make_logger.hpp"
25#include "ores.comms/net/client_session.hpp"
26
27namespace cli {
28
29class Menu;
30
31}
32
33namespace ores::comms::shell::app::commands {
34
42private:
43 inline static std::string_view logger_name =
44 "ores.comms.shell.app.commands.rbac_commands";
45
46 static auto& lg() {
47 using namespace ores::logging;
48 static auto instance = make_logger(logger_name);
49 return instance;
50 }
51
52public:
59 static void register_commands(cli::Menu& root_menu,
61
62 // =========================================================================
63 // Permissions Commands
64 // =========================================================================
65
74 static void process_list_permissions(std::ostream& out,
76
77 // =========================================================================
78 // Roles Commands
79 // =========================================================================
80
89 static void process_list_roles(std::ostream& out,
91
102 static void process_get_role(std::ostream& out,
104 std::string role_identifier);
105
106 // =========================================================================
107 // Account-Role Assignment Commands
108 // =========================================================================
109
120 static void process_assign_role(std::ostream& out,
122 std::string account_id, std::string role_id);
123
134 static void process_revoke_role(std::ostream& out,
136 std::string account_id, std::string role_id);
137
147 static void process_get_account_roles(std::ostream& out,
149 std::string account_id);
150
160 static void process_get_account_permissions(std::ostream& out,
162 std::string account_id);
163};
164
165}
166
167#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Manages commands related to RBAC (Role-Based Access Control).
Definition rbac_commands.hpp:41
static void process_list_roles(std::ostream &out, comms::net::client_session &session)
Process a list roles request.
Definition rbac_commands.cpp:159
static void process_assign_role(std::ostream &out, comms::net::client_session &session, std::string account_id, std::string role_id)
Process an assign role request.
Definition rbac_commands.cpp:231
static void process_get_account_roles(std::ostream &out, comms::net::client_session &session, std::string account_id)
Process a get account roles request.
Definition rbac_commands.cpp:321
static void process_get_account_permissions(std::ostream &out, comms::net::client_session &session, std::string account_id)
Process a get account permissions request.
Definition rbac_commands.cpp:352
static void register_commands(cli::Menu &root_menu, comms::net::client_session &session)
Register RBAC-related commands.
Definition rbac_commands.cpp:99
static void process_list_permissions(std::ostream &out, comms::net::client_session &session)
Process a list permissions request.
Definition rbac_commands.cpp:134
static void process_revoke_role(std::ostream &out, comms::net::client_session &session, std::string account_id, std::string role_id)
Process a revoke role request.
Definition rbac_commands.cpp:276
static void process_get_role(std::ostream &out, comms::net::client_session &session, std::string role_identifier)
Process a get role request.
Definition rbac_commands.cpp:180
Client-side session manager providing auth-aware request handling.
Definition client_session.hpp:125