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

CRUD Handler for Groups. More...

#include <GroupCRUD.hpp>

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

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

 GroupCRUD (RequestContext ctx)
 
virtual std::vector< ActionActionParamrequired_permission (Verb verb, const json &req) const override
 
virtual boost::optional< jsoncreate_impl (const json &req) override
 Create a new group. More...
 
virtual boost::optional< jsonread_impl (const json &req) override
 Retrieve information about a group. More...
 
virtual boost::optional< jsonupdate_impl (const json &req) override
 Update information about a group. More...
 
virtual boost::optional< jsondelete_impl (const json &req) override
 Delete a group. More...
 
void validate_and_unique (Auth::GroupPtr grp)
 Make sure the group's attribute is valid (by calling GroupValidator) and that the name is unique. 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 Groups.

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

Definition at line 36 of file GroupCRUD.hpp.

Constructor & Destructor Documentation

◆ GroupCRUD()

GroupCRUD::GroupCRUD ( RequestContext  ctx)
private

Definition at line 37 of file GroupCRUD.cpp.

Member Function Documentation

◆ create_impl()

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

Create a new group.

Request:

  • attributes: A dictionnary of a groups' attributes.

Accepted attributes:

  • name
  • description

Response:

  • ...

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

Definition at line 48 of file GroupCRUD.cpp.

◆ delete_impl()

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

Delete a group.

Request:

  • group_id: The group_id of the group we want to delete.

Response:

  • ...

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

Definition at line 145 of file GroupCRUD.cpp.

◆ instanciate()

CRUDResourceHandlerUPtr GroupCRUD::instanciate ( RequestContext  ctx)
static

Definition at line 42 of file GroupCRUD.cpp.

◆ read_impl()

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

Retrieve information about a group.

Request:

  • group_id: Group we want information about. Required. A group_id of 0 means returns all known groups.

For a non-administrator user, it will returns the group the user is a member of.

Response:

  • ...

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

Definition at line 85 of file GroupCRUD.cpp.

◆ required_permission()

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

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

Definition at line 182 of file GroupCRUD.cpp.

◆ update_impl()

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

Update information about a group.

Request:

  • group_id: The group_id of the group we want to update.
  • attributes: A dictionnary of a groups' attributes.

Accepted attributes:

  • name
  • description

Response:

  • ...

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

Definition at line 120 of file GroupCRUD.cpp.

◆ validate_and_unique()

void GroupCRUD::validate_and_unique ( Auth::GroupPtr  grp)
private

Make sure the group's attribute is valid (by calling GroupValidator) and that the name is unique.

Definition at line 164 of file GroupCRUD.cpp.


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