Sharing.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\AdminAudit\Actions;
  8. /**
  9. * Class Sharing logs the sharing actions
  10. *
  11. * @package OCA\AdminAudit\Actions
  12. */
  13. class Sharing extends Action {
  14. /**
  15. * Logs the updating of permission changes for shares
  16. *
  17. * @param array $params
  18. */
  19. public function updatePermissions(array $params): void {
  20. $this->log(
  21. 'The permissions of the shared %s "%s" with ID "%s" have been changed to "%s"',
  22. $params,
  23. [
  24. 'itemType',
  25. 'path',
  26. 'itemSource',
  27. 'permissions',
  28. ]
  29. );
  30. }
  31. /**
  32. * Logs the password changes for a share
  33. *
  34. * @param array $params
  35. */
  36. public function updatePassword(array $params): void {
  37. $this->log(
  38. 'The password of the publicly shared %s "%s" with ID "%s" has been changed',
  39. $params,
  40. [
  41. 'itemType',
  42. 'token',
  43. 'itemSource',
  44. ]
  45. );
  46. }
  47. /**
  48. * Logs the expiration date changes for a share
  49. *
  50. * @param array $params
  51. */
  52. public function updateExpirationDate(array $params): void {
  53. if ($params['date'] === null) {
  54. $this->log(
  55. 'The expiration date of the publicly shared %s with ID "%s" has been removed',
  56. $params,
  57. [
  58. 'itemType',
  59. 'itemSource',
  60. ]
  61. );
  62. } else {
  63. $this->log(
  64. 'The expiration date of the publicly shared %s with ID "%s" has been changed to "%s"',
  65. $params,
  66. [
  67. 'itemType',
  68. 'itemSource',
  69. 'date',
  70. ]
  71. );
  72. }
  73. }
  74. /**
  75. * Logs access of shared files
  76. *
  77. * @param array $params
  78. */
  79. public function shareAccessed(array $params): void {
  80. $this->log(
  81. 'The shared %s with the token "%s" by "%s" has been accessed.',
  82. $params,
  83. [
  84. 'itemType',
  85. 'token',
  86. 'uidOwner',
  87. ]
  88. );
  89. }
  90. }