22 #include "core/audit/AccessPointEvent_odb.h" 36 std::shared_ptr<AccessPointEvent>
40 ASSERT_LOG(database,
"Database cannot be null.");
41 ASSERT_LOG(target_ap,
"Target AccessPoint must be non null.");
42 ASSERT_LOG(target_ap->id(),
"Target AccessPoint must be already persisted.");
43 ASSERT_LOG(parent,
"Parent must be non null.");
44 ASSERT_LOG(parent->id(),
"Parent must be already persisted.");
51 audit->target(target_ap);
52 database->persist(audit);
54 audit->set_parent(parent);
55 database->update(audit);
65 ASSERT_LOG(ap->id(),
"AccessPoint has no id.");
67 ASSERT_LOG(ap_odb,
"IAccessPoint is not of type AccessPoint.");
104 std::stringstream ss;
108 <<
" has been created.";
113 <<
" has been deleted.";
125 desc[
"alias"] = t->alias();
std::string generate_description() const override
Generate a description for this event.
Auth::AccessPointLWPtr target_
unsigned long AccessPointId
Auth::AccessPointId target_ap_id_
This is the header file for a generated source file, GitSHA1.cpp.
static std::shared_ptr< AccessPointEvent > create_empty()
std::string before_
Optional JSON dump of the object before the event took place.
Auth::AccessPointId target_id() const override
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< IAccessPoint > IAccessPointPtr
virtual IAuditEntryPtr parent() const override
Retrieve the parent of this entry.
const std::string & after() const override
static std::shared_ptr< AccessPointEvent > create(const DBPtr &database, Auth::IAccessPointPtr target_ap, AuditEntryPtr parent)
std::string after_
Optional JSON dump of the object after the event took place.
std::shared_ptr< AuditEntry > AuditEntryPtr
#define ASSERT_LOG(cond, msg)
std::string generate_target_description() const
Generate a short description for the targeted AP.
const std::string & before() const override
std::shared_ptr< AccessPointEvent > AccessPointEventPtr
virtual void target(Auth::IAccessPointPtr door) override
Set the AccessPoint that is targeted by the event.
std::shared_ptr< odb::database > DBPtr
void database(DBPtr db)
Set the database pointer.
Provides an implementation of IAccessPointEvent.
The Audit namespace provides classes and facilities to keep track of what's happening on the Leosac d...