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_SHELL_APP_COMMANDS_RBAC_COMMANDS_HPP
21#define ORES_SHELL_APP_COMMANDS_RBAC_COMMANDS_HPP
22
23#include <string>
24#include "ores.logging/make_logger.hpp"
25#include "ores.nats/service/nats_client.hpp"
26#include "ores.shell/app/pagination_context.hpp"
27
28namespace cli {
29
30class Menu;
31
32}
33
34namespace ores::shell::app::commands {
35
43private:
44 inline static std::string_view logger_name =
45 "ores.shell.app.commands.rbac_commands";
46
47 static auto& lg() {
48 using namespace ores::logging;
49 static auto instance = make_logger(logger_name);
50 return instance;
51 }
52
53public:
63 static void register_commands(cli::Menu& root_menu,
65 pagination_context& pagination);
66
67 // =========================================================================
68 // Permissions Commands
69 // =========================================================================
70
79 static void process_list_permissions(std::ostream& out,
81
82 // =========================================================================
83 // Roles Commands
84 // =========================================================================
85
94 static void process_list_roles(std::ostream& out,
96
107 static void process_get_role(std::ostream& out,
109 std::string role_identifier);
110
111 // =========================================================================
112 // Account-Role Assignment Commands
113 // =========================================================================
114
125 static void process_assign_role(std::ostream& out,
127 std::string account_id, std::string role_id);
128
139 static void process_revoke_role(std::ostream& out,
141 std::string account_id, std::string role_id);
142
152 static void process_get_account_roles(std::ostream& out,
154 std::string account_id);
155
165 static void process_get_account_permissions(std::ostream& out,
167 std::string account_id);
168
180 static void process_suggest_role_commands(std::ostream& out,
182 std::string username, std::string identifier);
183};
184
185}
186
187#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Authenticated NATS client for both interactive and service-to-service use.
Definition nats_client.hpp:71
Manages commands related to RBAC (Role-Based Access Control).
Definition rbac_commands.hpp:42
static void register_commands(cli::Menu &root_menu, ores::nats::service::nats_client &session, pagination_context &pagination)
Register RBAC-related commands.
Definition rbac_commands.cpp:107
static void process_revoke_role(std::ostream &out, ores::nats::service::nats_client &session, std::string account_id, std::string role_id)
Process a revoke role request.
Definition rbac_commands.cpp:264
static void process_get_role(std::ostream &out, ores::nats::service::nats_client &session, std::string role_identifier)
Process a get role request.
Definition rbac_commands.cpp:173
static void process_get_account_roles(std::ostream &out, ores::nats::service::nats_client &session, std::string account_id)
Process a get account roles request.
Definition rbac_commands.cpp:313
static void process_suggest_role_commands(std::ostream &out, ores::nats::service::nats_client &session, std::string username, std::string identifier)
Process a suggest role commands request.
Definition rbac_commands.cpp:364
static void process_get_account_permissions(std::ostream &out, ores::nats::service::nats_client &session, std::string account_id)
Process a get account permissions request.
Definition rbac_commands.cpp:339
static void process_list_permissions(std::ostream &out, ores::nats::service::nats_client &session)
Process a list permissions request.
Definition rbac_commands.cpp:145
static void process_list_roles(std::ostream &out, ores::nats::service::nats_client &session)
Process a list roles request.
Definition rbac_commands.cpp:159
static void process_assign_role(std::ostream &out, ores::nats::service::nats_client &session, std::string account_id, std::string role_id)
Process an assign role request.
Definition rbac_commands.cpp:215
Manages pagination state across shell commands.
Definition pagination_context.hpp:51