Set admin privileges on websocket:

When the websocket connection is established, any configured administrative
privileges are applied to resource limits.
This commit is contained in:
Vinnie Falco
2015-10-02 19:32:29 -07:00
committed by Vinnie Falco
parent 84c0ae1c6d
commit 8b8334af86
4 changed files with 20 additions and 16 deletions

View File

@@ -66,4 +66,15 @@ requestRole (Role const& required, HTTP::Port const& port,
return role;
}
Resource::Consumer
requestInboundEndpoint (Resource::Manager& manager,
beast::IP::Endpoint const& remoteAddress,
HTTP::Port const& port)
{
if (requestRole (Role::GUEST, port, Json::Value(), remoteAddress) ==
Role::ADMIN)
return manager.newAdminEndpoint (to_string (remoteAddress));
return manager.newInboundEndpoint(remoteAddress);
}
}