ISubAdmin.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Group;
  8. use OCP\IGroup;
  9. use OCP\IUser;
  10. /**
  11. * @since 16.0.0
  12. */
  13. interface ISubAdmin {
  14. /**
  15. * add a SubAdmin
  16. * @param IUser $user user to be SubAdmin
  17. * @param IGroup $group group $user becomes subadmin of
  18. *
  19. * @since 16.0.0
  20. */
  21. public function createSubAdmin(IUser $user, IGroup $group): void;
  22. /**
  23. * delete a SubAdmin
  24. * @param IUser $user the user that is the SubAdmin
  25. * @param IGroup $group the group
  26. *
  27. * @since 16.0.0
  28. */
  29. public function deleteSubAdmin(IUser $user, IGroup $group): void;
  30. /**
  31. * get groups of a SubAdmin
  32. * @param IUser $user the SubAdmin
  33. * @return IGroup[]
  34. *
  35. * @since 16.0.0
  36. */
  37. public function getSubAdminsGroups(IUser $user): array;
  38. /**
  39. * get SubAdmins of a group
  40. * @param IGroup $group the group
  41. * @return IUser[]
  42. *
  43. * @since 16.0.0
  44. */
  45. public function getGroupsSubAdmins(IGroup $group): array;
  46. /**
  47. * checks if a user is a SubAdmin of a group
  48. * @param IUser $user
  49. * @param IGroup $group
  50. * @return bool
  51. *
  52. * @since 16.0.0
  53. */
  54. public function isSubAdminOfGroup(IUser $user, IGroup $group): bool;
  55. /**
  56. * checks if a user is a SubAdmin
  57. * @param IUser $user
  58. * @return bool
  59. *
  60. * @since 16.0.0
  61. */
  62. public function isSubAdmin(IUser $user): bool;
  63. /**
  64. * checks if a user is a accessible by a subadmin
  65. * @param IUser $subadmin
  66. * @param IUser $user
  67. * @return bool
  68. *
  69. * @since 16.0.0
  70. */
  71. public function isUserAccessible(IUser $subadmin, IUser $user): bool;
  72. }