22 #include "core/audit/DoorEvent_odb.h" 33 , access_point_id_before_(0)
34 , access_point_id_after_(0)
42 ASSERT_LOG(database,
"Database cannot be null.");
43 ASSERT_LOG(target_door,
"Target door must be non null.");
44 ASSERT_LOG(target_door->id(),
"Target door must be already persisted.");
45 ASSERT_LOG(parent,
"Parent must be non null.");
46 ASSERT_LOG(parent->id(),
"Parent must be already persisted.");
53 audit->target(target_door);
54 database->persist(audit);
56 audit->set_parent(parent);
57 database->update(audit);
68 auto door_odb = std::dynamic_pointer_cast<
Auth::Door>(door);
69 ASSERT_LOG(door_odb,
"IDoor is not of type Door.");
106 std::stringstream ss;
125 desc[
"alias"] = t->alias();
132 return std::shared_ptr<DoorEvent>(
new DoorEvent());
Auth::AccessPointId access_point_id_before_
The id of the associated AP before the event.
static std::shared_ptr< DoorEvent > create(const DBPtr &database, Auth::IDoorPtr target_door, AuditEntryPtr parent)
unsigned long AccessPointId
std::shared_ptr< DoorEvent > DoorEventPtr
This is the header file for a generated source file, GitSHA1.cpp.
Provides an implementation of IDoorEvent.
virtual Auth::AccessPointId access_point_id_after() const override
Return the id of the associated access_point after the event took place.
virtual bool finalized() const override
Is this entry finalized.
An optional transaction is an object that behave like an odb::transaction if there is no currently ac...
std::shared_ptr< IDoor > IDoorPtr
virtual IAuditEntryPtr parent() const override
Retrieve the parent of this entry.
virtual const std::string & before() const override
Auth::DoorId target_door_id_
virtual std::string generate_description() const override
Generate a description for this event.
std::shared_ptr< AuditEntry > AuditEntryPtr
#define ASSERT_LOG(cond, msg)
std::string before_
Optional JSON dump of the object before the event took place.
virtual const std::string & after() const override
static std::shared_ptr< DoorEvent > create_empty()
virtual Auth::DoorId target_id() const override
Auth::AccessPointId access_point_id_after_
The id of associated AP after the event.
virtual Auth::AccessPointId access_point_id_before() const override
Return the id of the associated access_point before the event took place.
virtual void target(Auth::IDoorPtr door) override
Set the door that is targeted by the event.
std::string generate_target_description() const
Generate a short description for the targeted door.
std::string after_
Optional JSON dump of the object after the event took place.
std::shared_ptr< odb::database > DBPtr
void database(DBPtr db)
Set the database pointer.
virtual AuditEntryId id() const override
Retrieve the identifier of the entry.
The Audit namespace provides classes and facilities to keep track of what's happening on the Leosac d...