| 1 | #include <nlohmann/json.hpp> |
| 2 | |
| 3 | using json = nlohmann::json; |
| 4 | |
| 5 | #include "mtx/events/server_acl.hpp" |
| 6 | |
| 7 | namespace mtx { |
| 8 | namespace events { |
| 9 | namespace state { |
| 10 | |
| 11 | void |
| 12 | from_json(const json &obj, ServerAcl &content) |
| 13 | { |
| 14 | content.allow = obj.value("allow", std::vector<std::string>{}); |
| 15 | content.deny = obj.value("deny", std::vector<std::string>{}); |
| 16 | content.allow_ip_literals = obj.value("allow_ip_literals", true); |
| 17 | } |
| 18 | |
| 19 | void |
| 20 | to_json(json &obj, const ServerAcl &content) |
| 21 | { |
| 22 | obj["allow"] = content.allow; |
| 23 | obj["deny"] = content.deny; |
| 24 | obj["allow_ip_literals"] = content.allow_ip_literals; |
| 25 | } |
| 26 | |
| 27 | } // namespace state |
| 28 | } // namespace events |
| 29 | } // namespace mtx |