21 #include "core/audit/UserEvent_odb.h" 34 ASSERT_LOG(database,
"Database cannot be null.");
35 ASSERT_LOG(target_user,
"Target user must be non null.");
36 ASSERT_LOG(target_user->id(),
"Target user must be already persisted.");
37 ASSERT_LOG(parent,
"Parent must be non null.");
38 ASSERT_LOG(parent->id(),
"Parent must be already persisted.");
44 audit->target_ = target_user;
45 database->persist(audit);
50 audit->set_parent(parent);
51 database->update(audit);
94 using namespace FlagSetOperator;
114 desc[
"username"] = t->username();
virtual Auth::UserLPtr target() const override
Auth::UserId target_id() const override
Retrieve the user_id that was targeted by this event.
This is the header file for a generated source file, GitSHA1.cpp.
odb::lazy_shared_ptr< User > UserLPtr
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::string before_
Optional JSON dump of the object before the event took place.
Provides an implementation of IUserEvent.
std::string generate_target_description() const
Generate a small json-string to describe the target user.
std::shared_ptr< AuditEntry > AuditEntryPtr
std::shared_ptr< User > UserPtr
static std::shared_ptr< UserEvent > create_empty()
std::string generate_description() const override
Generate a description for this event.
std::string after_
Optional JSON dump of the object after the event took place.
#define ASSERT_LOG(cond, msg)
const std::string & before() const override
static std::shared_ptr< UserEvent > create(const DBPtr &database, Auth::UserPtr target_user, AuditEntryPtr parent)
std::shared_ptr< UserEvent > UserEventPtr
const std::string & after() const override
std::shared_ptr< odb::database > DBPtr
void database(DBPtr db)
Set the database pointer.
The Audit namespace provides classes and facilities to keep track of what's happening on the Leosac d...