blob: 9516ac7ddfd06bdb54e010b0e119dbf18ebf78ca (
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 Courseware\Instance;
use JsonApi\Errors\AuthorizationFailedException;
use JsonApi\JsonApiController;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
/**
* Displays an instance of a courseware.
*/
class CoursewareInstancesShow extends JsonApiController
{
use CoursewareInstancesHelper;
protected $allowedIncludePaths = ['bookmarks', 'root'];
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function __invoke(Request $request, Response $response, $args)
{
$instance = $this->findInstanceWithRange($args['type'], $args['id']);
if (!Authority::canShowCoursewareInstance($this->getUser($request), $instance)) {
throw new AuthorizationFailedException();
}
return $this->getContentResponse($instance);
}
}
|