Leosac  0.8.0
Open Source Access Control
IAuditEntry.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 "core/audit/AuditFwd.hpp"
23 #include "core/auth/AuthFwd.hpp"
24 #include "tools/IVisitable.hpp"
25 #include <boost/date_time/posix_time/posix_time.hpp>
26 #include <memory>
27 
28 namespace Leosac
29 {
30 namespace Audit
31 {
47 class IAuditEntry : public virtual Tools::IVisitable
48 {
49  public:
51 
57  virtual AuditEntryId id() const = 0;
58 
74  virtual void finalize() = 0;
75 
79  virtual bool finalized() const = 0;
80 
90  virtual void reload() = 0;
91 
96  virtual void event_mask(const EventMask &mask) = 0;
97 
101  virtual const EventMask &event_mask() const = 0;
102 
113  virtual void author(Auth::UserPtr user) = 0;
114 
120  virtual Auth::UserId author_id() const = 0;
121 
142  virtual void set_parent(IAuditEntryPtr parent) = 0;
143 
147  virtual IAuditEntryPtr parent() const = 0;
148 
157  virtual void remove_parent() = 0;
158 
162  virtual size_t children_count() const = 0;
163 
167  virtual boost::posix_time::ptime timestamp() const = 0;
168 
173  virtual std::string generate_description() const
174  {
175  return "";
176  }
177 
183  virtual size_t version() const = 0;
184 };
185 }
186 }
Leosac::Audit::IAuditEntry::version
virtual size_t version() const =0
Returns the ODB version of the object.
Leosac::Audit::IAuditEntry::author
virtual void author(Auth::UserPtr user)=0
Set the author of the entry.
AuthFwd.hpp
Leosac::Auth::UserPtr
std::shared_ptr< User > UserPtr
Definition: AuthFwd.hpp:31
Leosac::Audit::IAuditEntry::set_parent
virtual void set_parent(IAuditEntryPtr parent)=0
Set parent as the parent audit entry for this entry.
Leosac::Audit::AuditEntryId
unsigned long AuditEntryId
Definition: AuditFwd.hpp:31
Leosac::Audit::IAuditEntryPtr
std::shared_ptr< IAuditEntry > IAuditEntryPtr
Definition: AuditFwd.hpp:40
Leosac::Audit::IAuditEntry::finalize
virtual void finalize()=0
Mark the entry as finalized, and update it wrt the database.
Leosac::Audit::IAuditEntry::MAKE_VISITABLE
MAKE_VISITABLE()
Leosac::Audit::IAuditEntry::children_count
virtual size_t children_count() const =0
Returns the number of children that this entry has.
Leosac::Audit::IAuditEntry::remove_parent
virtual void remove_parent()=0
Remove the parent-child relationship between this entry and its parent.
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition: APIStatusCode.hpp:22
Leosac::Audit::IAuditEntry::event_mask
virtual const EventMask & event_mask() const =0
Retrieve the current event mask.
Leosac::Audit::IAuditEntry::timestamp
virtual boost::posix_time::ptime timestamp() const =0
Retrieve unix timestamp.
Leosac::Audit::IAuditEntry::generate_description
virtual std::string generate_description() const
Generate a description for this event.
Definition: IAuditEntry.hpp:173
Leosac::Audit::EventMask
FlagSet< EventType > EventMask
Definition: AuditFwd.hpp:179
Leosac::Audit::IAuditEntry::parent
virtual IAuditEntryPtr parent() const =0
Retrieve the parent of this entry.
Leosac::Tools::IVisitable
Base class to make an object visitable.
Definition: IVisitable.hpp:43
Leosac::Audit::IAuditEntry::author_id
virtual Auth::UserId author_id() const =0
Retrieve the user id of the author of this entry.
Leosac::Audit::IAuditEntry::reload
virtual void reload()=0
Reload the object from the database.
Leosac::Audit::IAuditEntry
Base interface to Audit object.
Definition: IAuditEntry.hpp:47
Leosac::Auth::UserId
unsigned long UserId
Definition: AuthFwd.hpp:34
Leosac::Audit::IAuditEntry::id
virtual AuditEntryId id() const =0
Retrieve the identifier of the entry.
IVisitable.hpp
AuditFwd.hpp
Leosac::Audit::IAuditEntry::finalized
virtual bool finalized() const =0
Is this entry finalized.