Leosac
0.8.0
Open Source Access Control
|
The base class for API method handler implementation. More...
#include <MethodHandler.hpp>
Public Types | |
using | Factory = MethodHandlerUPtr(*)(RequestContext) |
Public Member Functions | |
MethodHandler (RequestContext ctx) | |
virtual | ~MethodHandler ()=default |
json | process (const ClientMessage &msg) |
The public process() method. More... | |
UserSecurityContext & | security_context () |
ExecutionContext | exec_context () |
Returns a representation of the execution context of this request. More... | |
Static Public Member Functions | |
static MethodHandlerUPtr | create (RequestContext) |
An example method that should be implemented in all subclasses. More... | |
Protected Member Functions | |
virtual std::vector< ActionActionParam > | required_permission (const json &req) const =0 |
Return a list of "Action" / "ActionParam" that must pass before the request is processed. More... | |
Protected Attributes | |
RequestContext | ctx_ |
Private Member Functions | |
virtual json | process_impl (const json &req)=0 |
The API method implementation. More... | |
The base class for API method handler implementation.
The class defines the very simple interface that may be implemented by the various API method implementation.
Each subclass should provide a static method to instanciate a handler object of the subclass type.
Definition at line 46 of file MethodHandler.hpp.
Definition at line 49 of file MethodHandler.hpp.
|
inline |
Definition at line 51 of file MethodHandler.hpp.
|
virtualdefault |
|
inlinestatic |
An example method that should be implemented in all subclasses.
Definition at line 69 of file MethodHandler.hpp.
ExecutionContext MethodHandler::exec_context | ( | ) |
Returns a representation of the execution context of this request.
This context can be passed to service.
Definition at line 52 of file MethodHandler.cpp.
json MethodHandler::process | ( | const ClientMessage & | msg | ) |
The public process()
method.
It uses Non Virtual Interface pattern and will forward the call to the process_impl()
method.
Definition at line 30 of file MethodHandler.cpp.
|
privatepure virtual |
The API method implementation.
content
key in the JSON message sent to the client. Implemented in Leosac::Module::WebSockAPI::HardwareSearch, Leosac::Module::WebSockAPI::CredentialSearch, Leosac::Module::WebSockAPI::AuditGet, Leosac::Module::WebSockAPI::AccessPointSearch, Leosac::Module::WebSockAPI::DoorSearch, Leosac::Module::WebSockAPI::GroupSearch, Leosac::Module::WebSockAPI::AccessOverview, Leosac::Module::WebSockAPI::ScheduleSearch, Leosac::Module::WebSockAPI::UserSearch, Leosac::Module::WebSockAPI::ZoneSearch, Leosac::Module::WebSockAPI::CheckUpdate, Leosac::Module::WebSockAPI::PasswordChange, Leosac::Module::WebSockAPI::LogGet, Leosac::Module::WebSockAPI::AckUpdate, Leosac::Module::WebSockAPI::CreateUpdate, Leosac::Module::WebSockAPI::UpdateGet, Leosac::Module::WebSockAPI::Restart, Leosac::Module::WebSockAPI::CancelUpdate, Leosac::Module::WebSockAPI::UpdateHistory, and Leosac::Module::WebSockAPI::PendingUpdateGet.
|
protectedpure virtual |
Return a list of "Action" / "ActionParam" that must pass before the request is processed.
Implemented in Leosac::Module::WebSockAPI::HardwareSearch, Leosac::Module::WebSockAPI::CredentialSearch, Leosac::Module::WebSockAPI::AuditGet, Leosac::Module::WebSockAPI::AccessPointSearch, Leosac::Module::WebSockAPI::DoorSearch, Leosac::Module::WebSockAPI::GroupSearch, Leosac::Module::WebSockAPI::AccessOverview, Leosac::Module::WebSockAPI::ScheduleSearch, Leosac::Module::WebSockAPI::UserSearch, Leosac::Module::WebSockAPI::ZoneSearch, Leosac::Module::WebSockAPI::CheckUpdate, Leosac::Module::WebSockAPI::PasswordChange, Leosac::Module::WebSockAPI::LogGet, Leosac::Module::WebSockAPI::AckUpdate, Leosac::Module::WebSockAPI::CreateUpdate, Leosac::Module::WebSockAPI::UpdateGet, Leosac::Module::WebSockAPI::Restart, Leosac::Module::WebSockAPI::CancelUpdate, Leosac::Module::WebSockAPI::UpdateHistory, and Leosac::Module::WebSockAPI::PendingUpdateGet.
UserSecurityContext & MethodHandler::security_context | ( | ) |
Definition at line 44 of file MethodHandler.cpp.
|
protected |
Definition at line 90 of file MethodHandler.hpp.