Leosac
0.8.0
Open Source Access Control
UserEvent.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 "
IUserEvent.hpp
"
24
25
namespace
Leosac
26
{
27
namespace
Audit
28
{
32
#pragma db object polymorphic callback(odb_callback)
33
class
UserEvent
:
virtual
public
IUserEvent
,
public
AuditEntry
34
{
35
private
:
36
UserEvent
() =
default
;
37
38
friend
class
Factory
;
39
40
static
std::shared_ptr<UserEvent>
41
create
(
const
DBPtr
&
database
,
Auth::UserPtr
target_user,
AuditEntryPtr
parent
);
42
43
public
:
44
virtual
~UserEvent
() =
default
;
45
46
static
std::shared_ptr<UserEvent>
create_empty
();
47
48
virtual
void
target
(
Auth::UserPtr
user)
override
;
49
50
virtual
Auth::UserLPtr
target
()
const override
;
51
52
Auth::UserId
target_id
()
const override
;
53
54
virtual
void
before
(
const
std::string &repr)
override
;
55
56
const
std::string &
before
()
const override
;
57
58
const
std::string &
after
()
const override
;
59
60
virtual
void
after
(
const
std::string &repr)
override
;
61
62
std::string
generate_description
()
const override
;
63
64
private
:
69
std::string
generate_target_description
()
const
;
70
71
#pragma db not_null
72
Auth::UserLWPtr
target_
;
73
77
std::string
before_
;
78
82
std::string
after_
;
83
84
friend
class
odb::access
;
85
};
86
}
87
}
Leosac::Audit::UserEvent::generate_description
std::string generate_description() const override
Generate a description for this event.
Definition:
UserEvent.cpp:92
Leosac::Audit::UserEvent::create_empty
static std::shared_ptr< UserEvent > create_empty()
Definition:
UserEvent.cpp:118
Leosac::Audit::UserEvent::UserEvent
UserEvent()=default
Leosac::Audit::AuditEntryPtr
std::shared_ptr< AuditEntry > AuditEntryPtr
Definition:
AuditFwd.hpp:81
AuditEntry.hpp
Leosac::Audit::UserEvent::after_
std::string after_
Optional JSON dump of the object after the event took place.
Definition:
UserEvent.hpp:82
Leosac::Audit::UserEvent::access
friend class odb::access
Definition:
UserEvent.hpp:84
Leosac::Auth::UserLWPtr
odb::lazy_weak_ptr< User > UserLWPtr
Definition:
AuthFwd.hpp:33
Leosac::Audit::UserEvent::create
static std::shared_ptr< UserEvent > create(const DBPtr &database, Auth::UserPtr target_user, AuditEntryPtr parent)
Definition:
UserEvent.cpp:30
Leosac::Audit::AuditEntry::database
void database(DBPtr db)
Set the database pointer.
Definition:
AuditEntry.cpp:144
Leosac::Auth::UserPtr
std::shared_ptr< User > UserPtr
Definition:
AuthFwd.hpp:31
Leosac::Audit::UserEvent::before
const std::string & before() const override
Definition:
UserEvent.cpp:82
Leosac::DBPtr
std::shared_ptr< odb::database > DBPtr
Definition:
db_fwd.hpp:31
Leosac::Audit::IUserEvent
Interface that describes an Audit object when a user-related event happens.
Definition:
IUserEvent.hpp:37
Leosac::Audit::UserEvent
Provides an implementation of IUserEvent.
Definition:
UserEvent.hpp:33
Leosac::Audit::UserEvent::target_
Auth::UserLWPtr target_
Definition:
UserEvent.hpp:72
IUserEvent.hpp
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition:
APIStatusCode.hpp:22
Leosac::Audit::UserEvent::after
const std::string & after() const override
Definition:
UserEvent.cpp:87
Leosac::Auth::UserLPtr
odb::lazy_shared_ptr< User > UserLPtr
Definition:
AuthFwd.hpp:32
Leosac::Audit::Factory
Provide static methods to instanciate various Audit objects.
Definition:
AuditFactory.hpp:46
Leosac::Audit::UserEvent::target
virtual Auth::UserLPtr target() const override
Definition:
UserEvent.cpp:123
Leosac::Audit::AuditEntry::parent
virtual IAuditEntryPtr parent() const override
Retrieve the parent of this entry.
Definition:
AuditEntry.cpp:139
Leosac::Audit::UserEvent::target_id
Auth::UserId target_id() const override
Retrieve the user_id that was targeted by this event.
Definition:
UserEvent.cpp:75
Leosac::Audit::UserEvent::~UserEvent
virtual ~UserEvent()=default
Leosac::Audit::UserEvent::before_
std::string before_
Optional JSON dump of the object before the event took place.
Definition:
UserEvent.hpp:77
Leosac::Auth::UserId
unsigned long UserId
Definition:
AuthFwd.hpp:34
Leosac::Audit::AuditEntry
Implementation of IAuditEntry, backed by ODB.
Definition:
AuditEntry.hpp:45
Leosac::Audit::UserEvent::generate_target_description
std::string generate_target_description() const
Generate a small json-string to describe the target user.
Definition:
UserEvent.cpp:107
src
core
audit
UserEvent.hpp
Generated on Tue Mar 22 2022 10:48:17 for Leosac by
1.8.17