diff --git a/core/websockets/resources/classes/subscriber.php b/core/websockets/resources/classes/subscriber.php index ed705eb6a..2005c2b54 100644 --- a/core/websockets/resources/classes/subscriber.php +++ b/core/websockets/resources/classes/subscriber.php @@ -527,6 +527,12 @@ class subscriber { $this->domain_name = $array['domain']['name'] ?? ''; $this->domain_uuid = $array['domain']['uuid'] ?? ''; + // Store the permissions + $this->permissions = $array['user']['permissions'] ?? []; + + // Remove the permissions from the user array because this class handles them seperately + unset($array['user']['permissions']); + // Add the user information when available $this->user = $array['user'] ?? []; @@ -536,9 +542,6 @@ class subscriber { $this->subscribe($service); } - // Store the permissions - $this->permissions = $array['permissions'] ?? []; - // Check for service if (isset($array['service'])) { // @@ -804,12 +807,6 @@ class subscriber { */ public static function save_token(array $token, array $services, int $time_limit_in_minutes = 0) { - // - // Put the domain_name, permissions, and token in local storage so we can use all the information - // to authenticate an incoming connection from the websocket service. - // - $array['permissions'] = $_SESSION['permissions'] ?? ''; - // // Store the currently logged in user when available // diff --git a/core/websockets/resources/classes/subscriber_missing_permission_exception.php b/core/websockets/resources/classes/subscriber_missing_permission_exception.php index 2a8929f7f..b8fbd431a 100644 --- a/core/websockets/resources/classes/subscriber_missing_permission_exception.php +++ b/core/websockets/resources/classes/subscriber_missing_permission_exception.php @@ -32,7 +32,7 @@ * @author Tim Fry */ class subscriber_missing_permission_exception extends \subscriber_exception { - public function __construct($subscriber_id, string $message = "Subscriber is missing required permission", int $code = 0, ?\Throwable $previous = null): \Exception { + public function __construct($subscriber_id, string $message = "Subscriber is missing required permission", int $code = 0, ?\Throwable $previous = null) { return parent::__construct($subscriber_id, $message, $code, $previous); } } diff --git a/core/websockets/resources/classes/websocket_client.php b/core/websockets/resources/classes/websocket_client.php index 77ccadd1f..0a466ca53 100644 --- a/core/websockets/resources/classes/websocket_client.php +++ b/core/websockets/resources/classes/websocket_client.php @@ -311,10 +311,10 @@ class websocket_client { // Respond with PONG using same payload $this->send_control_frame(0xA, $payload); echo "[INFO] Received PING, sent PONG\n"; - continue; // Skip returning PING + break 2; case 0xA: // PONG echo "[INFO] Received PONG\n"; - continue; // Skip returning PONG + break 2; case 0x1: // TEXT frame case 0x0: // Continuation frame $payload_data .= $payload;