ABackend.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.nl>
  5. *
  6. * @author Roeland Jago Douma <roeland@famdouma.nl>
  7. *
  8. * @license GNU AGPL version 3 or any later version
  9. *
  10. * This program is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License as
  12. * published by the Free Software Foundation, either version 3 of the
  13. * License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. */
  24. namespace OCP\User\Backend;
  25. use OC\User\Backend;
  26. use OCP\IUserBackend;
  27. use OCP\UserInterface;
  28. /**
  29. * @since 14.0.0
  30. */
  31. abstract class ABackend implements IUserBackend, UserInterface {
  32. /**
  33. * @deprecated 14.0.0
  34. *
  35. * @param int $actions The action to check for
  36. * @return bool
  37. */
  38. public function implementsActions($actions): bool {
  39. $implements = 0;
  40. if ($this instanceof ICreateUserBackend) {
  41. $implements |= Backend::CREATE_USER;
  42. }
  43. if ($this instanceof ISetPasswordBackend) {
  44. $implements |= Backend::SET_PASSWORD;
  45. }
  46. if ($this instanceof ICheckPasswordBackend) {
  47. $implements |= Backend::CHECK_PASSWORD;
  48. }
  49. if ($this instanceof IGetHomeBackend) {
  50. $implements |= Backend::GET_HOME;
  51. }
  52. if ($this instanceof IGetDisplayNameBackend) {
  53. $implements |= Backend::GET_DISPLAYNAME;
  54. }
  55. if ($this instanceof ISetDisplayNameBackend) {
  56. $implements |= Backend::SET_DISPLAYNAME;
  57. }
  58. if ($this instanceof IProvideAvatarBackend) {
  59. $implements |= Backend::PROVIDE_AVATAR;
  60. }
  61. if ($this instanceof ICountUsersBackend) {
  62. $implements |= Backend::COUNT_USERS;
  63. }
  64. return (bool)($actions & $implements);
  65. }
  66. }