1
0

ISubAdmin.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2019, 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\Group;
  25. use OCP\IGroup;
  26. use OCP\IUser;
  27. /**
  28. * @since 16.0.0
  29. */
  30. interface ISubAdmin {
  31. /**
  32. * add a SubAdmin
  33. * @param IUser $user user to be SubAdmin
  34. * @param IGroup $group group $user becomes subadmin of
  35. *
  36. * @since 16.0.0
  37. */
  38. public function createSubAdmin(IUser $user, IGroup $group): void;
  39. /**
  40. * delete a SubAdmin
  41. * @param IUser $user the user that is the SubAdmin
  42. * @param IGroup $group the group
  43. *
  44. * @since 16.0.0
  45. */
  46. public function deleteSubAdmin(IUser $user, IGroup $group): void;
  47. /**
  48. * get groups of a SubAdmin
  49. * @param IUser $user the SubAdmin
  50. * @return IGroup[]
  51. *
  52. * @since 16.0.0
  53. */
  54. public function getSubAdminsGroups(IUser $user): array;
  55. /**
  56. * get SubAdmins of a group
  57. * @param IGroup $group the group
  58. * @return IUser[]
  59. *
  60. * @since 16.0.0
  61. */
  62. public function getGroupsSubAdmins(IGroup $group): array;
  63. /**
  64. * checks if a user is a SubAdmin of a group
  65. * @param IUser $user
  66. * @param IGroup $group
  67. * @return bool
  68. *
  69. * @since 16.0.0
  70. */
  71. public function isSubAdminOfGroup(IUser $user, IGroup $group): bool;
  72. /**
  73. * checks if a user is a SubAdmin
  74. * @param IUser $user
  75. * @return bool
  76. *
  77. * @since 16.0.0
  78. */
  79. public function isSubAdmin(IUser $user): bool;
  80. /**
  81. * checks if a user is a accessible by a subadmin
  82. * @param IUser $subadmin
  83. * @param IUser $user
  84. * @return bool
  85. *
  86. * @since 16.0.0
  87. */
  88. public function isUserAccessible(IUser $subadmin, IUser $user): bool;
  89. }