Leosac  0.8.0
Open Source Access Control
Leosac::Module::WebSockAPI::DoorCRUD Class Reference

CRUD Handler for Doors. More...

#include <DoorCRUD.hpp>

+ Inheritance diagram for Leosac::Module::WebSockAPI::DoorCRUD:
+ Collaboration diagram for Leosac::Module::WebSockAPI::DoorCRUD:

Static Public Member Functions

static CRUDResourceHandlerUPtr instanciate (RequestContext)
 
- Static Public Member Functions inherited from Leosac::Module::WebSockAPI::CRUDResourceHandler
static CRUDResourceHandlerUPtr instanciate (RequestContext)
 

Private Member Functions

 DoorCRUD (RequestContext ctx)
 
virtual std::vector< ActionActionParamrequired_permission (Verb verb, const json &req) const override
 
virtual boost::optional< jsoncreate_impl (const json &req) override
 
virtual boost::optional< jsonread_impl (const json &req) override
 
virtual boost::optional< jsonupdate_impl (const json &req) override
 
virtual boost::optional< jsondelete_impl (const json &req) override
 
void enforce_ap_not_already_referenced (Auth::AccessPointId apid)
 Make sure that the AccessPoint with id apid is not already referenced by a door. More...
 

Additional Inherited Members

- Public Types inherited from Leosac::Module::WebSockAPI::CRUDResourceHandler
using Factory = CRUDResourceHandlerUPtr(*)(RequestContext)
 
- Public Types inherited from Leosac::Module::WebSockAPI::ICRUDResourceHandler
enum  Verb { Verb::CREATE, Verb::READ, Verb::UPDATE, Verb::DELETE }
 
- Public Member Functions inherited from Leosac::Module::WebSockAPI::ICRUDResourceHandler
boost::optional< jsonprocess (const ClientMessage &msg)
 
- Protected Types inherited from Leosac::Module::WebSockAPI::ICRUDResourceHandler
using ActionActionParam = std::pair< SecurityContext::Action, SecurityContext::ActionParam >
 A pair of Action and a generic ActionParam union. More...
 
- Protected Member Functions inherited from Leosac::Module::WebSockAPI::CRUDResourceHandler
 CRUDResourceHandler (RequestContext ctx)
 
virtual UserSecurityContextsecurity_context () const override
 Helper function that returns the security context. More...
 
- Protected Attributes inherited from Leosac::Module::WebSockAPI::CRUDResourceHandler
RequestContext ctx_
 

Detailed Description

CRUD Handler for Doors.

See also
See the *_impl() method for each requests parameters/response.

Definition at line 36 of file DoorCRUD.hpp.

Constructor & Destructor Documentation

◆ DoorCRUD()

DoorCRUD::DoorCRUD ( RequestContext  ctx)
private

Definition at line 39 of file DoorCRUD.cpp.

Member Function Documentation

◆ create_impl()

boost::optional< json > DoorCRUD::create_impl ( const json req)
overrideprivatevirtual

Implements Leosac::Module::WebSockAPI::ICRUDResourceHandler.

Definition at line 50 of file DoorCRUD.cpp.

◆ delete_impl()

boost::optional< json > DoorCRUD::delete_impl ( const json req)
overrideprivatevirtual

Implements Leosac::Module::WebSockAPI::ICRUDResourceHandler.

Definition at line 140 of file DoorCRUD.cpp.

◆ enforce_ap_not_already_referenced()

void DoorCRUD::enforce_ap_not_already_referenced ( Auth::AccessPointId  apid)
private

Make sure that the AccessPoint with id apid is not already referenced by a door.

If it is, we'll throw an exception to notify the user of the error rather than rely on the database constraint.

Definition at line 193 of file DoorCRUD.cpp.

◆ instanciate()

CRUDResourceHandlerUPtr DoorCRUD::instanciate ( RequestContext  ctx)
static

Definition at line 44 of file DoorCRUD.cpp.

◆ read_impl()

boost::optional< json > DoorCRUD::read_impl ( const json req)
overrideprivatevirtual

Implements Leosac::Module::WebSockAPI::ICRUDResourceHandler.

Definition at line 75 of file DoorCRUD.cpp.

◆ required_permission()

std::vector< CRUDResourceHandler::ActionActionParam > DoorCRUD::required_permission ( CRUDResourceHandler::Verb  verb,
const json req 
) const
overrideprivatevirtual

Implements Leosac::Module::WebSockAPI::ICRUDResourceHandler.

Definition at line 163 of file DoorCRUD.cpp.

◆ update_impl()

boost::optional< json > DoorCRUD::update_impl ( const json req)
overrideprivatevirtual

Implements Leosac::Module::WebSockAPI::ICRUDResourceHandler.

Definition at line 111 of file DoorCRUD.cpp.


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