blob: ba6b5b806dab961bfd210750e4a689dc9c68f44b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
<?php
namespace JsonApi\Routes\Files;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
use JsonApi\Errors\AuthorizationFailedException;
use JsonApi\Errors\RecordNotFoundException;
use JsonApi\JsonApiController;
class TermsOfUseShow extends JsonApiController
{
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameters)
*/
public function __invoke(Request $request, Response $response, $args)
{
if (!$terms = \ContentTermsOfUse::find($args['id'])) {
throw new RecordNotFoundException();
}
if (!Authority::canShowTermsOfUse($this->getUser($request), $terms)) {
throw new AuthorizationFailedException();
}
return $this->getContentResponse($terms);
}
}
|