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->updateStartup($id, $request->except([
|
||||
'_token'
|
||||
]));
|
||||
]), true);
|
||||
Alert::success('Server startup variables were successfully updated.')->flash();
|
||||
} catch (\Pterodactyl\Exceptions\DisplayException $e) {
|
||||
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);
|
||||
|
@ -595,7 +595,7 @@ class ServerRepository
|
|||
}
|
||||
|
||||
// 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.');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue