Leosac  0.8.0
Open Source Access Control
Leosac::Auth::SimpleAccessProfile Class Reference

Concrete implementation of a simple access control class. More...

#include <SimpleAccessProfile.hpp>

+ Inheritance diagram for Leosac::Auth::SimpleAccessProfile:
+ Collaboration diagram for Leosac::Auth::SimpleAccessProfile:

Public Member Functions

virtual bool isAccessGranted (const std::chrono::system_clock::time_point &date, AuthTargetPtr target) override
 Does the profile allow access to the user. More...
 
virtual void addAccessSchedule (AuthTargetPtr target, const Tools::IScheduleCPtr &sched)
 Adds a schedule where access to a given target is allowed. More...
 
virtual const std::vector< Tools::IScheduleCPtr > & defaultSchedules () const
 
virtual const std::map< std::string, std::vector< Tools::IScheduleCPtr > > & schedules () const
 Returns the map of schedule for each target (except the default target) More...
 
virtual size_t schedule_count () const override
 Returns the number of schedule associated with the profile. More...
 

Protected Attributes

std::map< std::string, std::vector< Tools::IScheduleCPtr > > schedules_
 Map target name to target's schedules. More...
 
std::vector< Tools::IScheduleCPtrdefault_schedule_
 Schedule for default target. More...
 

Detailed Description

Concrete implementation of a simple access control class.

Definition at line 39 of file SimpleAccessProfile.hpp.

Member Function Documentation

◆ addAccessSchedule()

void SimpleAccessProfile::addAccessSchedule ( AuthTargetPtr  target,
const Tools::IScheduleCPtr sched 
)
virtual

Adds a schedule where access to a given target is allowed.

Definition at line 55 of file SimpleAccessProfile.cpp.

◆ defaultSchedules()

const std::vector< Leosac::Tools::IScheduleCPtr > & SimpleAccessProfile::defaultSchedules ( ) const
virtual

Definition at line 71 of file SimpleAccessProfile.cpp.

◆ isAccessGranted()

bool SimpleAccessProfile::isAccessGranted ( const std::chrono::system_clock::time_point &  date,
AuthTargetPtr  target 
)
overridevirtual

Does the profile allow access to the user.

Parameters
datethe time point at which we try to get access.
targetthe door we want to open.
Note
Check for defaults permissions then door-specific permissions.

Implements Leosac::Auth::IAccessProfile.

Definition at line 27 of file SimpleAccessProfile.cpp.

◆ schedule_count()

size_t SimpleAccessProfile::schedule_count ( ) const
overridevirtual

Returns the number of schedule associated with the profile.

Implements Leosac::Auth::IAccessProfile.

Definition at line 76 of file SimpleAccessProfile.cpp.

◆ schedules()

const std::map< std::string, std::vector< Leosac::Tools::IScheduleCPtr > > & SimpleAccessProfile::schedules ( ) const
virtual

Returns the map of schedule for each target (except the default target)

Definition at line 65 of file SimpleAccessProfile.cpp.

Member Data Documentation

◆ default_schedule_

std::vector<Tools::IScheduleCPtr> Leosac::Auth::SimpleAccessProfile::default_schedule_
protected

Schedule for default target.

Definition at line 73 of file SimpleAccessProfile.hpp.

◆ schedules_

std::map<std::string, std::vector<Tools::IScheduleCPtr> > Leosac::Auth::SimpleAccessProfile::schedules_
protected

Map target name to target's schedules.

Definition at line 68 of file SimpleAccessProfile.hpp.


The documentation for this class was generated from the following files: