1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @copyright Copyright (c) 2016 Morris Jobke <[email protected]> |
4
|
|
|
* |
5
|
|
|
* @license GNU AGPL version 3 or any later version |
6
|
|
|
* |
7
|
|
|
* This program is free software: you can redistribute it and/or modify |
8
|
|
|
* it under the terms of the GNU Affero General Public License as |
9
|
|
|
* published by the Free Software Foundation, either version 3 of the |
10
|
|
|
* License, or (at your option) any later version. |
11
|
|
|
* |
12
|
|
|
* This program is distributed in the hope that it will be useful, |
13
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15
|
|
|
* GNU Affero General Public License for more details. |
16
|
|
|
* |
17
|
|
|
* You should have received a copy of the GNU Affero General Public License |
18
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
19
|
|
|
* |
20
|
|
|
*/ |
21
|
|
|
|
22
|
|
|
namespace OCA\FilesAccessControl\AppInfo; |
23
|
|
|
|
24
|
|
|
use OC; |
25
|
|
|
use OC\Files\Filesystem; |
|
|
|
|
26
|
|
|
use OCA\Files_Sharing\SharedStorage; |
|
|
|
|
27
|
|
|
use OCA\FilesAccessControl\Listener\FlowRegisterOperationListener; |
28
|
|
|
use OCA\FilesAccessControl\Operation; |
29
|
|
|
use OCA\FilesAccessControl\StorageWrapper; |
30
|
|
|
use OCP\AppFramework\App; |
31
|
|
|
use OCP\AppFramework\Bootstrap\IBootContext; |
32
|
|
|
use OCP\AppFramework\Bootstrap\IBootstrap; |
33
|
|
|
use OCP\AppFramework\Bootstrap\IRegistrationContext; |
34
|
|
|
use OCP\Files\Storage\IStorage; |
35
|
|
|
use OCP\Util; |
36
|
|
|
use OCP\WorkflowEngine\Events\RegisterOperationsEvent; |
37
|
|
|
|
38
|
|
|
class Application extends App implements IBootstrap { |
39
|
|
|
public function __construct() { |
40
|
|
|
parent::__construct('files_accesscontrol'); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @internal |
45
|
|
|
*/ |
46
|
|
|
public function addStorageWrapper() { |
47
|
|
|
// Needs to be added as the first layer |
48
|
|
|
Filesystem::addStorageWrapper('files_accesscontrol', [$this, 'addStorageWrapperCallback'], -10); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @internal |
53
|
|
|
* @param $mountPoint |
54
|
|
|
* @param IStorage $storage |
55
|
|
|
* @return StorageWrapper|IStorage |
56
|
|
|
*/ |
57
|
|
|
public function addStorageWrapperCallback($mountPoint, IStorage $storage) { |
58
|
|
|
if (!OC::$CLI && !$storage->instanceOfStorage(SharedStorage::class)) { |
59
|
|
|
/** @var Operation $operation */ |
60
|
|
|
$operation = $this->getContainer()->get(Operation::class); |
61
|
|
|
return new StorageWrapper([ |
62
|
|
|
'storage' => $storage, |
63
|
|
|
'mountPoint' => $mountPoint, |
64
|
|
|
'operation' => $operation, |
65
|
|
|
]); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
return $storage; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
public function register(IRegistrationContext $context): void { |
72
|
|
|
Util::connectHook('OC_Filesystem', 'preSetup', $this, 'addStorageWrapper'); |
|
|
|
|
73
|
|
|
$context->registerEventListener(RegisterOperationsEvent::class, FlowRegisterOperationListener::class); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
public function boot(IBootContext $context): void { |
77
|
|
|
} |
78
|
|
|
} |
79
|
|
|
|
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