We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9285973 commit ee516ceCopy full SHA for ee516ce
1 file changed
API.php
@@ -10,6 +10,7 @@
10
namespace Piwik\Plugins\OpenApiDocs;
11
12
use Piwik\Piwik;
13
+use Piwik\Request;
14
use Piwik\Plugin\Manager;
15
use Piwik\Plugins\OpenApiDocs\Specs\SpecGenerator;
16
@@ -34,6 +35,20 @@ class API extends \Piwik\Plugin\API
34
35
*/
36
public function getMatomoOpenApiSpec(): array
37
{
38
+
39
+ Piwik::checkUserHasSomeViewAccess();
40
41
+ $request = Request::fromRequest();
42
+ $format = strtolower($request->getStringParameter('format', 'json'));
43
+ if (strtolower($format) !== 'json') {
44
+ throw new \Exception(
45
+ Piwik::translate(
46
+ 'General_ExceptionInvalidReportRendererFormat',
47
+ [$format, 'json']
48
+ )
49
+ );
50
+ }
51
52
$filePath = $this->getMatomoSpecFilePath();
53
54
if (!$this->isSpecFileReadable($filePath)) {
0 commit comments