|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
/** |
|
5
|
|
|
* @copyright Copyright (c) 2022 Robin Appelman <[email protected]> |
|
6
|
|
|
* |
|
7
|
|
|
* @license GNU AGPL version 3 or any later version |
|
8
|
|
|
* |
|
9
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
10
|
|
|
* it under the terms of the GNU Affero General Public License as |
|
11
|
|
|
* published by the Free Software Foundation, either version 3 of the |
|
12
|
|
|
* License, or (at your option) any later version. |
|
13
|
|
|
* |
|
14
|
|
|
* This program is distributed in the hope that it will be useful, |
|
15
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
17
|
|
|
* GNU Affero General Public License for more details. |
|
18
|
|
|
* |
|
19
|
|
|
* You should have received a copy of the GNU Affero General Public License |
|
20
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
21
|
|
|
* |
|
22
|
|
|
*/ |
|
23
|
|
|
|
|
24
|
|
|
namespace OC\Files; |
|
25
|
|
|
|
|
26
|
|
|
use OCP\Diagnostics\IEventLogger; |
|
27
|
|
|
use OCP\EventDispatcher\IEventDispatcher; |
|
28
|
|
|
use OCP\Files\Config\IMountProviderCollection; |
|
29
|
|
|
use OCP\Files\Config\IUserMountCache; |
|
30
|
|
|
use OCP\Files\Mount\IMountManager; |
|
31
|
|
|
use OCP\IUserManager; |
|
32
|
|
|
use OCP\Lockdown\ILockdownManager; |
|
33
|
|
|
|
|
34
|
|
|
class SetupManagerFactory { |
|
35
|
|
|
private IEventLogger $eventLogger; |
|
36
|
|
|
private IMountProviderCollection $mountProviderCollection; |
|
37
|
|
|
private IUserManager $userManager; |
|
38
|
|
|
private IEventDispatcher $eventDispatcher; |
|
39
|
|
|
private IUserMountCache $userMountCache; |
|
40
|
|
|
private ILockdownManager $lockdownManager; |
|
41
|
|
|
private ?SetupManager $setupManager; |
|
42
|
|
|
|
|
43
|
|
|
public function __construct( |
|
44
|
|
|
IEventLogger $eventLogger, |
|
45
|
|
|
IMountProviderCollection $mountProviderCollection, |
|
46
|
|
|
IUserManager $userManager, |
|
47
|
|
|
IEventDispatcher $eventDispatcher, |
|
48
|
|
|
IUserMountCache $userMountCache, |
|
49
|
|
|
ILockdownManager $lockdownManager |
|
50
|
|
|
) { |
|
51
|
|
|
$this->eventLogger = $eventLogger; |
|
52
|
|
|
$this->mountProviderCollection = $mountProviderCollection; |
|
53
|
|
|
$this->userManager = $userManager; |
|
54
|
|
|
$this->eventDispatcher = $eventDispatcher; |
|
55
|
|
|
$this->userMountCache = $userMountCache; |
|
56
|
|
|
$this->lockdownManager = $lockdownManager; |
|
57
|
|
|
$this->setupManager = null; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
public function create(IMountManager $mountManager): SetupManager { |
|
61
|
|
|
if (!$this->setupManager) { |
|
62
|
|
|
$this->setupManager = new SetupManager($this->eventLogger, $this->mountProviderCollection, $mountManager, $this->userManager, $this->eventDispatcher, $this->userMountCache, $this->lockdownManager); |
|
63
|
|
|
} |
|
64
|
|
|
return $this->setupManager; |
|
65
|
|
|
} |
|
66
|
|
|
} |
|
67
|
|
|
|