24 #include "core/audit/AuditEntry_odb.h" 25 #include "core/auth/AccessPoint_odb.h" 26 #include "core/auth/Door_odb.h" 27 #include "core/auth/Group_odb.h" 28 #include "core/auth/User_odb.h" 29 #include "core/auth/Zone_odb.h" 30 #include "core/credentials/Credential_odb.h" 33 #include "tools/Schedule_odb.h" 35 #include <odb/database.hxx> 56 return tracer->
count();
66 if (!grp && flags & Flag::THROW_IF_NOT_FOUND)
76 if (!user && flags & Flag::THROW_IF_NOT_FOUND)
87 if (!ugm && flags & Flag::THROW_IF_NOT_FOUND)
98 if (!cred && flags & Flag::THROW_IF_NOT_FOUND)
109 if (!sched && flags & Flag::THROW_IF_NOT_FOUND)
120 if (!door && flags & Flag::THROW_IF_NOT_FOUND)
131 if (!zone && flags & Flag::THROW_IF_NOT_FOUND)
143 if (!audit && flags & Flag::THROW_IF_NOT_FOUND)
157 if (!ap && flags & Flag::THROW_IF_NOT_FOUND)
168 if (!ap && flags & Flag::THROW_IF_NOT_FOUND)
173 template <
typename T>
174 static void persist_impl(
const DBPtr db, T &&obj)
177 ASSERT_LOG(obj.id() == 0,
"Object is probably already persisted.");
178 db->persist(std::forward<T>(obj));
182 template <
typename T>
183 static void update_impl(
const DBPtr db, T &&obj)
186 db->update(std::forward<T>(obj));
192 persist_impl(
database_, assert_cast<Audit::AuditEntry &>(ientry));
197 update_impl(
database_, assert_cast<Audit::AuditEntry &>(ientry));
unsigned long AccessPointId
virtual size_t count() const =0
Return the number of statement that have been traced.
Implementation of IAuditEntry, backed by ODB.
Auth::IDoorPtr find_door_by_id(const Auth::DoorId &id, Flag f=Flag::DEFAULT)
std::shared_ptr< IZone > IZonePtr
An ODB enabled credential object.
This is the header file for a generated source file, GitSHA1.cpp.
Auth::UserGroupMembershipPtr find_membership_by_id(const Auth::UserGroupMembershipId &id, Flag f=Flag::DEFAULT)
unsigned long UserGroupMembershipId
A authentication group regroup users that share permissions.
unsigned long AuditEntryId
DBPtr db() const
Simply returns the underlying database pointer.
An optional transaction is an object that behave like an odb::transaction if there is no currently ac...
std::shared_ptr< IAuditEntry > IAuditEntryPtr
void persist(Audit::IAuditEntry &)
Persist an audit entry object.
std::shared_ptr< IDoor > IDoorPtr
std::shared_ptr< IAccessPoint > IAccessPointPtr
update::IUpdatePtr find_update_by_id(const update::UpdateId &id, Flag f=Flag::DEFAULT)
A Zone is a container for doors and other zone.
Auth::IAccessPointPtr find_access_point_by_id(const Auth::AccessPointId &id, Flag f=Flag::DEFAULT)
std::shared_ptr< ICredential > ICredentialPtr
A Leosac specific base class for tracing database operation.
std::shared_ptr< IUpdate > IUpdatePtr
Auth::IZonePtr find_zone_by_id(const Auth::ZoneId &id, Flag f=Flag::DEFAULT)
std::shared_ptr< Group > GroupPtr
Audit::IAuditEntryPtr find_audit_by_id(const Audit::AuditEntryId &id, Flag f=Flag::DEFAULT)
Base interface to Audit object.
Tools::ISchedulePtr find_schedule_by_id(const Tools::ScheduleId &id, Flag f=Flag::DEFAULT)
std::shared_ptr< User > UserPtr
Auth::GroupPtr find_group_by_id(const Auth::GroupId &id, Flag f=Flag::DEFAULT)
Retrieve a group by its id.
std::shared_ptr< UserGroupMembership > UserGroupMembershipPtr
void update(Audit::IAuditEntry &)
Update the object.
#define ASSERT_LOG(cond, msg)
Auth::UserPtr find_user_by_id(const Auth::UserId &id, Flag f=Flag::DEFAULT)
Find a user by its id.
Describe the membership of an User with regroup to a Group.
Cred::ICredentialPtr find_credential_by_id(const Cred::CredentialId &id, Flag f=Flag::DEFAULT)
unsigned long CredentialId
std::shared_ptr< odb::database > DBPtr
std::enable_if_t< is_shared_ptr_v< Out >, Out > assert_cast(const std::shared_ptr< In > &in)
size_t operation_count() const
Return the number of operation against the database.