Leosac
0.8.0
Open Source Access Control
CRUDHandler.hpp
Go to the documentation of this file.
1
/*
2
Copyright (C) 2014-2017 Leosac
3
4
This file is part of Leosac.
5
6
Leosac is free software: you can redistribute it and/or modify
7
it under the terms of the GNU Affero General Public License as published by
8
the Free Software Foundation, either version 3 of the License, or
9
(at your option) any later version.
10
11
Leosac is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU Affero General Public License for more details.
15
16
You should have received a copy of the GNU Affero General Public License
17
along with this program. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#pragma once
21
22
#include "
modules/websock-api/api/CRUDResourceHandler.hpp
"
23
24
namespace
Leosac
25
{
26
namespace
Module
27
{
28
namespace
LedBuzzer
29
{
30
31
struct
CRUDHandlerHelper
32
{
36
static
constexpr
const
char
buzzer_object_id_key
[] =
"buzzer_id"
;
40
static
constexpr
const
char
led_object_id_key
[] =
"led_id"
;
41
};
42
53
template
<
typename
ObjectT, const
char
*ObjectIdKey,
typename
SerializerT>
54
class
CRUDHandler
:
public
WebSockAPI::CRUDResourceHandler
55
{
56
public
:
57
explicit
CRUDHandler
(
const
WebSockAPI::RequestContext
&ctx);
58
59
static
WebSockAPI::CRUDResourceHandlerUPtr
60
instanciate
(
WebSockAPI::RequestContext
);
61
62
std::vector<ActionActionParam>
63
required_permission
(
Verb
verb,
const
WebSockAPI::json
&req)
const override
;
64
65
boost::optional<WebSockAPI::json>
66
create_impl
(
const
WebSockAPI::json
&req)
override
;
67
68
boost::optional<WebSockAPI::json>
69
read_impl
(
const
WebSockAPI::json
&req)
override
;
70
71
boost::optional<WebSockAPI::json>
72
update_impl
(
const
WebSockAPI::json
&req)
override
;
73
74
boost::optional<WebSockAPI::json>
75
delete_impl
(
const
WebSockAPI::json
&req)
override
;
76
};
77
}
78
}
79
}
Leosac::Module::LedBuzzer::CRUDHandler::update_impl
boost::optional< WebSockAPI::json > update_impl(const WebSockAPI::json &req) override
Definition:
CRUDHandler.cpp:170
Leosac::Module::LedBuzzer::CRUDHandler::required_permission
std::vector< ActionActionParam > required_permission(Verb verb, const WebSockAPI::json &req) const override
Definition:
CRUDHandler.cpp:42
CRUDResourceHandler.hpp
Leosac::Module::LedBuzzer::CRUDHandlerHelper::led_object_id_key
static constexpr const char led_object_id_key[]
How to retrieve the object's id when instanciate the crud handler for led.
Definition:
CRUDHandler.hpp:40
Leosac::Module::WebSockAPI::CRUDResourceHandlerUPtr
std::unique_ptr< CRUDResourceHandler > CRUDResourceHandlerUPtr
Definition:
WebSockFwd.hpp:39
Leosac::Module::WebSockAPI::CRUDResourceHandler
Base CRUD handler for use within the websocket module.
Definition:
CRUDResourceHandler.hpp:84
Leosac::Module::LedBuzzer::CRUDHandler::create_impl
boost::optional< WebSockAPI::json > create_impl(const WebSockAPI::json &req) override
Definition:
CRUDHandler.cpp:82
Leosac::Module::LedBuzzer::CRUDHandler::delete_impl
boost::optional< WebSockAPI::json > delete_impl(const WebSockAPI::json &req) override
Definition:
CRUDHandler.cpp:189
Leosac::Module::LedBuzzer::CRUDHandler
CRUD handler for Buzzer and LED.
Definition:
CRUDHandler.hpp:54
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition:
APIStatusCode.hpp:22
Leosac::Module::LedBuzzer::CRUDHandlerHelper::buzzer_object_id_key
static constexpr const char buzzer_object_id_key[]
How to retrieve the object's id when instanciate the crud handler for buzzer.
Definition:
CRUDHandler.hpp:36
Leosac::Module::WebSockAPI::json
nlohmann::json json
Definition:
AccessOverview.hpp:30
Leosac::Module::LedBuzzer::CRUDHandler::CRUDHandler
CRUDHandler(const WebSockAPI::RequestContext &ctx)
Definition:
CRUDHandler.cpp:203
Leosac::Module::WebSockAPI::RequestContext
Holds valuable pointer to provide context to a request.
Definition:
RequestContext.hpp:36
Leosac::Module::LedBuzzer::CRUDHandler::read_impl
boost::optional< WebSockAPI::json > read_impl(const WebSockAPI::json &req) override
Definition:
CRUDHandler.cpp:131
Leosac::Module::LedBuzzer::CRUDHandlerHelper
Definition:
CRUDHandler.hpp:31
Leosac::Module::LedBuzzer::CRUDHandler::instanciate
static WebSockAPI::CRUDResourceHandlerUPtr instanciate(WebSockAPI::RequestContext)
Definition:
CRUDHandler.cpp:214
Leosac::Module::WebSockAPI::ICRUDResourceHandler::Verb
Verb
Definition:
CRUDResourceHandler.hpp:43
src
modules
led-buzzer
ws
CRUDHandler.hpp
Generated on Tue Mar 22 2022 10:48:24 for Leosac by
1.8.17