ORE Studio 0.0.4
Loading...
Searching...
No Matches
permission.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_ACCOUNTS_DOMAIN_PERMISSION_HPP
21#define ORES_ACCOUNTS_DOMAIN_PERMISSION_HPP
22
23#include <string>
24#include <boost/uuid/uuid.hpp>
25
26namespace ores::accounts::domain {
27
35struct permission final {
39 boost::uuids::uuid id;
40
47 std::string code;
48
52 std::string description;
53};
54
58namespace permissions {
59 // Account management
60 constexpr auto accounts_create = "accounts:create";
61 constexpr auto accounts_read = "accounts:read";
62 constexpr auto accounts_update = "accounts:update";
63 constexpr auto accounts_delete = "accounts:delete";
64 constexpr auto accounts_lock = "accounts:lock";
65 constexpr auto accounts_unlock = "accounts:unlock";
66 constexpr auto accounts_reset_password = "accounts:reset_password";
67
68 // Currency management
69 constexpr auto currencies_create = "currencies:create";
70 constexpr auto currencies_read = "currencies:read";
71 constexpr auto currencies_update = "currencies:update";
72 constexpr auto currencies_delete = "currencies:delete";
73 constexpr auto currencies_history = "currencies:history";
74
75 // Feature flags management
76 constexpr auto flags_create = "flags:create";
77 constexpr auto flags_read = "flags:read";
78 constexpr auto flags_update = "flags:update";
79 constexpr auto flags_delete = "flags:delete";
80
81 // Login info (read-only audit data)
82 constexpr auto login_info_read = "login_info:read";
83
84 // Roles management
85 constexpr auto roles_create = "roles:create";
86 constexpr auto roles_read = "roles:read";
87 constexpr auto roles_update = "roles:update";
88 constexpr auto roles_delete = "roles:delete";
89 constexpr auto roles_assign = "roles:assign";
90 constexpr auto roles_revoke = "roles:revoke";
91
92 // Wildcard - grants all permissions
93 constexpr auto all = "*";
94}
95
96}
97
98#endif
Represents an atomic permission that can be granted to roles.
Definition permission.hpp:35
std::string description
Human-readable description of what this permission allows.
Definition permission.hpp:52
std::string code
Permission code following the format "resource:action".
Definition permission.hpp:47
boost::uuids::uuid id
Unique identifier for the permission.
Definition permission.hpp:39