ABackend.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\User\Backend;
  8. use OC\User\Backend;
  9. use OCP\IUserBackend;
  10. use OCP\UserInterface;
  11. /**
  12. * @since 14.0.0
  13. */
  14. abstract class ABackend implements IUserBackend, UserInterface {
  15. /**
  16. * @deprecated 14.0.0
  17. * @since 14.0.0
  18. *
  19. * @param int $actions The action to check for
  20. * @return bool
  21. */
  22. public function implementsActions($actions): bool {
  23. $implements = 0;
  24. if ($this instanceof ICreateUserBackend) {
  25. $implements |= Backend::CREATE_USER;
  26. }
  27. if ($this instanceof ISetPasswordBackend) {
  28. $implements |= Backend::SET_PASSWORD;
  29. }
  30. if ($this instanceof ICheckPasswordBackend) {
  31. $implements |= Backend::CHECK_PASSWORD;
  32. }
  33. if ($this instanceof IGetHomeBackend) {
  34. $implements |= Backend::GET_HOME;
  35. }
  36. if ($this instanceof IGetDisplayNameBackend) {
  37. $implements |= Backend::GET_DISPLAYNAME;
  38. }
  39. if ($this instanceof ISetDisplayNameBackend) {
  40. $implements |= Backend::SET_DISPLAYNAME;
  41. }
  42. if ($this instanceof IProvideAvatarBackend) {
  43. $implements |= Backend::PROVIDE_AVATAR;
  44. }
  45. if ($this instanceof ICountUsersBackend) {
  46. $implements |= Backend::COUNT_USERS;
  47. }
  48. return (bool)($actions & $implements);
  49. }
  50. }