Add support for user management of databases

This commit is contained in:
Dane Everitt 2018-03-02 19:03:55 -06:00
parent aaccf38640
commit bcb69603ad
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
9 changed files with 132 additions and 7 deletions

View file

@ -38,8 +38,13 @@ class DatabaseBelongsToServer
public function handle(Request $request, Closure $next)
{
$server = $request->attributes->get('server');
$database = $request->input('database') ?? $request->route()->parameter('database');
$database = $this->repository->find($request->input('database'));
if (! is_digit($database)) {
throw new NotFoundHttpException;
}
$database = $this->repository->find($database);
if (is_null($database) || $database->server_id !== $server->id) {
throw new NotFoundHttpException;
}