VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
Permissions.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <string_view>
5
6namespace VoltMod
7{
8
9/**
10 * @brief The server's permission source, published by one plugin (admin-system) through
11 * `runtime.Exchange`.
12 *
13 * Every runtime's default `Policy::HasPermission` asks it on each call, so `.Permission("x")` works
14 * in any plugin while the publisher is loaded, and denies while it is not. Any change to this vtable
15 * or to what a parameter means bumps the /N in InterfaceName.
16 */
18{
19 static constexpr std::string_view InterfaceName = "voltmod.IPermissions/1";
20
21 /** Whether @p steamId holds @p permission. */
22 virtual bool HasPermission(int64_t steamId, std::string_view permission) = 0;
23
24protected:
25 // Consumers borrow; they never own or delete.
26 ~IPermissions() = default;
27};
28
29} // namespace VoltMod
static std::string ReadFile(const std::filesystem::path &path)
Definition Loader.cpp:56
The server's permission source, published by one plugin (admin-system) through runtime....
static constexpr std::string_view InterfaceName
virtual bool HasPermission(int64_t steamId, std::string_view permission)=0