Compare commits

...

5 Commits

Author SHA1 Message Date
Oreo Oreoniv
cd3363fc99
Hiding buttons and adding a message 2020-09-22 13:37:40 +03:00
Oreo Oreoniv
5470e07141
Oops 2020-09-22 12:03:19 +03:00
Oreo Oreoniv
65320ffcac
Fixed mistake 2020-09-22 11:56:24 +03:00
Oreo Oreoniv
731b55a74d
SFTP should be to allow 2020-09-22 11:50:39 +03:00
Oreo Oreoniv
26e7b1b052
Root admin allowed to use all functions even server is suspended, close #1654 2020-09-22 11:42:15 +03:00
4 changed files with 68 additions and 49 deletions

View File

@ -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.'
);
}

View File

@ -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.'
);

View File

@ -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.');
}

View File

@ -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`}>