MantisBase v0.3.4
Loading...
Searching...
No Matches
access_rules.h
Go to the documentation of this file.
1
9#ifndef MANTISBASE_ACCESS_RULES_H
10#define MANTISBASE_ACCESS_RULES_H
11
12#include <string>
13#include <nlohmann/json.hpp>
14
15namespace mb {
31 class AccessRule {
32 public:
38 explicit AccessRule(const std::string &mode = "", const std::string &expr = "");
39
44 [[nodiscard]] nlohmann::json toJSON() const;
45
51 static AccessRule fromJSON(const nlohmann::json &j);
52
57 [[nodiscard]] std::string mode() const;
58
63 void setMode(const std::string& _mode);
64
69 [[nodiscard]] std::string expr() const;
70
75 void setExpr(const std::string& _expr);
76
77 private:
78 std::string m_mode, m_expr;
79 };
80} // mb
81
82#endif //MANTISBASE_ACCESS_RULES_H
Access control rule for entity permissions.
Definition access_rules.h:31
void setMode(const std::string &_mode)
Set rule mode.
Definition access_rules.cpp:29
nlohmann::json toJSON() const
Convert rule to JSON representation.
Definition access_rules.cpp:14
void setExpr(const std::string &_expr)
Set expression string.
Definition access_rules.cpp:39
std::string expr() const
Get expression string.
Definition access_rules.cpp:37
static AccessRule fromJSON(const nlohmann::json &j)
Create rule from JSON object.
Definition access_rules.cpp:21
std::string mode() const
Get rule mode.
Definition access_rules.cpp:27
router.h
Definition auth.h:15