Commit 9505a374 authored by Christian Wansart's avatar Christian Wansart

Add null check for unauthorized user

parent 0bbb1478
Pipeline #83560035 passed with stages
in 8 minutes and 22 seconds
......@@ -48,7 +48,7 @@ class WallRestController extends AbstractFOSRestController
*/
public function getPostsAction(string $target, int $targetId): \Symfony\Component\HttpFoundation\Response
{
if (!$this->wallPostService->mayReadWall($this->session->id(), $target, $targetId)) {
if ($this->session->id() === null || !$this->wallPostService->mayReadWall($this->session->id(), $target, $targetId)) {
throw new HttpException(403);
}
......@@ -88,7 +88,7 @@ class WallRestController extends AbstractFOSRestController
*/
public function addPostAction(string $target, int $targetId, ParamFetcher $paramFetcher): \Symfony\Component\HttpFoundation\Response
{
if (!$this->wallPostService->mayWriteWall($this->session->id(), $target, $targetId)) {
if ($this->session->id() === null || !$this->wallPostService->mayWriteWall($this->session->id(), $target, $targetId)) {
throw new HttpException(403);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment