diff --git a/CHANGELOG.md b/CHANGELOG.md index c8459c46f..0876656bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines. ### Changed * Attempting to upload a folder via the web file manager will now display a warning telling the user to use SFTP. * Changing your account password will now log out all other sessions that currently exist for that user. +* Subusers with no permissions selected can be created. ## v0.7.7 (Derelict Dermodactylus) ### Fixed diff --git a/app/Http/Controllers/Server/SubuserController.php b/app/Http/Controllers/Server/SubuserController.php index b507bbb45..008cfeaa5 100644 --- a/app/Http/Controllers/Server/SubuserController.php +++ b/app/Http/Controllers/Server/SubuserController.php @@ -157,7 +157,6 @@ class SubuserController extends Controller * @return \Illuminate\Http\RedirectResponse * * @throws \Exception - * @throws \Illuminate\Auth\Access\AuthorizationException * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException * @throws \Pterodactyl\Exceptions\Service\Subuser\ServerSubuserExistsException @@ -171,7 +170,7 @@ class SubuserController extends Controller $this->alert->success(trans('server.users.user_assigned'))->flash(); return redirect()->route('server.subusers.view', [ - 'uuid' => $server->uuid, + 'uuid' => $server->uuidShort, 'id' => $subuser->hashid, ]); } diff --git a/app/Http/Requests/Server/Subuser/SubuserStoreFormRequest.php b/app/Http/Requests/Server/Subuser/SubuserStoreFormRequest.php index 0ada01675..9b7c6ce4d 100644 --- a/app/Http/Requests/Server/Subuser/SubuserStoreFormRequest.php +++ b/app/Http/Requests/Server/Subuser/SubuserStoreFormRequest.php @@ -25,7 +25,7 @@ class SubuserStoreFormRequest extends ServerFormRequest { return [ 'email' => 'required|email', - 'permissions' => 'present|array', + 'permissions' => 'sometimes|array', ]; } } diff --git a/app/Services/Subusers/PermissionCreationService.php b/app/Services/Subusers/PermissionCreationService.php index 0173e8015..074048f0a 100644 --- a/app/Services/Subusers/PermissionCreationService.php +++ b/app/Services/Subusers/PermissionCreationService.php @@ -56,6 +56,8 @@ class PermissionCreationService } } - $this->repository->withoutFreshModel()->insert($insertPermissions); + if (! empty($insertPermissions)) { + $this->repository->withoutFreshModel()->insert($insertPermissions); + } } } diff --git a/tests/Unit/Http/Controllers/Server/SubuserControllerTest.php b/tests/Unit/Http/Controllers/Server/SubuserControllerTest.php index f9b550cfc..ab3088198 100644 --- a/tests/Unit/Http/Controllers/Server/SubuserControllerTest.php +++ b/tests/Unit/Http/Controllers/Server/SubuserControllerTest.php @@ -182,7 +182,7 @@ class SubuserControllerTest extends ControllerTestCase $response = $controller->store($this->request); $this->assertIsRedirectResponse($response); $this->assertRedirectRouteEquals('server.subusers.view', $response, [ - 'uuid' => $server->uuid, + 'uuid' => $server->uuidShort, 'id' => $subuser->hashid, ]); }