More middleware tests
This commit is contained in:
parent
d844a36167
commit
7b3393aff9
11 changed files with 547 additions and 56 deletions
|
@ -12,7 +12,7 @@ class DatabaseBelongsToServer
|
|||
/**
|
||||
* @var \Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface
|
||||
*/
|
||||
protected $repository;
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* DatabaseAccess constructor.
|
||||
|
@ -40,7 +40,7 @@ class DatabaseBelongsToServer
|
|||
$server = $request->attributes->get('server');
|
||||
|
||||
$database = $this->repository->find($request->input('database'));
|
||||
if ($database->server_id !== $server->id) {
|
||||
if (is_null($database) || $database->server_id !== $server->id) {
|
||||
throw new NotFoundHttpException;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ class SubuserBelongsToServer
|
|||
|
||||
$hash = $request->route()->parameter('subuser', 0);
|
||||
$subuser = $this->repository->find($this->hashids->decodeFirst($hash, 0));
|
||||
if (! $subuser || $subuser->server_id !== $server->id) {
|
||||
if (is_null($subuser) || $subuser->server_id !== $server->id) {
|
||||
throw new NotFoundHttpException;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue