Leosac  0.8.0
Open Source Access Control
ICredential.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/auth/AuthFwd.hpp"
24 #include "tools/IVisitable.hpp"
25 #include "tools/ToolsFwd.hpp"
26 #include <memory>
27 
28 namespace Leosac
29 {
30 namespace Cred
31 {
35 class ICredential : public virtual Tools::IVisitable
36 {
37  public:
39 
43  virtual CredentialId id() const = 0;
44 
51  virtual void id(const CredentialId &new_id) = 0;
52 
56  virtual Auth::UserLPtr owner() const = 0;
57 
62  virtual Auth::UserId owner_id() const = 0;
63 
67  virtual void owner(Auth::UserLPtr) = 0;
68 
72  virtual std::string alias() const = 0;
73 
77  virtual void alias(const std::string &) = 0;
78 
82  virtual std::string description() const = 0;
83 
87  virtual void description(const std::string &) = 0;
88 
92  virtual void validity(const Auth::ValidityInfo &) = 0;
93 
97  virtual const Auth::ValidityInfo &validity() const = 0;
98 
103  virtual std::vector<Tools::ScheduleMappingLWPtr>
104  lazy_schedules_mapping() const = 0;
105 
110  virtual size_t odb_version() const = 0;
111 };
112 }
113 }
Leosac::Cred::ICredential::validity
virtual const Auth::ValidityInfo & validity() const =0
Retrieve validity status from the credential.
Leosac::Cred::ICredential::lazy_schedules_mapping
virtual std::vector< Tools::ScheduleMappingLWPtr > lazy_schedules_mapping() const =0
Retrieve the lazy_weak_ptr to ScheduleMapping that map this credential.
AuthFwd.hpp
Leosac::Cred::ICredential::owner_id
virtual Auth::UserId owner_id() const =0
Returns the id of the owner, or 0 if there is no owner (or the owner has no id).
Leosac::Cred::ICredential::description
virtual std::string description() const =0
An optional description / notes for the credential.
Leosac::Cred::ICredential::owner
virtual Auth::UserLPtr owner() const =0
Retrieve the owner of the credential.
ToolsFwd.hpp
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::Cred::ICredential
Base interface for credential objects.
Definition: ICredential.hpp:35
Leosac::Tools::IVisitable
Base class to make an object visitable.
Definition: IVisitable.hpp:43
Leosac::Cred::CredentialId
unsigned long CredentialId
Definition: CredentialFwd.hpp:35
Leosac::Cred::ICredential::alias
virtual std::string alias() const =0
An alias for the credential.
Leosac::Auth::UserId
unsigned long UserId
Definition: AuthFwd.hpp:34
IVisitable.hpp
CredentialFwd.hpp
Leosac::Cred::ICredential::id
virtual CredentialId id() const =0
Retrieve the identifier of the credential.
Leosac::Cred::ICredential::odb_version
virtual size_t odb_version() const =0
Credentials are "optimistic" object (wrt ODB).
Leosac::Cred::ICredential::MAKE_VISITABLE
MAKE_VISITABLE()
Leosac::Auth::ValidityInfo
A simple class that stores (and can be queried for) the validity of some objects.
Definition: ValidityInfo.hpp:42