forked from Alex/Pterodactyl-Panel
Compare commits
5 Commits
develop
...
feature/ro
Author | SHA1 | Date | |
---|---|---|---|
|
cd3363fc99 | ||
|
5470e07141 | ||
|
65320ffcac | ||
|
731b55a74d | ||
|
26e7b1b052 |
@ -112,9 +112,15 @@ class SftpAuthenticationController extends Controller
|
||||
|
||||
// Remeber, for security purposes, only reveal the existence of the server to people that
|
||||
// have provided valid credentials, and have permissions to know about it.
|
||||
if ($server->installed !== 1 || $server->suspended) {
|
||||
if ($server->installed !== 1) {
|
||||
throw new BadRequestHttpException(
|
||||
'Server is not installed or is currently suspended.'
|
||||
'Server is not installed.'
|
||||
);
|
||||
}
|
||||
|
||||
if (! $user->root_admin && $server->suspended) {
|
||||
throw new BadRequestHttpException(
|
||||
'Server is currently suspended.'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ class AuthenticateServerAccess
|
||||
}
|
||||
}
|
||||
|
||||
if ($server->suspended && !$request->routeIs('api:client:server.resources')) {
|
||||
if (! $user->root_admin && $server->suspended && !$request->routeIs('api:client:server.resources')) {
|
||||
throw new BadRequestHttpException(
|
||||
'This server is currently suspended and the functionality requested is unavailable.'
|
||||
);
|
||||
|
@ -62,7 +62,7 @@ class AccessingValidServer
|
||||
$isApiRequest = $request->expectsJson() || $request->is(...$this->config->get('pterodactyl.json_routes', []));
|
||||
$server = $this->repository->getByUuid($attributes instanceof Server ? $attributes->uuid : $attributes);
|
||||
|
||||
if ($server->suspended) {
|
||||
if (! $user->root_admin && $server->suspended) {
|
||||
if ($isApiRequest) {
|
||||
throw new AccessDeniedHttpException('Server is suspended and cannot be accessed.');
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ export default () => {
|
||||
const name = ServerContext.useStoreState(state => state.server.data!.name);
|
||||
const limits = ServerContext.useStoreState(state => state.server.data!.limits);
|
||||
const isInstalling = ServerContext.useStoreState(state => state.server.data!.isInstalling);
|
||||
const isSuspended = ServerContext.useStoreState(state => state.server.data!.isSuspended);
|
||||
const status = ServerContext.useStoreState(state => state.status.value);
|
||||
|
||||
const connected = ServerContext.useStoreState(state => state.socket.connected);
|
||||
@ -89,8 +90,27 @@ export default () => {
|
||||
<span css={tw`text-neutral-500`}> / {disklimit}</span>
|
||||
</p>
|
||||
</TitledGreyBox>
|
||||
{!isInstalling ?
|
||||
<Can action={[ 'control.start', 'control.stop', 'control.restart' ]} matchAny>
|
||||
{
|
||||
(() => {
|
||||
if (isInstalling) {
|
||||
return <div css={tw`mt-4 rounded bg-yellow-500 p-3`}>
|
||||
<ContentContainer>
|
||||
<p css={tw`text-sm text-yellow-900`}>
|
||||
This server is currently running its installation process and most actions are
|
||||
unavailable.
|
||||
</p>
|
||||
</ContentContainer>
|
||||
</div>
|
||||
} else if (isSuspended) {
|
||||
return <div css={tw`mt-4 rounded bg-red-500 p-3`}>
|
||||
<ContentContainer>
|
||||
<p css={tw`text-sm text-red-900`}>
|
||||
This server is currently suspended and the functionality requested is unavailable.
|
||||
</p>
|
||||
</ContentContainer>
|
||||
</div>
|
||||
} else {
|
||||
return <Can action={['control.start', 'control.stop', 'control.restart']} matchAny>
|
||||
<div css={tw`shadow-md bg-neutral-700 rounded p-3 flex text-xs mt-4 justify-center`}>
|
||||
<Can action={'control.start'}>
|
||||
<Button
|
||||
@ -126,15 +146,8 @@ export default () => {
|
||||
</Can>
|
||||
</div>
|
||||
</Can>
|
||||
:
|
||||
<div css={tw`mt-4 rounded bg-yellow-500 p-3`}>
|
||||
<ContentContainer>
|
||||
<p css={tw`text-sm text-yellow-900`}>
|
||||
This server is currently running its installation process and most actions are
|
||||
unavailable.
|
||||
</p>
|
||||
</ContentContainer>
|
||||
</div>
|
||||
}
|
||||
})()
|
||||
}
|
||||
</div>
|
||||
<div css={tw`w-full md:flex-1 md:ml-4 mt-4 md:mt-0`}>
|
||||
|
Loading…
Reference in New Issue
Block a user