|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Analytics |
|
4
|
|
|
* |
|
5
|
|
|
* This file is licensed under the Affero General Public License version 3 or |
|
6
|
|
|
* later. See the LICENSE.md file. |
|
7
|
|
|
* |
|
8
|
|
|
* @author Marcel Scherello <[email protected]> |
|
9
|
|
|
* @copyright 2019-2022 Marcel Scherello |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace OCA\Analytics\Controller; |
|
13
|
|
|
|
|
14
|
|
|
use OCA\Analytics\Service\StoryService; |
|
15
|
|
|
use OCP\AppFramework\Controller; |
|
|
|
|
|
|
16
|
|
|
use OCP\AppFramework\Http\DataResponse; |
|
|
|
|
|
|
17
|
|
|
use OCP\DB\Exception; |
|
|
|
|
|
|
18
|
|
|
use OCP\IRequest; |
|
|
|
|
|
|
19
|
|
|
use Psr\Log\LoggerInterface; |
|
|
|
|
|
|
20
|
|
|
|
|
21
|
|
|
class StoryController extends Controller |
|
22
|
|
|
{ |
|
23
|
|
|
private $logger; |
|
24
|
|
|
private $StoryService; |
|
25
|
|
|
|
|
26
|
|
|
public function __construct( |
|
27
|
|
|
$appName, |
|
28
|
|
|
IRequest $request, |
|
29
|
|
|
LoggerInterface $logger, |
|
30
|
|
|
StoryService $StoryService |
|
31
|
|
|
) |
|
32
|
|
|
{ |
|
33
|
|
|
parent::__construct($appName, $request); |
|
34
|
|
|
$this->logger = $logger; |
|
35
|
|
|
$this->StoryService = $StoryService; |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* get all reports |
|
40
|
|
|
* |
|
41
|
|
|
* @NoAdminRequired |
|
42
|
|
|
* @return DataResponse |
|
43
|
|
|
*/ |
|
44
|
|
|
public function index() |
|
45
|
|
|
{ |
|
46
|
|
|
return new DataResponse($this->StoryService->index()); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* create new blank report |
|
51
|
|
|
* |
|
52
|
|
|
* @NoAdminRequired |
|
53
|
|
|
* @param $name |
|
54
|
|
|
* @param $subheader |
|
55
|
|
|
* @param int $type |
|
56
|
|
|
* @param int $page |
|
57
|
|
|
* @param int $parent |
|
58
|
|
|
* @param $reports |
|
59
|
|
|
* @param $layout |
|
60
|
|
|
* @return DataResponse |
|
61
|
|
|
* @throws Exception |
|
62
|
|
|
*/ |
|
63
|
|
|
public function create($name, $subheader, int $type, int $page, int $parent, $reports, $layout) |
|
64
|
|
|
{ |
|
65
|
|
|
return new DataResponse($this->StoryService->create($name, $subheader, $type, $page, $parent, $reports, $layout)); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* get own report details |
|
71
|
|
|
* |
|
72
|
|
|
* @NoAdminRequired |
|
73
|
|
|
* @param int $storyId |
|
74
|
|
|
* @return DataResponse |
|
75
|
|
|
*/ |
|
76
|
|
|
public function read(int $storyId) |
|
77
|
|
|
{ |
|
78
|
|
|
return new DataResponse($this->StoryService->read($storyId)); |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* Delete report and all depending objects |
|
83
|
|
|
* |
|
84
|
|
|
* @NoAdminRequired |
|
85
|
|
|
* @param int $storyId |
|
86
|
|
|
* @return DataResponse |
|
87
|
|
|
*/ |
|
88
|
|
|
public function delete(int $storyId) |
|
89
|
|
|
{ |
|
90
|
|
|
if ($this->StoryService->isOwn($storyId)) { |
|
91
|
|
|
return new DataResponse($this->StoryService->delete($storyId)); |
|
92
|
|
|
} else { |
|
93
|
|
|
return new DataResponse(false,400); |
|
94
|
|
|
} |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* get report details |
|
99
|
|
|
* |
|
100
|
|
|
* @NoAdminRequired |
|
101
|
|
|
* @param int $id |
|
102
|
|
|
* @param $name |
|
103
|
|
|
* @param $subheader |
|
104
|
|
|
* @param int $type |
|
105
|
|
|
* @param int $page |
|
106
|
|
|
* @param int $parent |
|
107
|
|
|
* @param $reports |
|
108
|
|
|
* @param $layout |
|
109
|
|
|
* @return DataResponse |
|
110
|
|
|
* @throws Exception |
|
111
|
|
|
*/ |
|
112
|
|
|
public function update(int $id, $name, $subheader, int $type, int $page, int $parent, $reports, $layout) |
|
113
|
|
|
{ |
|
114
|
|
|
return new DataResponse($this->StoryService->update($id, $name, $subheader, $type, $page, $parent, $reports, $layout)); |
|
115
|
|
|
} |
|
116
|
|
|
} |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths