Leosac
0.8.0
Open Source Access Control
ZoneEvent.hpp
Go to the documentation of this file.
1
/*
2
Copyright (C) 2014-2016 Leosac
3
4
This file is part of Leosac.
5
6
Leosac is free software: you can redistribute it and/or modify
7
it under the terms of the GNU Affero General Public License as published by
8
the Free Software Foundation, either version 3 of the License, or
9
(at your option) any later version.
10
11
Leosac is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU Affero General Public License for more details.
15
16
You should have received a copy of the GNU Affero General Public License
17
along with this program. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#pragma once
21
22
#include "
AuditEntry.hpp
"
23
#include "
IZoneEvent.hpp
"
24
25
namespace
Leosac
26
{
27
namespace
Audit
28
{
32
#pragma db object polymorphic callback(odb_callback)
33
class
ZoneEvent
:
virtual
public
IZoneEvent
,
public
AuditEntry
34
{
35
private
:
36
ZoneEvent
();
37
38
friend
class
Factory
;
39
40
static
std::shared_ptr<ZoneEvent>
41
create
(
const
DBPtr
&
database
,
Auth::IZonePtr
target_zone,
AuditEntryPtr
parent
);
42
43
public
:
44
virtual
~ZoneEvent
() =
default
;
45
46
static
std::shared_ptr<ZoneEvent>
create_empty
();
47
48
virtual
void
target
(
Auth::IZonePtr
zone)
override
;
49
50
virtual
Auth::ZoneId
target_id
()
const override
;
51
52
virtual
void
before
(
const
std::string &repr)
override
;
53
54
virtual
void
after
(
const
std::string &repr)
override
;
55
56
virtual
const
std::string &
before
()
const override
;
57
58
virtual
const
std::string &
after
()
const override
;
59
60
virtual
std::string
generate_description
()
const override
;
61
62
public
:
66
std::string
generate_target_description
()
const
;
67
68
#pragma db on_delete(set_null)
69
Auth::ZoneLWPtr
target_
;
70
71
Auth::ZoneId
target_zone_id_
;
72
76
std::string
before_
;
77
81
std::string
after_
;
82
83
friend
class
odb::access
;
84
};
85
}
86
}
87
88
#ifdef ODB_COMPILER
89
#include "
core/auth/Zone.hpp
"
90
#endif
Leosac::Auth::ZoneId
unsigned long ZoneId
Definition:
AuthFwd.hpp:119
Leosac::Audit::ZoneEvent::ZoneEvent
ZoneEvent()
Definition:
ZoneEvent.cpp:32
Leosac::Audit::AuditEntryPtr
std::shared_ptr< AuditEntry > AuditEntryPtr
Definition:
AuditFwd.hpp:81
AuditEntry.hpp
Leosac::Audit::ZoneEvent::target_zone_id_
Auth::ZoneId target_zone_id_
Definition:
ZoneEvent.hpp:71
Leosac::Audit::AuditEntry::database
void database(DBPtr db)
Set the database pointer.
Definition:
AuditEntry.cpp:144
Leosac::Audit::ZoneEvent::before
virtual const std::string & before() const override
Definition:
ZoneEvent.cpp:93
Leosac::DBPtr
std::shared_ptr< odb::database > DBPtr
Definition:
db_fwd.hpp:31
Leosac::Audit::ZoneEvent
Provides an implementation of IZoneEvent.
Definition:
ZoneEvent.hpp:33
IZoneEvent.hpp
Leosac::Audit::ZoneEvent::target
virtual void target(Auth::IZonePtr zone) override
Set the zone that is targeted by the event.
Definition:
ZoneEvent.cpp:62
Leosac::Audit::ZoneEvent::generate_description
virtual std::string generate_description() const override
Generate a description for this event.
Definition:
ZoneEvent.cpp:103
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition:
APIStatusCode.hpp:22
Zone.hpp
Leosac::Audit::ZoneEvent::after_
std::string after_
Optional JSON dump of the object after the event took place.
Definition:
ZoneEvent.hpp:81
Leosac::Audit::ZoneEvent::generate_target_description
std::string generate_target_description() const
Generate a short description for the targeted zone.
Definition:
ZoneEvent.cpp:117
Leosac::Auth::ZoneLWPtr
odb::lazy_weak_ptr< Zone > ZoneLWPtr
Definition:
AuthFwd.hpp:122
Leosac::Audit::ZoneEvent::target_id
virtual Auth::ZoneId target_id() const override
Definition:
ZoneEvent.cpp:86
Leosac::Audit::Factory
Provide static methods to instanciate various Audit objects.
Definition:
AuditFactory.hpp:46
Leosac::Audit::ZoneEvent::access
friend class odb::access
Definition:
ZoneEvent.hpp:83
Leosac::Audit::ZoneEvent::~ZoneEvent
virtual ~ZoneEvent()=default
Leosac::Audit::AuditEntry::parent
virtual IAuditEntryPtr parent() const override
Retrieve the parent of this entry.
Definition:
AuditEntry.cpp:139
Leosac::Audit::IZoneEvent
Interface that describes an Audit object for zone related event.
Definition:
IZoneEvent.hpp:32
Leosac::Auth::IZonePtr
std::shared_ptr< IZone > IZonePtr
Definition:
AuthFwd.hpp:116
Leosac::Audit::ZoneEvent::create_empty
static std::shared_ptr< ZoneEvent > create_empty()
Definition:
ZoneEvent.cpp:129
Leosac::Audit::AuditEntry
Implementation of IAuditEntry, backed by ODB.
Definition:
AuditEntry.hpp:45
Leosac::Audit::ZoneEvent::create
static std::shared_ptr< ZoneEvent > create(const DBPtr &database, Auth::IZonePtr target_zone, AuditEntryPtr parent)
Definition:
ZoneEvent.cpp:37
Leosac::Audit::ZoneEvent::before_
std::string before_
Optional JSON dump of the object before the event took place.
Definition:
ZoneEvent.hpp:76
Leosac::Audit::ZoneEvent::after
virtual const std::string & after() const override
Definition:
ZoneEvent.cpp:98
Leosac::Audit::ZoneEvent::target_
Auth::ZoneLWPtr target_
Definition:
ZoneEvent.hpp:69
src
core
audit
ZoneEvent.hpp
Generated on Tue Mar 22 2022 10:48:17 for Leosac by
1.8.17