Leosac
0.8.0
Open Source Access Control
ScheduleEvent.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 "
IScheduleEvent.hpp
"
24
#include "
tools/ToolsFwd.hpp
"
25
26
namespace
Leosac
27
{
28
namespace
Audit
29
{
33
#pragma db object polymorphic callback(odb_callback)
34
class
ScheduleEvent
:
virtual
public
IScheduleEvent
,
public
AuditEntry
35
{
36
private
:
37
ScheduleEvent
() =
default
;
38
39
friend
class
Factory
;
40
41
static
std::shared_ptr<ScheduleEvent>
create
(
const
DBPtr
&
database
,
42
Tools::ISchedulePtr
target_sched,
43
AuditEntryPtr
parent
);
44
45
public
:
49
static
std::shared_ptr<ScheduleEvent>
create_empty
();
50
51
virtual
~ScheduleEvent
() =
default
;
52
53
virtual
void
target
(
Tools::ISchedulePtr
sch)
override
;
54
55
virtual
void
before
(
const
std::string &repr)
override
;
56
57
virtual
void
after
(
const
std::string &repr)
override
;
58
59
Tools::ScheduleId
target_id
()
const override
;
60
61
const
std::string &
before
()
const override
;
62
63
const
std::string &
after
()
const override
;
64
65
std::string
generate_description
()
const override
;
66
67
private
:
68
std::string
generate_target_description
()
const
;
69
70
#pragma db on_delete(set_null)
71
Tools::ScheduleLWPtr
target_
;
72
73
Tools::ScheduleId
target_sched_id_
;
74
78
std::string
before_
;
79
83
std::string
after_
;
84
85
friend
class
odb::access
;
86
};
87
}
88
}
89
90
#ifdef ODB_COMPILER
91
#include "
tools/Schedule.hpp
"
92
#endif
Leosac::Tools::ISchedulePtr
std::shared_ptr< ISchedule > ISchedulePtr
Definition:
ToolsFwd.hpp:37
Leosac::Audit::ScheduleEvent::target
virtual void target(Tools::ISchedulePtr sch) override
Set the user that is targeted by the event.
Definition:
ScheduleEvent.cpp:60
Leosac::Audit::ScheduleEvent::after
const std::string & after() const override
Definition:
ScheduleEvent.cpp:99
Leosac::Audit::AuditEntryPtr
std::shared_ptr< AuditEntry > AuditEntryPtr
Definition:
AuditFwd.hpp:81
Leosac::Audit::ScheduleEvent::access
friend class odb::access
Definition:
ScheduleEvent.hpp:85
AuditEntry.hpp
Leosac::Audit::ScheduleEvent::~ScheduleEvent
virtual ~ScheduleEvent()=default
Leosac::Audit::AuditEntry::database
void database(DBPtr db)
Set the database pointer.
Definition:
AuditEntry.cpp:144
Leosac::DBPtr
std::shared_ptr< odb::database > DBPtr
Definition:
db_fwd.hpp:31
Leosac::Audit::ScheduleEvent::before_
std::string before_
Optional JSON dump of the object before the event took place.
Definition:
ScheduleEvent.hpp:78
Leosac::Audit::ScheduleEvent::target_id
Tools::ScheduleId target_id() const override
Definition:
ScheduleEvent.cpp:85
ToolsFwd.hpp
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition:
APIStatusCode.hpp:22
Leosac::Audit::ScheduleEvent::create_empty
static std::shared_ptr< ScheduleEvent > create_empty()
A factory function for usage in tests.
Definition:
ScheduleEvent.cpp:55
Leosac::Audit::ScheduleEvent::generate_target_description
std::string generate_target_description() const
Definition:
ScheduleEvent.cpp:122
Leosac::Audit::Factory
Provide static methods to instanciate various Audit objects.
Definition:
AuditFactory.hpp:46
Leosac::Tools::ScheduleId
unsigned long ScheduleId
Definition:
ToolsFwd.hpp:33
Leosac::Audit::ScheduleEvent::generate_description
std::string generate_description() const override
Generate a description for this event.
Definition:
ScheduleEvent.cpp:104
Leosac::Tools::ScheduleLWPtr
odb::lazy_weak_ptr< Schedule > ScheduleLWPtr
Definition:
ToolsFwd.hpp:34
Leosac::Audit::AuditEntry::parent
virtual IAuditEntryPtr parent() const override
Retrieve the parent of this entry.
Definition:
AuditEntry.cpp:139
Leosac::Audit::ScheduleEvent::create
static std::shared_ptr< ScheduleEvent > create(const DBPtr &database, Tools::ISchedulePtr target_sched, AuditEntryPtr parent)
Definition:
ScheduleEvent.cpp:33
Leosac::Audit::IScheduleEvent
Audit interface to Schedule related events.
Definition:
IScheduleEvent.hpp:32
Leosac::Audit::ScheduleEvent::ScheduleEvent
ScheduleEvent()=default
Leosac::Audit::ScheduleEvent::after_
std::string after_
Optional JSON dump of the object after the event took place.
Definition:
ScheduleEvent.hpp:83
Leosac::Audit::AuditEntry
Implementation of IAuditEntry, backed by ODB.
Definition:
AuditEntry.hpp:45
IScheduleEvent.hpp
Leosac::Audit::ScheduleEvent::target_
Tools::ScheduleLWPtr target_
Definition:
ScheduleEvent.hpp:71
Schedule.hpp
Leosac::Audit::ScheduleEvent::target_sched_id_
Tools::ScheduleId target_sched_id_
Definition:
ScheduleEvent.hpp:73
Leosac::Audit::ScheduleEvent
Provides an implementation of IScheduleEvent.
Definition:
ScheduleEvent.hpp:34
Leosac::Audit::ScheduleEvent::before
const std::string & before() const override
Definition:
ScheduleEvent.cpp:94
src
core
audit
ScheduleEvent.hpp
Generated on Tue Mar 22 2022 10:48:15 for Leosac by
1.8.17