1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* @copyright Copyright (c) 2021 Matias De lellis <[email protected]> |
7
|
|
|
* |
8
|
|
|
* @author Matias De lellis <[email protected]> |
9
|
|
|
* |
10
|
|
|
* @license GNU AGPL version 3 or any later version |
11
|
|
|
* |
12
|
|
|
* This program is free software: you can redistribute it and/or modify |
13
|
|
|
* it under the terms of the GNU Affero General Public License as |
14
|
|
|
* published by the Free Software Foundation, either version 3 of the |
15
|
|
|
* License, or (at your option) any later version. |
16
|
|
|
* |
17
|
|
|
* This program is distributed in the hope that it will be useful, |
18
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
19
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
20
|
|
|
* GNU Affero General Public License for more details. |
21
|
|
|
* |
22
|
|
|
* You should have received a copy of the GNU Affero General Public License |
23
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
24
|
|
|
* |
25
|
|
|
*/ |
26
|
|
|
|
27
|
|
|
namespace OCA\FaceRecognition\Dav; |
28
|
|
|
|
29
|
|
|
use Sabre\DAV\INode; |
|
|
|
|
30
|
|
|
use Sabre\DAV\PropFind; |
|
|
|
|
31
|
|
|
use Sabre\DAV\Server; |
|
|
|
|
32
|
|
|
use Sabre\DAV\ServerPlugin; |
|
|
|
|
33
|
|
|
|
34
|
|
|
use OCA\FaceRecognition\AppInfo\Application; |
35
|
|
|
use OCA\FaceRecognition\Service\DavService; |
36
|
|
|
|
37
|
|
|
class DavPlugin extends ServerPlugin { |
38
|
|
|
|
39
|
|
|
/** @var Server */ |
40
|
|
|
protected $server; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Initializes the plugin and registers event handlers |
44
|
|
|
* |
45
|
|
|
* @param Server $server |
46
|
|
|
* @return void |
47
|
|
|
*/ |
48
|
|
|
public function initialize(Server $server) { |
49
|
|
|
$this->server = $server; |
50
|
|
|
$server->on('propFind', [$this, 'getPersons']); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @param PropFind $propFind |
56
|
|
|
* @param INode $node |
57
|
|
|
*/ |
58
|
|
|
public function getPersons(PropFind $propFind, INode $node) { |
59
|
|
|
// we instantiate the DavService here to make sure sabre auth backend was triggered |
60
|
|
|
$davService = \OC::$server->get(DavService::class); |
61
|
|
|
$davService->propFind($propFind, $node); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Returns a plugin name. |
66
|
|
|
* |
67
|
|
|
* Using this name other plugins will be able to access other plugins |
68
|
|
|
* using \Sabre\DAV\Server::getPlugin |
69
|
|
|
* |
70
|
|
|
* @return string |
71
|
|
|
*/ |
72
|
|
|
public function getPluginName(): string { |
73
|
|
|
return Application::APP_NAME; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Returns a bunch of meta-data about the plugin. |
78
|
|
|
* |
79
|
|
|
* Providing this information is optional, and is mainly displayed by the |
80
|
|
|
* Browser plugin. |
81
|
|
|
* |
82
|
|
|
* The description key in the returned array may contain html and will not |
83
|
|
|
* be sanitized. |
84
|
|
|
* |
85
|
|
|
* @return array |
86
|
|
|
*/ |
87
|
|
|
public function getPluginInfo(): array { |
88
|
|
|
return [ |
89
|
|
|
'name' => $this->getPluginName(), |
90
|
|
|
'description' => 'Provides information on Face Recognition in PROPFIND WebDav requests', |
91
|
|
|
]; |
92
|
|
|
} |
93
|
|
|
} |
94
|
|
|
|
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