20#ifndef ORES_ACCOUNTS_MESSAGING_AUTHORIZATION_PROTOCOL_HPP
21#define ORES_ACCOUNTS_MESSAGING_AUTHORIZATION_PROTOCOL_HPP
27#include <boost/uuid/uuid.hpp>
28#include "ores.comms/messaging/message_types.hpp"
29#include "ores.accounts/domain/role.hpp"
30#include "ores.accounts/domain/permission.hpp"
32namespace ores::accounts::messaging {
52 static std::expected<list_roles_request, comms::messaging::error_code>
62 std::vector<domain::role> roles;
90 static std::expected<list_roles_response, comms::messaging::error_code>
109 std::vector<std::byte>
serialize()
const;
114 static std::expected<list_permissions_request, comms::messaging::error_code>
124 std::vector<domain::permission> permissions;
138 std::vector<std::byte>
serialize()
const;
143 static std::expected<list_permissions_response, comms::messaging::error_code>
159 boost::uuids::uuid account_id;
160 boost::uuids::uuid role_id;
169 std::vector<std::byte>
serialize()
const;
174 static std::expected<assign_role_request, comms::messaging::error_code>
184 bool success =
false;
185 std::string error_message;
195 std::vector<std::byte>
serialize()
const;
200 static std::expected<assign_role_response, comms::messaging::error_code>
216 boost::uuids::uuid account_id;
217 boost::uuids::uuid role_id;
226 std::vector<std::byte>
serialize()
const;
231 static std::expected<revoke_role_request, comms::messaging::error_code>
241 bool success =
false;
242 std::string error_message;
252 std::vector<std::byte>
serialize()
const;
257 static std::expected<revoke_role_response, comms::messaging::error_code>
271 boost::uuids::uuid account_id;
279 std::vector<std::byte>
serialize()
const;
284 static std::expected<get_account_roles_request, comms::messaging::error_code>
294 std::vector<domain::role> roles;
301 std::vector<std::byte>
serialize()
const;
306 static std::expected<get_account_roles_response, comms::messaging::error_code>
320 boost::uuids::uuid account_id;
328 std::vector<std::byte>
serialize()
const;
333 static std::expected<get_account_permissions_request, comms::messaging::error_code>
343 std::vector<std::string> permission_codes;
354 std::vector<std::byte>
serialize()
const;
359 static std::expected<get_account_permissions_response, comms::messaging::error_code>
Request to list all roles in the system.
Definition authorization_protocol.hpp:41
static std::expected< list_roles_request, comms::messaging::error_code > deserialize(std::span< const std::byte > data)
Deserialize request from bytes.
Definition authorization_protocol.cpp:108
std::vector< std::byte > serialize() const
Serialize request to bytes.
Definition authorization_protocol.cpp:103
Response containing all roles.
Definition authorization_protocol.hpp:61
static std::expected< list_roles_response, comms::messaging::error_code > deserialize(std::span< const std::byte > data)
Deserialize response from bytes.
Definition authorization_protocol.cpp:127
std::vector< std::byte > serialize() const
Serialize response to bytes.
Definition authorization_protocol.cpp:117
Request to list all permissions in the system.
Definition authorization_protocol.hpp:103
std::vector< std::byte > serialize() const
Serialize request to bytes.
Definition authorization_protocol.cpp:153
static std::expected< list_permissions_request, comms::messaging::error_code > deserialize(std::span< const std::byte > data)
Deserialize request from bytes.
Definition authorization_protocol.cpp:158
Response containing all permissions.
Definition authorization_protocol.hpp:123
static std::expected< list_permissions_response, comms::messaging::error_code > deserialize(std::span< const std::byte > data)
Deserialize response from bytes.
Definition authorization_protocol.cpp:179
std::vector< std::byte > serialize() const
Serialize response to bytes.
Definition authorization_protocol.cpp:167
Request to assign a role to an account.
Definition authorization_protocol.hpp:158
std::vector< std::byte > serialize() const
Serialize request to bytes.
Definition authorization_protocol.cpp:217
static std::expected< assign_role_request, comms::messaging::error_code > deserialize(std::span< const std::byte > data)
Deserialize request from bytes.
Definition authorization_protocol.cpp:225
Response indicating whether role assignment succeeded.
Definition authorization_protocol.hpp:183
static std::expected< assign_role_response, comms::messaging::error_code > deserialize(std::span< const std::byte > data)
Deserialize response from bytes.
Definition authorization_protocol.cpp:252
std::vector< std::byte > serialize() const
Serialize response to bytes.
Definition authorization_protocol.cpp:244
Request to revoke a role from an account.
Definition authorization_protocol.hpp:215
std::vector< std::byte > serialize() const
Serialize request to bytes.
Definition authorization_protocol.cpp:275
static std::expected< revoke_role_request, comms::messaging::error_code > deserialize(std::span< const std::byte > data)
Deserialize request from bytes.
Definition authorization_protocol.cpp:283
Response indicating whether role revocation succeeded.
Definition authorization_protocol.hpp:240
std::vector< std::byte > serialize() const
Serialize response to bytes.
Definition authorization_protocol.cpp:302
static std::expected< revoke_role_response, comms::messaging::error_code > deserialize(std::span< const std::byte > data)
Deserialize response from bytes.
Definition authorization_protocol.cpp:310
Request to get all roles assigned to an account.
Definition authorization_protocol.hpp:270
std::vector< std::byte > serialize() const
Serialize request to bytes.
Definition authorization_protocol.cpp:333
static std::expected< get_account_roles_request, comms::messaging::error_code > deserialize(std::span< const std::byte > data)
Deserialize request from bytes.
Definition authorization_protocol.cpp:340
Response containing roles assigned to an account.
Definition authorization_protocol.hpp:293
static std::expected< get_account_roles_response, comms::messaging::error_code > deserialize(std::span< const std::byte > data)
Deserialize response from bytes.
Definition authorization_protocol.cpp:365
std::vector< std::byte > serialize() const
Serialize response to bytes.
Definition authorization_protocol.cpp:355
Request to get effective permissions for an account.
Definition authorization_protocol.hpp:319
static std::expected< get_account_permissions_request, comms::messaging::error_code > deserialize(std::span< const std::byte > data)
Deserialize request from bytes.
Definition authorization_protocol.cpp:398
std::vector< std::byte > serialize() const
Serialize request to bytes.
Definition authorization_protocol.cpp:391
Response containing effective permissions for an account.
Definition authorization_protocol.hpp:342
static std::expected< get_account_permissions_response, comms::messaging::error_code > deserialize(std::span< const std::byte > data)
Deserialize response from bytes.
Definition authorization_protocol.cpp:424
std::vector< std::byte > serialize() const
Serialize response to bytes.
Definition authorization_protocol.cpp:413