1
0

AccessFactory.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCA\User_LDAP;
  7. use OCA\User_LDAP\User\Manager;
  8. use OCP\IConfig;
  9. use OCP\IUserManager;
  10. use OCP\Server;
  11. use Psr\Log\LoggerInterface;
  12. class AccessFactory {
  13. private ILDAPWrapper $ldap;
  14. private Helper $helper;
  15. private IConfig $config;
  16. private IUserManager $ncUserManager;
  17. private LoggerInterface $logger;
  18. public function __construct(
  19. ILDAPWrapper $ldap,
  20. Helper $helper,
  21. IConfig $config,
  22. IUserManager $ncUserManager,
  23. LoggerInterface $logger) {
  24. $this->ldap = $ldap;
  25. $this->helper = $helper;
  26. $this->config = $config;
  27. $this->ncUserManager = $ncUserManager;
  28. $this->logger = $logger;
  29. }
  30. public function get(Connection $connection): Access {
  31. /* Each Access instance gets its own Manager instance, see OCA\User_LDAP\AppInfo\Application::register() */
  32. return new Access(
  33. $connection,
  34. $this->ldap,
  35. Server::get(Manager::class),
  36. $this->helper,
  37. $this->config,
  38. $this->ncUserManager,
  39. $this->logger
  40. );
  41. }
  42. }