21 #include "core/audit/ScheduleEvent_odb.h" 25 #include "tools/Schedule_odb.h" 32 std::shared_ptr<ScheduleEvent>
36 ASSERT_LOG(database,
"Database cannot be null.");
37 ASSERT_LOG(target_sched,
"Credential shall not be null.");
38 ASSERT_LOG(target_sched->id(),
"Credential must be already persisted.");
45 audit->target(target_sched);
46 database->persist(audit);
48 audit->set_parent(parent);
49 database->update(audit);
65 ASSERT_LOG(sched->id(),
"Schedule has no id.");
106 using namespace FlagSetOperator;
107 std::stringstream ss;
129 desc[
"name"] = t->name();
Tools::ScheduleId target_sched_id_
std::string generate_target_description() const
virtual void target(Tools::ISchedulePtr sch) override
Set the user that is targeted by the event.
This is the header file for a generated source file, GitSHA1.cpp.
std::shared_ptr< ScheduleEvent > ScheduleEventPtr
virtual void author(Auth::UserPtr user) override
Set the author of the entry.
Tools::ScheduleLWPtr target_
Tools::ScheduleId target_id() const override
virtual bool finalized() const override
Is this entry finalized.
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...
std::string before_
Optional JSON dump of the object before the event took place.
std::shared_ptr< AuditEntry > AuditEntryPtr
static std::shared_ptr< ScheduleEvent > create_empty()
A factory function for usage in tests.
std::string after_
Optional JSON dump of the object after the event took place.
#define ASSERT_LOG(cond, msg)
Provides an implementation of IScheduleEvent.
const std::string & before() const override
const std::string & after() const override
static std::shared_ptr< ScheduleEvent > create(const DBPtr &database, Tools::ISchedulePtr target_sched, AuditEntryPtr parent)
Auth::UserLPtr author_
The user at the source of the entry.
std::shared_ptr< odb::database > DBPtr
std::enable_if_t< is_shared_ptr_v< Out >, Out > assert_cast(const std::shared_ptr< In > &in)
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...