Skip to content

Commit a36f3dd

Browse files
committed
Fix startup variable editing to allow admin full control
1 parent a903ae3 commit a36f3dd

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

app/Http/Controllers/Admin/ServersController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ public function postUpdateServerStartup(Request $request, $id)
374374
$server = new ServerRepository;
375375
$server->updateStartup($id, $request->except([
376376
'_token'
377-
]));
377+
]), true);
378378
Alert::success('Server startup variables were successfully updated.')->flash();
379379
} catch (\Pterodactyl\Exceptions\DisplayException $e) {
380380
Alert::danger($e->getMessage())->flash();

app/Repositories/ServerRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ public function changeBuild($id, array $data)
540540

541541
}
542542

543-
public function updateStartup($id, array $data)
543+
public function updateStartup($id, array $data, $admin = false)
544544
{
545545

546546
$server = Models\Server::findOrFail($id);
@@ -595,7 +595,7 @@ public function updateStartup($id, array $data)
595595
}
596596

597597
// Variable hidden and/or not user editable
598-
if ($variable->user_viewable === 0 || $variable->user_editable === 0) {
598+
if (($variable->user_viewable === 0 || $variable->user_editable === 0) && !$admin) {
599599
throw new DisplayException('A service option variable field (' . $variable->env_variable . ') does not exist or you do not have permission to edit it.');
600600
}
601601

0 commit comments

Comments
 (0)