22 #include "core/audit/ZoneEvent_odb.h" 24 #include "core/auth/Zone_odb.h" 41 ASSERT_LOG(database,
"Database cannot be null.");
42 ASSERT_LOG(target_zone,
"Target zone must be non null.");
43 ASSERT_LOG(target_zone->id(),
"Target zone must be already persisted.");
44 ASSERT_LOG(parent,
"Parent must be non null.");
45 ASSERT_LOG(parent->id(),
"Parent must be already persisted.");
52 audit->target(target_zone);
53 database->persist(audit);
55 audit->set_parent(parent);
56 database->update(audit);
67 auto zone_odb = std::dynamic_pointer_cast<
Auth::Zone>(zone);
68 ASSERT_LOG(zone_odb,
"IZone is not of type Zone.");
105 std::stringstream ss;
124 desc[
"alias"] = t->alias();
131 return std::shared_ptr<ZoneEvent>(
new ZoneEvent());
std::shared_ptr< IZone > IZonePtr
std::shared_ptr< ZoneEvent > ZoneEventPtr
This is the header file for a generated source file, GitSHA1.cpp.
virtual void target(Auth::IZonePtr zone) override
Set the zone that is targeted by the event.
virtual const std::string & before() const override
Provides an implementation of IZoneEvent.
virtual bool finalized() const override
Is this entry finalized.
virtual std::string generate_description() const override
Generate a description for this event.
An optional transaction is an object that behave like an odb::transaction if there is no currently ac...
Auth::ZoneId target_zone_id_
virtual IAuditEntryPtr parent() const override
Retrieve the parent of this entry.
A Zone is a container for doors and other zone.
virtual Auth::ZoneId target_id() const override
std::string after_
Optional JSON dump of the object after the event took place.
std::shared_ptr< AuditEntry > AuditEntryPtr
#define ASSERT_LOG(cond, msg)
static std::shared_ptr< ZoneEvent > create(const DBPtr &database, Auth::IZonePtr target_zone, AuditEntryPtr parent)
std::string generate_target_description() const
Generate a short description for the targeted zone.
std::shared_ptr< odb::database > DBPtr
static std::shared_ptr< ZoneEvent > create_empty()
std::string before_
Optional JSON dump of the object before the event took place.
void database(DBPtr db)
Set the database pointer.
virtual const std::string & after() const override
The Audit namespace provides classes and facilities to keep track of what's happening on the Leosac d...