mirror of
https://github.com/bitinflow/expose.git
synced 2026-03-14 05:55:54 +00:00
wip
This commit is contained in:
@@ -120,6 +120,10 @@ class ControlMessageController implements MessageComponentInterface
|
||||
|
||||
protected function handleTcpConnection(ConnectionInterface $connection, $data, $user = null)
|
||||
{
|
||||
if (! $this->canShareTcpPorts($connection, $data, $user)) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$connectionInfo = $this->connectionManager->storeTcpConnection($data->port, $connection);
|
||||
} catch (NoFreePortAvailable $exception) {
|
||||
@@ -233,4 +237,21 @@ class ControlMessageController implements MessageComponentInterface
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function canShareTcpPorts(ConnectionInterface $connection, $data, $user)
|
||||
{
|
||||
if (! is_null($user) && $user['can_share_tcp_ports'] === 0) {
|
||||
$connection->send(json_encode([
|
||||
'event' => 'authenticationFailed',
|
||||
'data' => [
|
||||
'message' => config('expose.admin.messages.custom_subdomain_unauthorized'),
|
||||
],
|
||||
]));
|
||||
$connection->close();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user