|
morph 0.1.0
Asynchronous bridge between GUI thread and business models
|
The UI service: answers ui-hello, ui-catalog and ui-fetch from one ServedBundle, and ui-evaluate through the server's ActionDispatcher, as an envelope service of a RemoteServer (ServerConfig::services). More...
#include <service.hpp>
Public Member Functions | |
| UiService (std::shared_ptr< ServedBundle const > bundle, ::morph::model::detail::ActionDispatcher &dispatcher=::morph::model::detail::defaultDispatcher(), std::shared_ptr< IFileStore > files=nullptr) | |
Serves bundle, and evaluates through dispatcher. | |
| bool | serves (std::string_view kind) const override |
Whether kind is one of the service's kinds. | |
| std::string | handle (::morph::wire::Envelope const &request, ::morph::session::IAuthorizer const &authorizer) override |
| Answers one request with no connection behind it: a ui-hello offer of events is accepted in the reply, and recorded nowhere. | |
| std::string | handle (::morph::wire::Envelope const &request, ::morph::session::IAuthorizer const &authorizer, ::morph::backend::ConnectionFacts &facts) override |
| Answers one request; a ui-hello that offers events and is answered ok sets facts.events. | |
| Public Member Functions inherited from morph::backend::IEnvelopeService | |
| IEnvelopeService (const IEnvelopeService &)=delete | |
| IEnvelopeService & | operator= (const IEnvelopeService &)=delete |
| IEnvelopeService (IEnvelopeService &&)=delete | |
| IEnvelopeService & | operator= (IEnvelopeService &&)=delete |
The UI service: answers ui-hello, ui-catalog and ui-fetch from one ServedBundle, and ui-evaluate through the server's ActionDispatcher, as an envelope service of a RemoteServer (ServerConfig::services).
Every request is authorised (docs/spec/ui/service.md, "Authorisation"):
| Kind | Gate |
|---|---|
| ui-hello | authorize(session, "ui", "hello") |
| ui-catalog | authorize(session, "ui", "catalog") |
| ui-fetch of the manifest or a public file | the ui-hello gate |
| ui-fetch of any other file | authorize(session, "ui", "fetch"); for a screen, also the catalog's rule |
| ui-evaluate | authorize(session, modelType, actionType): as the action it evaluates |
A refusal is err "unauthorized". A request body that is too large, malformed or carries a must-understand key is refused with the parser's reason.
Definition at line 783 of file service.hpp.
|
inlineexplicit |
Serves bundle, and evaluates through dispatcher.
| bundle | The bundle; shared, never changed. |
| dispatcher | The dispatcher ui-evaluate reads the actions from: the server's own. Borrowed: it must outlive the service. |
| std::invalid_argument | if bundle is null. |
| files | The file side channel's store; nullptr serves no ui-file. |
Definition at line 791 of file service.hpp.
|
inlinenodiscardoverridevirtual |
Whether kind is one of the service's kinds.
| kind | The envelope kind. |
Implements morph::backend::IEnvelopeService.
Definition at line 804 of file service.hpp.
|
inlinenodiscardoverridevirtual |
Answers one request with no connection behind it: a ui-hello offer of events is accepted in the reply, and recorded nowhere.
| request | The envelope, its principal verified. |
| authorizer | The server's authoriser. |
Implements morph::backend::IEnvelopeService.
Definition at line 814 of file service.hpp.
|
inlinenodiscardoverridevirtual |
Answers one request; a ui-hello that offers events and is answered ok sets facts.events.
A hello that does not offer them leaves the facts as they are, so a later hello on the same connection, such as a development reload's poll, does not withdraw what the first negotiated.
| request | The envelope, its principal verified. |
| authorizer | The server's authoriser. |
| facts | The facts of the connection the request arrived on. |
Reimplemented from morph::backend::IEnvelopeService.
Definition at line 828 of file service.hpp.