21 #include "core/audit/CredentialEvent_odb.h" 23 #include "core/credentials/Credential_odb.h" 32 std::shared_ptr<CredentialEvent>
36 ASSERT_LOG(database,
"Database cannot be null.");
37 ASSERT_LOG(target_cred,
"Credential shall not be null.");
38 ASSERT_LOG(target_cred->id(),
"Credential must be already persisted.");
45 audit->target(target_cred);
46 database->persist(audit);
48 audit->set_parent(parent);
49 database->update(audit);
59 ASSERT_LOG(cred->id(),
"Credential has no id.");
62 ASSERT_LOG(cred_odb,
"ICredential is not of type Credential.");
101 using namespace FlagSetOperator;
102 std::stringstream ss;
125 desc[
"alias"] = t->alias();
virtual void target(Cred::ICredentialPtr cred) override
Set the user that is targeted by the event.
std::string after_
Optional JSON dump of the object after the event took place.
static std::string type_name(const Cred::ICredential &in)
Returns the "type-name" of the credential.
An ODB enabled credential object.
This is the header file for a generated source file, GitSHA1.cpp.
Cred::CredentialId target_id() const override
virtual void author(Auth::UserPtr user) override
Set the author of the entry.
const std::string & before() const override
std::string generate_target_description() const
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::shared_ptr< ICredential > ICredentialPtr
Cred::CredentialId target_cred_id_
static std::shared_ptr< CredentialEvent > create_empty()
static std::shared_ptr< CredentialEvent > create(const DBPtr &database, Cred::ICredentialPtr target_cred, AuditEntryPtr parent)
std::shared_ptr< AuditEntry > AuditEntryPtr
const std::string & after() const override
#define ASSERT_LOG(cond, msg)
Provides an implementation of ICredentialEvent.
CredentialEvent()=default
unsigned long CredentialId
Auth::UserLPtr author_
The user at the source of the entry.
std::string before_
Optional JSON dump of the object before the event took place.
std::shared_ptr< odb::database > DBPtr
std::shared_ptr< CredentialEvent > CredentialEventPtr
Cred::CredentialLWPtr target_
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...