blob: 8b991c57a2d46f1f53802f8f90b51cf1c4ac6d1a (
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
29
30
31
32
|
<?php
namespace JsonApi\Routes\Courseware;
use JsonApi\Errors\AuthorizationFailedException;
use JsonApi\JsonApiController;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
/**
* Displays a user progress.
*/
class UserProgressesShow extends JsonApiController
{
use UserProgressesHelper;
protected $allowedIncludePaths = ['block', 'user'];
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function __invoke(Request $request, Response $response, $args)
{
$resource = $this->findWithId($args['id']);
if (!Authority::canShowUserProgress($this->getUser($request), $resource)) {
throw new AuthorizationFailedException();
}
return $this->getContentResponse($resource);
}
}
|