Leosac  0.7.0
OpenSourceAccessControl
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 
23 
24 namespace Leosac
25 {
26 namespace Module
27 {
28 namespace LedBuzzer
29 {
30 
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>
55 {
56  public:
57  explicit CRUDHandler(const WebSockAPI::RequestContext &ctx);
58 
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 }
CRUD handler for Buzzer and LED.
Definition: CRUDHandler.hpp:54
This is the header file for a generated source file, GitSHA1.cpp.
std::unique_ptr< CRUDResourceHandler > CRUDResourceHandlerUPtr
Definition: WebSockFwd.hpp:39
Base CRUD handler for use within the websocket module.
static constexpr const char buzzer_object_id_key[]
How to retrieve the object&#39;s id when instanciate the crud handler for buzzer.
Definition: CRUDHandler.hpp:36
Holds valuable pointer to provide context to a request.
static constexpr const char led_object_id_key[]
How to retrieve the object&#39;s id when instanciate the crud handler for led.
Definition: CRUDHandler.hpp:40