Merged in bugfix/MAPG-45-secure-profile-page (pull request #114)
MAPG-45 secure profile page
This commit is contained in:
commit
15b5869d5a
@ -1,12 +1,13 @@
|
|||||||
<?php namespace MapGuesser\Controller;
|
<?php namespace MapGuesser\Controller;
|
||||||
|
|
||||||
use MapGuesser\Database\Query\Modify;
|
use MapGuesser\Database\Query\Modify;
|
||||||
|
use MapGuesser\Interfaces\Authorization\ISecured;
|
||||||
use MapGuesser\Interfaces\Request\IRequest;
|
use MapGuesser\Interfaces\Request\IRequest;
|
||||||
use MapGuesser\Interfaces\Response\IContent;
|
use MapGuesser\Interfaces\Response\IContent;
|
||||||
use MapGuesser\Response\HtmlContent;
|
use MapGuesser\Response\HtmlContent;
|
||||||
use MapGuesser\Response\JsonContent;
|
use MapGuesser\Response\JsonContent;
|
||||||
|
|
||||||
class UserController
|
class UserController implements ISecured
|
||||||
{
|
{
|
||||||
private IRequest $request;
|
private IRequest $request;
|
||||||
|
|
||||||
@ -15,6 +16,13 @@ class UserController
|
|||||||
$this->request = $request;
|
$this->request = $request;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function authorize(): bool
|
||||||
|
{
|
||||||
|
$user = $this->request->user();
|
||||||
|
|
||||||
|
return $user !== null;
|
||||||
|
}
|
||||||
|
|
||||||
public function getProfile(): IContent
|
public function getProfile(): IContent
|
||||||
{
|
{
|
||||||
$user = $this->request->user();
|
$user = $this->request->user();
|
||||||
|
Loading…
Reference in New Issue
Block a user