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

CRUD Handler for Users. More...

#include <UserCRUD.hpp>

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

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

 UserCRUD (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
 Retrieve information about a given user, or about all users. More...
 
virtual boost::optional< jsonupdate_impl (const json &req) override
 Update information about a given user. More...
 
virtual boost::optional< jsondelete_impl (const json &req) override
 

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 Users.

Definition at line 34 of file UserCRUD.hpp.

Constructor & Destructor Documentation

◆ UserCRUD()

UserCRUD::UserCRUD ( RequestContext  ctx)
private

Definition at line 36 of file UserCRUD.cpp.

Member Function Documentation

◆ create_impl()

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

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

Definition at line 47 of file UserCRUD.cpp.

◆ delete_impl()

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

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

Definition at line 141 of file UserCRUD.cpp.

◆ instanciate()

CRUDResourceHandlerUPtr UserCRUD::instanciate ( RequestContext  ctx)
static

Definition at line 41 of file UserCRUD.cpp.

◆ read_impl()

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

Retrieve information about a given user, or about all users.

Request:

  • user_id: The user_id of the user we want to fetch. Note that the special value 0 can be used to request all known users. This field is required.

Response:

  • ...

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

Definition at line 77 of file UserCRUD.cpp.

◆ required_permission()

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

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

Definition at line 147 of file UserCRUD.cpp.

◆ update_impl()

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

Update information about a given user.

Request:

  • user_id: The user_id of the user we want to update. Required.
  • attributes: A dictionnary of a user's attributes (firstname, lastname, etc...).

Accepted attributes:

  • firstname
  • lastname
  • email

Response:

  • ...

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

Definition at line 107 of file UserCRUD.cpp.


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