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

Provides an implementation of IGroupEvent. More...

#include <GroupEvent.hpp>

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

Public Member Functions

virtual ~GroupEvent ()=default
 
virtual void target (Auth::GroupPtr grp) override
 Set the group that is targeted by the event. More...
 
virtual void before (const std::string &repr) override
 An optional JSON representation of the object before the event took place. More...
 
virtual void after (const std::string &repr) override
 An optional JSON representation of the object after the event took place. More...
 
Auth::GroupId target_id () const override
 
const std::string & before () const override
 
const std::string & after () const override
 
std::string generate_description () const override
 Generate a description for this event. More...
 
- Public Member Functions inherited from Leosac::Audit::IGroupEvent
 MAKE_VISITABLE ()
 
- Public Member Functions inherited from Leosac::Audit::IAuditEntry
 MAKE_VISITABLE ()
 
- 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...
 

Static Public Member Functions

static std::shared_ptr< GroupEventcreate_empty ()
 
- Static Public Member Functions inherited from Leosac::Audit::AuditEntry
static AuditEntryPtr get_last_audit (DBPtr db)
 Retrieve the last (finalized) audit entry. More...
 

Private Member Functions

 GroupEvent ()=default
 
std::string generate_target_description () const
 Generate a small json-string description about the targeted group. More...
 

Static Private Member Functions

static std::shared_ptr< GroupEventcreate (const DBPtr &database, Auth::GroupPtr target_group, AuditEntryPtr parent)
 

Private Attributes

Auth::GroupLWPtr target_
 
Auth::GroupId target_group_id_
 This is equals to target_->id(). More...
 
std::string before_
 Optional JSON dump of the object before the event took place. More...
 
std::string after_
 Optional JSON dump of the object after the event took place. More...
 

Friends

class Factory
 
class odb::access
 

Additional Inherited Members

- 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 IGroupEvent.

Definition at line 33 of file GroupEvent.hpp.

Constructor & Destructor Documentation

◆ GroupEvent()

Leosac::Audit::GroupEvent::GroupEvent ( )
privatedefault

◆ ~GroupEvent()

virtual Leosac::Audit::GroupEvent::~GroupEvent ( )
virtualdefault

Member Function Documentation

◆ after() [1/2]

const std::string & GroupEvent::after ( ) const
overridevirtual

Implements Leosac::Audit::IGroupEvent.

Definition at line 90 of file GroupEvent.cpp.

◆ after() [2/2]

void GroupEvent::after ( const std::string &  repr)
overridevirtual

An optional JSON representation of the object after the event took place.

Implements Leosac::Audit::IGroupEvent.

Definition at line 70 of file GroupEvent.cpp.

◆ before() [1/2]

const std::string & GroupEvent::before ( ) const
overridevirtual

Implements Leosac::Audit::IGroupEvent.

Definition at line 85 of file GroupEvent.cpp.

◆ before() [2/2]

void GroupEvent::before ( const std::string &  repr)
overridevirtual

An optional JSON representation of the object before the event took place.

Implements Leosac::Audit::IGroupEvent.

Definition at line 64 of file GroupEvent.cpp.

◆ create()

std::shared_ptr< GroupEvent > GroupEvent::create ( const DBPtr database,
Auth::GroupPtr  target_group,
AuditEntryPtr  parent 
)
staticprivate

Definition at line 30 of file GroupEvent.cpp.

◆ create_empty()

std::shared_ptr< GroupEvent > GroupEvent::create_empty ( )
static

Definition at line 122 of file GroupEvent.cpp.

◆ generate_description()

std::string GroupEvent::generate_description ( ) const
overridevirtual

Generate a description for this event.

todo: should be pure virtual

Reimplemented from Leosac::Audit::IAuditEntry.

Definition at line 95 of file GroupEvent.cpp.

◆ generate_target_description()

std::string GroupEvent::generate_target_description ( ) const
private

Generate a small json-string description about the targeted group.

Definition at line 110 of file GroupEvent.cpp.

◆ target()

void GroupEvent::target ( Auth::GroupPtr  group)
overridevirtual

Set the group that is targeted by the event.

Implements Leosac::Audit::IGroupEvent.

Definition at line 55 of file GroupEvent.cpp.

◆ target_id()

Auth::GroupId GroupEvent::target_id ( ) const
overridevirtual

Implements Leosac::Audit::IGroupEvent.

Definition at line 76 of file GroupEvent.cpp.

Friends And Related Function Documentation

◆ Factory

friend class Factory
friend

Definition at line 38 of file GroupEvent.hpp.

◆ odb::access

friend class odb::access
friend

Definition at line 90 of file GroupEvent.hpp.

Member Data Documentation

◆ after_

std::string Leosac::Audit::GroupEvent::after_
private

Optional JSON dump of the object after the event took place.

Definition at line 88 of file GroupEvent.hpp.

◆ before_

std::string Leosac::Audit::GroupEvent::before_
private

Optional JSON dump of the object before the event took place.

Definition at line 83 of file GroupEvent.hpp.

◆ target_

Auth::GroupLWPtr Leosac::Audit::GroupEvent::target_
private

Definition at line 70 of file GroupEvent.hpp.

◆ target_group_id_

Auth::GroupId Leosac::Audit::GroupEvent::target_group_id_
private

This is equals to target_->id().

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

Definition at line 78 of file GroupEvent.hpp.


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