Add another sanity check for websocket permissions
This commit is contained in:
parent
9bffa6a94c
commit
75e0a862e7
1 changed files with 13 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
|||
namespace Pterodactyl\Tests\Integration\Api\Client\Server;
|
||||
|
||||
use Carbon\CarbonImmutable;
|
||||
use Pterodactyl\Models\User;
|
||||
use Illuminate\Http\Response;
|
||||
use Lcobucci\JWT\Configuration;
|
||||
use Pterodactyl\Models\Permission;
|
||||
|
@ -27,6 +28,18 @@ class WebsocketControllerTest extends ClientApiIntegrationTestCase
|
|||
->assertJsonPath('errors.0.detail', 'You do not have permission to connect to this server\'s websocket.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirm users cannot access the websocket for another user's server.
|
||||
*/
|
||||
public function testUserWithoutPermissionForServerReceivesError()
|
||||
{
|
||||
[,$server] = $this->generateTestAccount([Permission::ACTION_WEBSOCKET_CONNECT]);
|
||||
[$user,] = $this->generateTestAccount([Permission::ACTION_WEBSOCKET_CONNECT]);
|
||||
|
||||
$this->actingAs($user)->getJson("/api/client/servers/{$server->uuid}/websocket")
|
||||
->assertStatus(Response::HTTP_NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the expected permissions are returned for the server owner and that the JWT is
|
||||
* configured correctly.
|
||||
|
|
Loading…
Reference in a new issue