28 #include "core/auth/AccessPoint_odb.h" 55 auto controller_module =
56 req.at(
"attributes").at(
"controller-module").get<std::string>();
57 auto ap_backend_ptr = service_ptr->
get_backend(controller_module);
65 "Cannot find an AccessPointBackend corresponding to controller-module " 66 << controller_module));
75 using Result = odb::result<Auth::AccessPoint>;
77 odb::transaction t(db->begin());
85 auto ap =
ctx_.
dbsrv->find_access_point_by_id(ap_id,
92 rep[
"data"] = json::array();
96 for (
const auto &ap : result)
99 if (
ctx_.
session->security_context().check_permission(
102 rep[
"data"].push_back(
121 auto ap_backend_ptr = service_ptr->
get_backend(ap->controller_module());
125 "Cannot find an AccessPointBackend corresponding to controller-module " 126 << ap->controller_module()));
139 auto ap_backend_ptr = service_ptr->
get_backend(ap->controller_module());
144 "Cannot find an AccessPointBackend corresponding to controller-module " 145 << ap->controller_module()));
148 std::vector<CRUDResourceHandler::ActionActionParam>
150 const json &req)
const 152 std::vector<CRUDResourceHandler::ActionActionParam> ret;
158 catch (json::out_of_range &e)
static CRUDResourceHandlerUPtr instanciate(RequestContext)
virtual boost::optional< json > create_impl(const json &req) override
unsigned long AccessPointId
This is the header file for a generated source file, GitSHA1.cpp.
Auth::AccessPointId ap_id
AccessPointCRUD(RequestContext ctx)
virtual UserSecurityContext & security_context() const override
Helper function that returns the security context.
Audit::IAuditEntryPtr audit
The initial audit trail for the request.
ServiceRegistry & get_service_registry()
A function to retrieve the ServiceRegistry from pretty much anywhere.
std::unique_ptr< CRUDResourceHandler > CRUDResourceHandlerUPtr
virtual boost::optional< json > update_impl(const json &req) override
AccessPointBackend * get_backend(const std::string &controller_module)
Get the AccessPointBackend that supports the given controller_module.
This service lets various AccessPoint backend register and provide implementation to use by the Acces...
All modules that provides features to Leosac shall be in this namespace.
virtual std::vector< ActionActionParam > required_permission(Verb verb, const json &req) const override
virtual json create(SecurityContext &sec_ctx, Audit::IAuditEntryPtr, const json &req)=0
virtual boost::optional< json > delete_impl(const json &req) override
Base CRUD handler for use within the websocket module.
std::shared_ptr< ServiceInterface > get_service() const
Retrieve the service instance implementing the ServiceInterface, or nullptr if no such service was re...
virtual boost::optional< json > read_impl(const json &req) override
#define BUILD_STR(param)
Internal macro.
A base class for Leosac specific exception.
odb::result< Tools::LogEntry > Result
Holds valuable pointer to provide context to a request.
std::shared_ptr< odb::database > DBPtr