Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

LuticateGroupsController.php 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?php
  2. namespace Luticate\Auth\Controller;
  3. use Luticate\Utils\LuController;
  4. use Luticate\Auth\Business\LuticateGroupsBusiness;
  5. use Luticate\Auth\DBO\LuticateGroupsDbo;
  6. class LuticateGroupsController extends LuController {
  7. protected function getBusiness()
  8. {
  9. return new LuticateGroupsBusiness();
  10. }
  11. /**
  12. * Get a group by its id
  13. * @param $group_id int The group id
  14. * @return \Luticate\Utils\LuDbo
  15. */
  16. public function getById($group_id)
  17. {
  18. return LuticateGroupsBusiness::getById($group_id);
  19. }
  20. /**
  21. * Get all groups
  22. * @param int $page The page number, 0 based
  23. * @param int $perPage The number of items per page
  24. * @param string $query The filter query
  25. * @return \Luticate\Utils\LuMultipleDbo
  26. */
  27. public function getAll($page = 0, $perPage = PHP_INT_MAX, $query = "")
  28. {
  29. return LuticateGroupsBusiness::getAll($page, $perPage, $query);
  30. }
  31. /**
  32. * Get all users in group
  33. * @param $group_id int The group id
  34. * @param int $page The page number, 0 based
  35. * @param int $perPage The number of items per page
  36. * @param string $query The filter query
  37. * @return \Luticate\Utils\LuMultipleDbo
  38. */
  39. public function getUsers($group_id, $page = 0, $perPage = PHP_INT_MAX, $query = "")
  40. {
  41. return LuticateGroupsBusiness::getUsers($group_id, $page, $perPage, $query);
  42. }
  43. /**
  44. * Get all users not in group
  45. * @param $group_id int The group id
  46. * @param int $page The page number, 0 based
  47. * @param int $perPage The number of items per page
  48. * @param string $query The filter query
  49. * @return \Luticate\Utils\LuMultipleDbo
  50. */
  51. public function getOtherUsers($group_id, $page = 0, $perPage = PHP_INT_MAX, $query = "")
  52. {
  53. return LuticateGroupsBusiness::getOtherUsers($group_id, $page, $perPage, $query);
  54. }
  55. /**
  56. * Add a new group
  57. * @param $group_name string The group name
  58. * @return int
  59. */
  60. public function add($group_name)
  61. {
  62. return LuticateGroupsBusiness::add($group_name);
  63. }
  64. /**
  65. * Delete a group by its id
  66. * @param $group_id int The group id
  67. * @return bool
  68. */
  69. public function del($group_id)
  70. {
  71. return LuticateGroupsBusiness::deleteById($group_id);
  72. }
  73. /**
  74. * Edit a group name by its id
  75. * @param $group_id int The group id
  76. * @param $group_name string The new group name
  77. * @return bool
  78. */
  79. public function edit($group_id, $group_name)
  80. {
  81. return LuticateGroupsBusiness::edit($group_id, $group_name);
  82. }
  83. /**
  84. * Add a user to a group
  85. * @param $user_id int The user id
  86. * @param $group_id int The group id
  87. * @return bool
  88. */
  89. public function addUser($user_id, $group_id)
  90. {
  91. return LuticateGroupsBusiness::addUser($user_id, $group_id);
  92. }
  93. /**
  94. * Delete a user from a group
  95. * @param $user_id int The user id
  96. * @param $group_id int The group id
  97. * @return bool
  98. */
  99. public static function delUser($user_id, $group_id)
  100. {
  101. return LuticateGroupsBusiness::delUser($user_id, $group_id);
  102. }
  103. }