Leosac  0.8.0
Open Source Access Control
AuthFwd.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 <cstddef>
23 #include <memory>
24 #include <odb/lazy-ptr.hxx>
25 
26 namespace Leosac
27 {
28 namespace Auth
29 {
30 class User;
31 using UserPtr = std::shared_ptr<User>;
32 using UserLPtr = odb::lazy_shared_ptr<User>;
33 using UserLWPtr = odb::lazy_weak_ptr<User>;
34 using UserId = unsigned long;
35 
36 class Group;
37 using GroupPtr = std::shared_ptr<Group>;
38 using GroupWPtr = std::weak_ptr<Group>;
39 using GroupLWPtr = odb::lazy_weak_ptr<Group>;
40 using GroupLPtr = odb::lazy_shared_ptr<Group>;
41 using GroupId = unsigned long;
42 
44 using SimpleAccessProfilePtr = std::shared_ptr<SimpleAccessProfile>;
45 
49 enum class GroupRank
50 {
51  MEMBER = 0,
52  OPERATOR = 1,
53  ADMIN = 2,
54 };
55 
56 enum class UserRank
57 {
61  USER = 0,
65  VIEWER = 1,
69  MANAGER = 2,
73  SUPERVISOR = 3,
77  ADMIN = 4,
78 };
79 
80 class UserGroupMembership;
81 using UserGroupMembershipPtr = std::shared_ptr<UserGroupMembership>;
82 using UserGroupMembershipId = unsigned long;
83 
84 class Token;
85 using TokenPtr = std::shared_ptr<Token>;
86 
87 class IAccessProfile;
88 using IAccessProfilePtr = std::shared_ptr<IAccessProfile>;
89 
90 class ValidityInfo;
91 
92 class AuthTarget;
93 using AuthTargetPtr = std::shared_ptr<AuthTarget>;
94 
96 using IAuthenticationSourcePtr = std::shared_ptr<IAuthenticationSource>;
97 
98 class BaseAuthSource;
99 using BaseAuthSourcePtr = std::shared_ptr<BaseAuthSource>;
100 
101 class WiegandCard;
102 
103 class IDoor;
104 using IDoorPtr = std::shared_ptr<IDoor>;
105 using IDoorLPtr = odb::lazy_shared_ptr<IDoor>;
106 using IDoorLWPtr = odb::lazy_weak_ptr<IDoor>;
107 using DoorId = unsigned long;
108 
109 class Door;
110 using DoorLWPtr = odb::lazy_weak_ptr<Door>;
111 using DoorLPtr = odb::lazy_shared_ptr<Door>;
112 using DoorPtr = std::shared_ptr<Door>;
113 
114 
115 class IZone;
116 using IZonePtr = std::shared_ptr<IZone>;
117 using IZoneLPtr = odb::lazy_shared_ptr<IZone>;
118 using IZoneLWPtr = odb::lazy_weak_ptr<IZone>;
119 using ZoneId = unsigned long;
120 
121 class Zone;
122 using ZoneLWPtr = odb::lazy_weak_ptr<Zone>;
123 using ZoneLPtr = odb::lazy_shared_ptr<Zone>;
124 using ZonePtr = std::shared_ptr<Zone>;
125 
126 class IAccessPoint;
127 using IAccessPointPtr = std::shared_ptr<IAccessPoint>;
128 using AccessPointId = unsigned long;
129 
130 class AccessPoint;
131 using AccessPointLWPtr = odb::lazy_weak_ptr<AccessPoint>;
132 using AccessPointLPtr = odb::lazy_shared_ptr<AccessPoint>;
133 using AccessPointPtr = std::shared_ptr<AccessPoint>;
134 
135 class AccessPointUpdate;
136 using AccessPointUpdatePtr = std::shared_ptr<AccessPointUpdate>;
137 using AccessPointUpdateLPtr = odb::lazy_shared_ptr<AccessPointUpdate>;
138 }
139 }
Leosac::Auth::AuthTarget
Represent an object that we are authorizing against (a door).
Definition: AuthTarget.hpp:37
Leosac::Auth::IZoneLPtr
odb::lazy_shared_ptr< IZone > IZoneLPtr
Definition: AuthFwd.hpp:117
Leosac::Auth::ZoneId
unsigned long ZoneId
Definition: AuthFwd.hpp:119
Leosac::Auth::UserRank::SUPERVISOR
@ SUPERVISOR
Full access except changing user role.
Leosac::Auth::IZoneLWPtr
odb::lazy_weak_ptr< IZone > IZoneLWPtr
Definition: AuthFwd.hpp:118
Leosac::Auth::Token
An authentication token used for authenticating a user against Leosac.
Definition: Token.hpp:42
Leosac::Auth::TokenPtr
std::shared_ptr< Token > TokenPtr
Definition: AuthFwd.hpp:85
Leosac::Auth::GroupLPtr
odb::lazy_shared_ptr< Group > GroupLPtr
Definition: AuthFwd.hpp:40
Leosac::Auth::UserRank
UserRank
Definition: AuthFwd.hpp:56
Leosac::Auth::GroupRank::MEMBER
@ MEMBER
Leosac::Auth::IZone
The interface for zones.
Definition: IZone.hpp:47
Leosac::Auth::UserLWPtr
odb::lazy_weak_ptr< User > UserLWPtr
Definition: AuthFwd.hpp:33
Leosac::Auth::AccessPointUpdate
Definition: AccessPointUpdate.hpp:29
Leosac::Auth::UserPtr
std::shared_ptr< User > UserPtr
Definition: AuthFwd.hpp:31
Leosac::Auth::GroupRank::ADMIN
@ ADMIN
Leosac::Auth::IAccessProfilePtr
std::shared_ptr< IAccessProfile > IAccessProfilePtr
Definition: AuthFwd.hpp:88
Leosac::Auth::IDoorLWPtr
odb::lazy_weak_ptr< IDoor > IDoorLWPtr
Definition: AuthFwd.hpp:106
Leosac::Auth::BaseAuthSource
Definition: BaseAuthSource.hpp:34
Leosac::Auth::AccessPointUpdatePtr
std::shared_ptr< AccessPointUpdate > AccessPointUpdatePtr
Definition: AuthFwd.hpp:136
Leosac::Auth::UserRank::USER
@ USER
A default user.
Leosac::Auth::UserRank::VIEWER
@ VIEWER
Has viewing permission.
Leosac::Auth::IAccessPointPtr
std::shared_ptr< IAccessPoint > IAccessPointPtr
Definition: AuthFwd.hpp:127
Leosac::Auth::AuthTargetPtr
std::shared_ptr< AuthTarget > AuthTargetPtr
Definition: AuthFwd.hpp:93
Leosac::Auth::Zone
A Zone is a container for doors and other zone.
Definition: Zone.hpp:60
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition: APIStatusCode.hpp:22
Leosac::Auth::UserLPtr
odb::lazy_shared_ptr< User > UserLPtr
Definition: AuthFwd.hpp:32
Leosac::Auth::AccessPointUpdateLPtr
odb::lazy_shared_ptr< AccessPointUpdate > AccessPointUpdateLPtr
Definition: AuthFwd.hpp:137
Leosac::Auth::AccessPointLWPtr
odb::lazy_weak_ptr< AccessPoint > AccessPointLWPtr
Definition: AuthFwd.hpp:131
Leosac::Auth::ZoneLWPtr
odb::lazy_weak_ptr< Zone > ZoneLWPtr
Definition: AuthFwd.hpp:122
Leosac::Auth::DoorPtr
std::shared_ptr< Door > DoorPtr
Definition: AuthFwd.hpp:112
Leosac::Auth::DoorId
unsigned long DoorId
Definition: AuthFwd.hpp:107
Leosac::Auth::UserGroupMembershipId
unsigned long UserGroupMembershipId
Definition: AuthFwd.hpp:82
Leosac::Auth::AccessPointPtr
std::shared_ptr< AccessPoint > AccessPointPtr
Definition: AuthFwd.hpp:133
Leosac::Auth::SimpleAccessProfile
Concrete implementation of a simple access control class.
Definition: SimpleAccessProfile.hpp:39
Leosac::Auth::Door
Represent a door.
Definition: Door.hpp:35
Leosac::Auth::IDoorPtr
std::shared_ptr< IDoor > IDoorPtr
Definition: AuthFwd.hpp:104
Leosac::Auth::GroupPtr
std::shared_ptr< Group > GroupPtr
Definition: AuthFwd.hpp:37
Leosac::Auth::Group
A authentication group regroup users that share permissions.
Definition: Group.hpp:57
Leosac::Auth::IAuthenticationSourcePtr
std::shared_ptr< IAuthenticationSource > IAuthenticationSourcePtr
Definition: AuthFwd.hpp:96
Leosac::Auth::SimpleAccessProfilePtr
std::shared_ptr< SimpleAccessProfile > SimpleAccessProfilePtr
Definition: AuthFwd.hpp:44
Leosac::Auth::IDoorLPtr
odb::lazy_shared_ptr< IDoor > IDoorLPtr
Definition: AuthFwd.hpp:105
Leosac::Auth::ZonePtr
std::shared_ptr< Zone > ZonePtr
Definition: AuthFwd.hpp:124
Leosac::Auth::IAccessProfile
Holds information about access permission.
Definition: IAccessProfile.hpp:36
Leosac::Auth::UserGroupMembershipPtr
std::shared_ptr< UserGroupMembership > UserGroupMembershipPtr
Definition: AuthFwd.hpp:81
Leosac::Auth::ZoneLPtr
odb::lazy_shared_ptr< Zone > ZoneLPtr
Definition: AuthFwd.hpp:123
Leosac::Auth::IAuthenticationSource
An Auth source is a card id, a pin code, a fingerprint, etc...
Definition: IAuthenticationSource.hpp:40
Leosac::Auth::GroupId
unsigned long GroupId
Definition: AuthFwd.hpp:41
Leosac::Auth::BaseAuthSourcePtr
std::shared_ptr< BaseAuthSource > BaseAuthSourcePtr
Definition: AuthFwd.hpp:99
Leosac::Auth::UserRank::ADMIN
@ ADMIN
Site administrator.
Leosac::Auth::IZonePtr
std::shared_ptr< IZone > IZonePtr
Definition: AuthFwd.hpp:116
Leosac::Auth::UserRank::MANAGER
@ MANAGER
Can access user management aswel as credential management.
Leosac::Auth::UserId
unsigned long UserId
Definition: AuthFwd.hpp:34
Leosac::Auth::GroupRank
GroupRank
The rank of an User inside a Group.
Definition: AuthFwd.hpp:49
Leosac::Auth::AccessPoint
Definition: AccessPoint.hpp:30
Leosac::Auth::GroupLWPtr
odb::lazy_weak_ptr< Group > GroupLWPtr
Definition: AuthFwd.hpp:39
Leosac::Auth::GroupWPtr
std::weak_ptr< Group > GroupWPtr
Definition: AuthFwd.hpp:38
Leosac::Auth::IDoor
A door.
Definition: IDoor.hpp:38
Leosac::Auth::GroupRank::OPERATOR
@ OPERATOR
Leosac::Auth::IAccessPoint
An interface for access point.
Definition: IAccessPoint.hpp:35
Leosac::Auth::DoorLPtr
odb::lazy_shared_ptr< Door > DoorLPtr
Definition: AuthFwd.hpp:111
Leosac::Auth::AccessPointLPtr
odb::lazy_shared_ptr< AccessPoint > AccessPointLPtr
Definition: AuthFwd.hpp:132
Leosac::Auth::ValidityInfo
A simple class that stores (and can be queried for) the validity of some objects.
Definition: ValidityInfo.hpp:42
Leosac::Auth::AccessPointId
unsigned long AccessPointId
Definition: AuthFwd.hpp:128
Leosac::Auth::DoorLWPtr
odb::lazy_weak_ptr< Door > DoorLWPtr
Definition: AuthFwd.hpp:110