aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib/AccessFactory.php
blob: 28f88e3c4e91bec9ffa70b41f4efdfe13ac97da3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/**
 * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */
namespace OCA\User_LDAP;

use OCA\User_LDAP\User\Manager;
use OCP\IAppConfig;
use OCP\IConfig;
use OCP\IUserManager;
use OCP\Server;
use Psr\Log\LoggerInterface;

class AccessFactory {

	public function __construct(
		private ILDAPWrapper $ldap,
		private Helper $helper,
		private IConfig $config,
		private IAppConfig $appConfig,
		private IUserManager $ncUserManager,
		private LoggerInterface $logger,
	) {
		$this->ldap = $ldap;
		$this->helper = $helper;
		$this->config = $config;
		$this->ncUserManager = $ncUserManager;
		$this->logger = $logger;
	}

	public function get(Connection $connection): Access {
		/* Each Access instance gets its own Manager instance, see OCA\User_LDAP\AppInfo\Application::register() */
		return new Access(
			$this->ldap,
			$connection,
			Server::get(Manager::class),
			$this->helper,
			$this->config,
			$this->ncUserManager,
			$this->logger,
			$this->appConfig,
		);
	}
}