Fix startup variable editing to allow admin full control
This commit is contained in:
parent
a903ae313a
commit
a36f3dd875
2 changed files with 3 additions and 3 deletions
|
@ -374,7 +374,7 @@ class ServersController extends Controller
|
||||||
$server = new ServerRepository;
|
$server = new ServerRepository;
|
||||||
$server->updateStartup($id, $request->except([
|
$server->updateStartup($id, $request->except([
|
||||||
'_token'
|
'_token'
|
||||||
]));
|
]), true);
|
||||||
Alert::success('Server startup variables were successfully updated.')->flash();
|
Alert::success('Server startup variables were successfully updated.')->flash();
|
||||||
} catch (\Pterodactyl\Exceptions\DisplayException $e) {
|
} catch (\Pterodactyl\Exceptions\DisplayException $e) {
|
||||||
Alert::danger($e->getMessage())->flash();
|
Alert::danger($e->getMessage())->flash();
|
||||||
|
|
|
@ -540,7 +540,7 @@ class ServerRepository
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateStartup($id, array $data)
|
public function updateStartup($id, array $data, $admin = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
$server = Models\Server::findOrFail($id);
|
$server = Models\Server::findOrFail($id);
|
||||||
|
@ -595,7 +595,7 @@ class ServerRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
// Variable hidden and/or not user editable
|
// Variable hidden and/or not user editable
|
||||||
if ($variable->user_viewable === 0 || $variable->user_editable === 0) {
|
if (($variable->user_viewable === 0 || $variable->user_editable === 0) && !$admin) {
|
||||||
throw new DisplayException('A service option variable field (' . $variable->env_variable . ') does not exist or you do not have permission to edit it.');
|
throw new DisplayException('A service option variable field (' . $variable->env_variable . ') does not exist or you do not have permission to edit it.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue