Leosac  0.8.0
Open Source Access Control
Leosac::Audit::UserGroupMembershipEvent Class Reference

Provides an implementation of IUserGroupMembershipEvent. More...

#include <UserGroupMembershipEvent.hpp>

+ Inheritance diagram for Leosac::Audit::UserGroupMembershipEvent:
+ Collaboration diagram for Leosac::Audit::UserGroupMembershipEvent:

Public Member Functions

virtual ~UserGroupMembershipEvent ()=default
virtual void target_user (Auth::UserPtr user) override
 The user that joined or left the group. More...
virtual void target_group (Auth::GroupPtr grp) override
 The group that gained or lost an user. More...
Auth::UserId target_user_id () const override
Auth::GroupId target_group_id () const override
std::string generate_description () const override
 Generate a description for this event. More...
- Public Member Functions inherited from Leosac::Audit::IUserGroupMembershipEvent
- Public Member Functions inherited from Leosac::Audit::IAuditEntry
- Public Member Functions inherited from Leosac::Tools::IVisitable
virtual void accept (::Leosac::Tools::BaseVisitor &)=0
 Accept a visitor that may mutate this. More...
virtual void accept (::Leosac::Tools::BaseVisitor &) const =0
 Accept a visitor that will not mutate this. More...
- Public Member Functions inherited from Leosac::Audit::AuditEntry
 AuditEntry (const AuditEntry &)=delete
virtual ~AuditEntry ()=default
virtual AuditEntryId id () const override
 Retrieve the identifier of the entry. More...
virtual void finalize () override
 Mark the entry as finalized, and update it wrt the database. More...
virtual bool finalized () const override
 Is this entry finalized. More...
virtual void event_mask (const EventMask &mask) override
 Set the event mask for the entry. More...
virtual const EventMaskevent_mask () const override
 Retrieve the current event mask. More...
virtual void author (Auth::UserPtr user) override
 Set the author of the entry. More...
virtual Auth::UserId author_id () const override
 Retrieve the user id of the author of this entry. More...
virtual void set_parent (IAuditEntryPtr parent) override
 Set parent as the parent audit entry for this entry. More...
virtual IAuditEntryPtr parent () const override
 Retrieve the parent of this entry. More...
virtual void remove_parent () override
 Remove the parent-child relationship between this entry and its parent. More...
virtual size_t children_count () const override
 Returns the number of children that this entry has. More...
virtual size_t version () const override
 Returns the ODB version of the object. More...
virtual void reload () override
 Reload the object from the database. More...
virtual boost::posix_time::ptime timestamp () const override
 Retrieve unix timestamp. More...
void database (DBPtr db)
 Set the database pointer. More...

Private Member Functions

 UserGroupMembershipEvent ()=default
std::string generate_target_user_description () const
std::string generate_target_group_description () const

Static Private Member Functions

static UserGroupMembershipEventPtr create (const DBPtr &database, Auth::GroupPtr target_group, Auth::UserPtr target_user, AuditEntryPtr parent)

Private Attributes

Auth::GroupLWPtr target_group_
Auth::UserLWPtr target_user_
Auth::GroupId target_group_id_
 This is equals to target_group_->id(). More...
Auth::UserId target_user_id_
 Set to target_user_->id() More...


class Factory
class odb::access

Additional Inherited Members

- Static Public Member Functions inherited from Leosac::Audit::AuditEntry
static AuditEntryPtr get_last_audit (DBPtr db)
 Retrieve the last (finalized) audit entry. More...
- Protected Member Functions inherited from Leosac::Audit::AuditEntry
 AuditEntry ()
- Static Protected Member Functions inherited from Leosac::Tools::IVisitable
template<class T >
static bool visitor_dispatch (T &visited, BaseVisitor &visitor, bool abort_on_failure)
- Protected Attributes inherited from Leosac::Audit::AuditEntry
AuditEntryWPtr parent_
std::string msg_
Auth::UserLPtr author_
 The user at the source of the entry. More...
EventMask event_mask_
size_t duration_
 How long did it take for the Audit object to be finalized. More...
bool finalized_
 Audit entry are sometime persisted multiple time before reaching their final state. More...
DBPtr database_
 Pointer to the database. More...
Tools::ElapsedTimeCounter etc_
 Keep track of how long the object has been alive. More...

Detailed Description

Provides an implementation of IUserGroupMembershipEvent.

Definition at line 33 of file UserGroupMembershipEvent.hpp.

Constructor & Destructor Documentation

◆ UserGroupMembershipEvent()

Leosac::Audit::UserGroupMembershipEvent::UserGroupMembershipEvent ( )

◆ ~UserGroupMembershipEvent()

virtual Leosac::Audit::UserGroupMembershipEvent::~UserGroupMembershipEvent ( )

Member Function Documentation

◆ create()

UserGroupMembershipEventPtr UserGroupMembershipEvent::create ( const DBPtr database,
Auth::GroupPtr  target_group,
Auth::UserPtr  target_user,
AuditEntryPtr  parent 

Definition at line 42 of file UserGroupMembershipEvent.cpp.

◆ generate_description()

std::string UserGroupMembershipEvent::generate_description ( ) const

Generate a description for this event.

todo: should be pure virtual

Reimplemented from Leosac::Audit::IAuditEntry.

Definition at line 83 of file UserGroupMembershipEvent.cpp.

◆ generate_target_group_description()

std::string UserGroupMembershipEvent::generate_target_group_description ( ) const

Definition at line 110 of file UserGroupMembershipEvent.cpp.

◆ generate_target_user_description()

std::string UserGroupMembershipEvent::generate_target_user_description ( ) const

Definition at line 98 of file UserGroupMembershipEvent.cpp.

◆ target_group()

void UserGroupMembershipEvent::target_group ( Auth::GroupPtr  grp)

The group that gained or lost an user.

Implements Leosac::Audit::IUserGroupMembershipEvent.

Definition at line 35 of file UserGroupMembershipEvent.cpp.

◆ target_group_id()

Auth::GroupId UserGroupMembershipEvent::target_group_id ( ) const

◆ target_user()

void UserGroupMembershipEvent::target_user ( Auth::UserPtr  user)

The user that joined or left the group.

Implements Leosac::Audit::IUserGroupMembershipEvent.

Definition at line 29 of file UserGroupMembershipEvent.cpp.

◆ target_user_id()

Auth::UserId UserGroupMembershipEvent::target_user_id ( ) const

Friends And Related Function Documentation

◆ Factory

friend class Factory

Definition at line 39 of file UserGroupMembershipEvent.hpp.

◆ odb::access

friend class odb::access

Definition at line 82 of file UserGroupMembershipEvent.hpp.

Member Data Documentation

◆ target_group_

Auth::GroupLWPtr Leosac::Audit::UserGroupMembershipEvent::target_group_

Definition at line 64 of file UserGroupMembershipEvent.hpp.

◆ target_group_id_

Auth::GroupId Leosac::Audit::UserGroupMembershipEvent::target_group_id_

This is equals to target_group_->id().

The reason for this data duplication is to keep a trail of which group this event used to refer to.

Definition at line 75 of file UserGroupMembershipEvent.hpp.

◆ target_user_

Auth::UserLWPtr Leosac::Audit::UserGroupMembershipEvent::target_user_

Definition at line 67 of file UserGroupMembershipEvent.hpp.

◆ target_user_id_

Auth::UserId Leosac::Audit::UserGroupMembershipEvent::target_user_id_

Set to target_user_->id()

Definition at line 80 of file UserGroupMembershipEvent.hpp.

The documentation for this class was generated from the following files: