You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

GroupManagement.php 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2016 Bjoern Schiessle <bjoern@schiessle.org>
  5. *
  6. * @author Bjoern Schiessle <bjoern@schiessle.org>
  7. * @author Joas Schilling <coding@schilljs.com>
  8. * @author Lukas Reschke <lukas@statuscode.ch>
  9. * @author Roger Szabo <roger.szabo@web.de>
  10. *
  11. * @license GNU AGPL version 3 or any later version
  12. *
  13. * This program is free software: you can redistribute it and/or modify
  14. * it under the terms of the GNU Affero General Public License as
  15. * published by the Free Software Foundation, either version 3 of the
  16. * License, or (at your option) any later version.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU Affero General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU Affero General Public License
  24. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  25. *
  26. */
  27. namespace OCA\AdminAudit\Actions;
  28. use OCP\IGroup;
  29. use OCP\IUser;
  30. /**
  31. * Class GroupManagement logs all group manager related events
  32. *
  33. * @package OCA\AdminAudit\Actions
  34. */
  35. class GroupManagement extends Action {
  36. /**
  37. * log add user to group event
  38. *
  39. * @param IGroup $group
  40. * @param IUser $user
  41. */
  42. public function addUser(IGroup $group, IUser $user) {
  43. $this->log('User "%s" added to group "%s"',
  44. [
  45. 'group' => $group->getGID(),
  46. 'user' => $user->getUID()
  47. ],
  48. [
  49. 'user', 'group'
  50. ]
  51. );
  52. }
  53. /**
  54. * log remove user from group event
  55. *
  56. * @param IGroup $group
  57. * @param IUser $user
  58. */
  59. public function removeUser(IGroup $group, IUser $user) {
  60. $this->log('User "%s" removed from group "%s"',
  61. [
  62. 'group' => $group->getGID(),
  63. 'user' => $user->getUID()
  64. ],
  65. [
  66. 'user', 'group'
  67. ]
  68. );
  69. }
  70. /**
  71. * log create group to group event
  72. *
  73. * @param IGroup $group
  74. */
  75. public function createGroup(IGroup $group) {
  76. $this->log('Group created: "%s"',
  77. [
  78. 'group' => $group->getGID()
  79. ],
  80. [
  81. 'group'
  82. ]
  83. );
  84. }
  85. /**
  86. * log delete group to group event
  87. *
  88. * @param IGroup $group
  89. */
  90. public function deleteGroup(IGroup $group) {
  91. $this->log('Group deleted: "%s"',
  92. [
  93. 'group' => $group->getGID()
  94. ],
  95. [
  96. 'group'
  97. ]
  98. );
  99. }
  100. }