Leosac
0.8.0
Open Source Access Control
|
A simple class that stores (and can be queried for) the validity of some objects. More...
#include <ValidityInfo.hpp>
Public Types | |
using | TimePoint = std::chrono::system_clock::time_point |
Public Member Functions | |
ValidityInfo () | |
Default status is: enabled and no time-based limitation. More... | |
ValidityInfo (const ValidityInfo &)=default | |
bool | is_valid () const |
Check that the current date is between validity start and end and make sure its enabled too. More... | |
bool | is_enabled () const |
Is the credential enabled ? More... | |
bool | is_in_range () const |
Are we currently is the validity range of the credential ? More... | |
void | set_start_date (const std::string &s) |
Set the start validity date. More... | |
void | set_end_date (const std::string &s) |
Set the end validity date. More... | |
void | set_enabled (bool v) |
const TimePoint & | start () const |
void | start (const TimePoint &tp) |
const TimePoint & | end () const |
void | end (const TimePoint &tp) |
Private Attributes | |
TimePoint | start_ |
TimePoint | end_ |
bool | enabled_ |
Friends | |
class | odb::access |
A simple class that stores (and can be queried for) the validity of some objects.
Validity means 3 simple thing:
You can set validity_start to time::min(), and validity_end to time::max if there is no validity date.
Definition at line 42 of file ValidityInfo.hpp.
using Leosac::Auth::ValidityInfo::TimePoint = std::chrono::system_clock::time_point |
Definition at line 45 of file ValidityInfo.hpp.
ValidityInfo::ValidityInfo | ( | ) |
Default status is: enabled and no time-based limitation.
Definition at line 27 of file ValidityInfo.cpp.
|
default |
const ValidityInfo::TimePoint & ValidityInfo::end | ( | ) | const |
Definition at line 103 of file ValidityInfo.cpp.
void ValidityInfo::end | ( | const TimePoint & | tp | ) |
Definition at line 113 of file ValidityInfo.cpp.
bool ValidityInfo::is_enabled | ( | ) | const |
Is the credential enabled ?
Definition at line 39 of file ValidityInfo.cpp.
bool ValidityInfo::is_in_range | ( | ) | const |
Are we currently is the validity range of the credential ?
Definition at line 44 of file ValidityInfo.cpp.
bool ValidityInfo::is_valid | ( | ) | const |
Check that the current date is between validity start and end and make sure its enabled too.
Definition at line 34 of file ValidityInfo.cpp.
void ValidityInfo::set_enabled | ( | bool | v | ) |
Definition at line 93 of file ValidityInfo.cpp.
void ValidityInfo::set_end_date | ( | const std::string & | s | ) |
Set the end validity date.
We receive the date as a string. The expected format is this: d/m/Y H:M
This method accept an empty string, if that case it will set the end_date to time_point::max()
.
Definition at line 72 of file ValidityInfo.cpp.
void ValidityInfo::set_start_date | ( | const std::string & | s | ) |
Set the start validity date.
We receive the date as a string. The expected format is this: d/m/Y H:M
This method accept an empty string, if that case it will set the end_date to time_point::min()
.
Definition at line 51 of file ValidityInfo.cpp.
const ValidityInfo::TimePoint & ValidityInfo::start | ( | ) | const |
Definition at line 98 of file ValidityInfo.cpp.
void ValidityInfo::start | ( | const TimePoint & | tp | ) |
Definition at line 108 of file ValidityInfo.cpp.
|
friend |
Definition at line 98 of file ValidityInfo.hpp.
|
private |
Definition at line 104 of file ValidityInfo.hpp.
|
private |
Definition at line 102 of file ValidityInfo.hpp.
|
private |
Definition at line 100 of file ValidityInfo.hpp.