| @@ 297-316 (lines=20) @@ | ||
| 294 | * @param string $uuid |
|
| 295 | * @return \Illuminate\Http\RedirectResponse |
|
| 296 | */ |
|
| 297 | public function postSettingsSFTP(Request $request, $uuid) |
|
| 298 | { |
|
| 299 | $server = Models\Server::byUuid($uuid); |
|
| 300 | $this->authorize('reset-sftp', $server); |
|
| 301 | ||
| 302 | try { |
|
| 303 | $repo = new ServerRepository; |
|
| 304 | $repo->updateSFTPPassword($server->id, $request->input('sftp_pass')); |
|
| 305 | Alert::success('Successfully updated this servers SFTP password.')->flash(); |
|
| 306 | } catch (DisplayValidationException $ex) { |
|
| 307 | return redirect()->route('server.settings.sftp', $uuid)->withErrors(json_decode($ex->getMessage())); |
|
| 308 | } catch (DisplayException $ex) { |
|
| 309 | Alert::danger($ex->getMessage())->flash(); |
|
| 310 | } catch (\Exception $ex) { |
|
| 311 | Log::error($ex); |
|
| 312 | Alert::danger('An unknown error occured while attempting to update this server\'s SFTP settings.')->flash(); |
|
| 313 | } |
|
| 314 | ||
| 315 | return redirect()->route('server.settings.sftp', $uuid); |
|
| 316 | } |
|
| 317 | ||
| 318 | /** |
|
| 319 | * Handles changing the startup settings for a server. |
|
| @@ 325-344 (lines=20) @@ | ||
| 322 | * @param string $uuid |
|
| 323 | * @return \Illuminate\Http\RedirectResponse |
|
| 324 | */ |
|
| 325 | public function postSettingsStartup(Request $request, $uuid) |
|
| 326 | { |
|
| 327 | $server = Models\Server::byUuid($uuid); |
|
| 328 | $this->authorize('edit-startup', $server); |
|
| 329 | ||
| 330 | try { |
|
| 331 | $repo = new ServerRepository; |
|
| 332 | $repo->updateStartup($server->id, $request->except('_token')); |
|
| 333 | Alert::success('Server startup variables were successfully updated.')->flash(); |
|
| 334 | } catch (DisplayValidationException $ex) { |
|
| 335 | return redirect()->route('server.settings.startup', $uuid)->withErrors(json_decode($ex->getMessage())); |
|
| 336 | } catch (DisplayException $ex) { |
|
| 337 | Alert::danger($ex->getMessage())->flash(); |
|
| 338 | } catch (\Exception $ex) { |
|
| 339 | Log::error($ex); |
|
| 340 | Alert::danger('An unhandled exception occured while attemping to update startup variables for this server. Please try again.')->flash(); |
|
| 341 | } |
|
| 342 | ||
| 343 | return redirect()->route('server.settings.startup', $uuid); |
|
| 344 | } |
|
| 345 | } |
|
| 346 | ||
| @@ 88-110 (lines=23) @@ | ||
| 85 | * @param string $uuid |
|
| 86 | * @return \Illuminate\Http\RedirectResponse |
|
| 87 | */ |
|
| 88 | public function store(Request $request, $uuid) |
|
| 89 | { |
|
| 90 | $server = Models\Server::byUuid($uuid); |
|
| 91 | $this->authorize('create-task', $server); |
|
| 92 | ||
| 93 | try { |
|
| 94 | $repo = new Repositories\TaskRepository; |
|
| 95 | $repo->create($server->id, $request->except([ |
|
| 96 | '_token', |
|
| 97 | ])); |
|
| 98 | ||
| 99 | return redirect()->route('server.tasks', $uuid); |
|
| 100 | } catch (DisplayValidationException $ex) { |
|
| 101 | return redirect()->route('server.tasks.new', $uuid)->withErrors(json_decode($ex->getMessage()))->withInput(); |
|
| 102 | } catch (DisplayException $ex) { |
|
| 103 | Alert::danger($ex->getMessage())->flash(); |
|
| 104 | } catch (\Exception $ex) { |
|
| 105 | Log::error($ex); |
|
| 106 | Alert::danger('An unknown error occured while attempting to create this task.')->flash(); |
|
| 107 | } |
|
| 108 | ||
| 109 | return redirect()->route('server.tasks.new', $uuid); |
|
| 110 | } |
|
| 111 | ||
| 112 | /** |
|
| 113 | * Handle deletion of a task. |
|