diff --git a/app/Http/Middleware/Api/Client/Server/AuthenticateServerAccess.php b/app/Http/Middleware/Api/Client/Server/AuthenticateServerAccess.php
index fe0ca5610..c6acb66d3 100644
--- a/app/Http/Middleware/Api/Client/Server/AuthenticateServerAccess.php
+++ b/app/Http/Middleware/Api/Client/Server/AuthenticateServerAccess.php
@@ -17,6 +17,16 @@ class AuthenticateServerAccess
*/
private $repository;
+ /**
+ * Routes that this middleware should not apply to if the user is an admin.
+ *
+ * @var string[]
+ */
+ protected $except = [
+ 'api:client:server.view',
+ 'api:client:server.ws',
+ ];
+
/**
* AuthenticateServerAccess constructor.
*
@@ -36,6 +46,8 @@ class AuthenticateServerAccess
*/
public function handle(Request $request, Closure $next)
{
+ /** @var \Pterodactyl\Models\User $user */
+ $user = $request->user();
$server = $request->route()->parameter('server');
if (! $server instanceof Server) {
@@ -45,9 +57,9 @@ class AuthenticateServerAccess
// At the very least, ensure that the user trying to make this request is the
// server owner, a subuser, or a root admin. We'll leave it up to the controllers
// to authenticate more detailed permissions if needed.
- if ($request->user()->id !== $server->owner_id && ! $request->user()->root_admin) {
+ if ($user->id !== $server->owner_id && ! $user->root_admin) {
// Check for subuser status.
- if (! $server->subusers->contains('user_id', $request->user()->id)) {
+ if (! $server->subusers->contains('user_id', $user->id)) {
throw new NotFoundHttpException(trans('exceptions.api.resource_not_found'));
}
}
@@ -57,7 +69,11 @@ class AuthenticateServerAccess
}
if (! $server->isInstalled()) {
- throw new ConflictHttpException('Server has not completed the installation process.');
+ // Throw an exception for all server routes; however if the user is an admin and requesting the
+ // server details, don't throw the exception for them.
+ if (! $user->root_admin || ($user->root_admin && ! $request->routeIs($this->except))) {
+ throw new ConflictHttpException('Server has not completed the installation process.');
+ }
}
$request->attributes->set('server', $server);
diff --git a/resources/scripts/components/server/ServerConsole.tsx b/resources/scripts/components/server/ServerConsole.tsx
index 0e2883cc5..5f5addf56 100644
--- a/resources/scripts/components/server/ServerConsole.tsx
+++ b/resources/scripts/components/server/ServerConsole.tsx
@@ -12,6 +12,7 @@ import SuspenseSpinner from '@/components/elements/SuspenseSpinner';
import TitledGreyBox from '@/components/elements/TitledGreyBox';
import Can from '@/components/elements/Can';
import PageContentBlock from '@/components/elements/PageContentBlock';
+import ContentContainer from '@/components/elements/ContentContainer';
type PowerAction = 'start' | 'stop' | 'restart' | 'kill';
@@ -123,36 +124,47 @@ export default () => {
/ {server.limits.disk} MB