Re: [Cppcms-users] json_rpc and json questions
Brought to you by:
artyom-beilis
From: Daniel V. <chi...@gm...> - 2011-05-19 17:08:40
|
On Thu, 2011-05-19 at 00:07 -0700, Artyom Beilis wrote: > > This is why it is virtual. You want pre/post-actions? > > void main(std::string param) > { > // some pre-action > cppcms::rpc::json_rpc_server::main(param); > // some post-actions > } > > The privilege validations depends on session() object (user and his rights) and method name. Then: void main(std::string param) { if( check_privileges(context()) ) { cppcms::rpc::json_rpc_server::main(param); } else { // not authorized } } So if I do just that, the request parsing is made twice. One for obtain method name for check_privileges and another into json_rpc_server::main() function. I guess there are no other solution in actual design. Is it true? One solution is give to the user of json_rpc_server class the possibility to add pre action after parsing json request but before dispatching. Thanks. |