24 #include "core/auth/Zone_odb.h" 49 odb::transaction t(db->begin());
54 db->persist(new_zone);
72 using Result = odb::result<Auth::Zone>;
74 odb::transaction t(db->begin());
85 rep[
"data"] = json::array();
89 for (
const auto &zone : result)
92 if (
ctx_.
session->security_context().check_permission(
95 rep[
"data"].push_back(
108 odb::transaction t(db->begin());
120 db->update(zone_odb);
134 odb::transaction t(db->begin());
151 std::vector<CRUDResourceHandler::ActionActionParam>
154 std::vector<CRUDResourceHandler::ActionActionParam> ret;
160 catch (
const json::out_of_range &e)
virtual boost::optional< json > update_impl(const json &req) override
static json serialize(const Auth::IZone &Zone, const SecurityContext &sc)
This is the header file for a generated source file, GitSHA1.cpp.
static SecurityContext & instance()
virtual boost::optional< json > read_impl(const json &req) override
virtual UserSecurityContext & security_context() const override
Helper function that returns the security context.
Audit::IAuditEntryPtr audit
The initial audit trail for the request.
std::unique_ptr< CRUDResourceHandler > CRUDResourceHandlerUPtr
A Zone is a container for doors and other zone.
static std::string serialize(const Auth::IZone &in, const SecurityContext &sc)
All modules that provides features to Leosac shall be in this namespace.
virtual boost::optional< json > delete_impl(const json &req) override
ZoneCRUD(RequestContext ctx)
Base CRUD handler for use within the websocket module.
static void unserialize(Auth::IZone &out, const json &in, const SecurityContext &sc)
virtual boost::optional< json > create_impl(const json &req) override
std::shared_ptr< Zone > ZonePtr
virtual std::vector< ActionActionParam > required_permission(Verb verb, const json &req) const override
odb::result< Tools::LogEntry > Result
static CRUDResourceHandlerUPtr instanciate(RequestContext)
Holds valuable pointer to provide context to a request.
std::shared_ptr< odb::database > DBPtr
std::enable_if_t< is_shared_ptr_v< Out >, Out > assert_cast(const std::shared_ptr< In > &in)
static IZoneEventPtr ZoneEvent(const DBPtr &database, Auth::IZonePtr target_zone, IAuditEntryPtr parent)