Allow creating subuser with no permissions

This commit is contained in:
Dane Everitt 2018-06-30 18:25:46 -07:00
parent 96699b192e
commit 304d947536
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
5 changed files with 7 additions and 5 deletions

View file

@ -17,6 +17,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
### Changed ### Changed
* Attempting to upload a folder via the web file manager will now display a warning telling the user to use SFTP. * 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. * 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) ## v0.7.7 (Derelict Dermodactylus)
### Fixed ### Fixed

View file

@ -157,7 +157,6 @@ class SubuserController extends Controller
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
* *
* @throws \Exception * @throws \Exception
* @throws \Illuminate\Auth\Access\AuthorizationException
* @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
* @throws \Pterodactyl\Exceptions\Service\Subuser\ServerSubuserExistsException * @throws \Pterodactyl\Exceptions\Service\Subuser\ServerSubuserExistsException
@ -171,7 +170,7 @@ class SubuserController extends Controller
$this->alert->success(trans('server.users.user_assigned'))->flash(); $this->alert->success(trans('server.users.user_assigned'))->flash();
return redirect()->route('server.subusers.view', [ return redirect()->route('server.subusers.view', [
'uuid' => $server->uuid, 'uuid' => $server->uuidShort,
'id' => $subuser->hashid, 'id' => $subuser->hashid,
]); ]);
} }

View file

@ -25,7 +25,7 @@ class SubuserStoreFormRequest extends ServerFormRequest
{ {
return [ return [
'email' => 'required|email', 'email' => 'required|email',
'permissions' => 'present|array', 'permissions' => 'sometimes|array',
]; ];
} }
} }

View file

@ -56,6 +56,8 @@ class PermissionCreationService
} }
} }
$this->repository->withoutFreshModel()->insert($insertPermissions); if (! empty($insertPermissions)) {
$this->repository->withoutFreshModel()->insert($insertPermissions);
}
} }
} }

View file

@ -182,7 +182,7 @@ class SubuserControllerTest extends ControllerTestCase
$response = $controller->store($this->request); $response = $controller->store($this->request);
$this->assertIsRedirectResponse($response); $this->assertIsRedirectResponse($response);
$this->assertRedirectRouteEquals('server.subusers.view', $response, [ $this->assertRedirectRouteEquals('server.subusers.view', $response, [
'uuid' => $server->uuid, 'uuid' => $server->uuidShort,
'id' => $subuser->hashid, 'id' => $subuser->hashid,
]); ]);
} }