21 #include "core/audit/UserGroupMembershipEvent_odb.h" 45 ASSERT_LOG(database,
"Database cannot be null.");
46 ASSERT_LOG(target_user,
"Target user must be non null.");
47 ASSERT_LOG(target_user->id(),
"Target user must be already persisted.");
48 ASSERT_LOG(target_group,
"Target group must be non null.");
49 ASSERT_LOG(target_group->id(),
"Target group must be already persisted.");
50 ASSERT_LOG(parent,
"Parent must be non null.");
51 ASSERT_LOG(parent->id(),
"Parent must be already persisted.");
55 std::shared_ptr<Audit::UserGroupMembershipEvent>(
58 audit->target_user(target_user);
59 audit->target_group(target_group);
60 database->persist(audit);
62 audit->set_parent(parent);
63 database->update(audit);
85 using namespace FlagSetOperator;
105 desc[
"username"] = t->username();
117 desc[
"name"] = t->name();
Someone joined the group.
static UserGroupMembershipEventPtr create(const DBPtr &database, Auth::GroupPtr target_group, Auth::UserPtr target_user, AuditEntryPtr parent)
This is the header file for a generated source file, GitSHA1.cpp.
Auth::UserId target_user_id() const override
std::string generate_target_user_description() const
An optional transaction is an object that behave like an odb::transaction if there is no currently ac...
virtual IAuditEntryPtr parent() const override
Retrieve the parent of this entry.
Auth::GroupId target_group_id_
This is equals to target_group_->id().
std::shared_ptr< Group > GroupPtr
std::shared_ptr< UserGroupMembershipEvent > UserGroupMembershipEventPtr
std::shared_ptr< AuditEntry > AuditEntryPtr
std::shared_ptr< User > UserPtr
Auth::GroupId target_group_id() const override
Auth::UserId target_user_id_
Set to target_user_->id()
#define ASSERT_LOG(cond, msg)
virtual void target_user(Auth::UserPtr user) override
The user that joined or left the group.
std::string generate_description() const override
Generate a description for this event.
Auth::UserLWPtr target_user_
Provides an implementation of IUserGroupMembershipEvent.
virtual void target_group(Auth::GroupPtr grp) override
The group that gained or lost an user.
std::string generate_target_group_description() const
std::shared_ptr< odb::database > DBPtr
void database(DBPtr db)
Set the database pointer.
Auth::GroupLWPtr target_group_
The Audit namespace provides classes and facilities to keep track of what's happening on the Leosac d...