2016-06-08 15:25:44 +02:00
|
|
|
<?php
|
2019-12-03 19:57:53 +01:00
|
|
|
|
2018-03-10 19:40:19 +01:00
|
|
|
declare(strict_types=1);
|
2016-06-08 15:25:44 +02:00
|
|
|
/**
|
2024-05-24 19:43:47 +02:00
|
|
|
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2016-06-08 15:25:44 +02:00
|
|
|
*/
|
2017-07-01 11:28:03 +02:00
|
|
|
namespace OCA\AdminAudit\Actions;
|
|
|
|
|
2016-06-08 15:25:44 +02:00
|
|
|
/**
|
|
|
|
* Class Sharing logs the sharing actions
|
|
|
|
*
|
2017-07-01 11:28:03 +02:00
|
|
|
* @package OCA\AdminAudit\Actions
|
2016-06-08 15:25:44 +02:00
|
|
|
*/
|
|
|
|
class Sharing extends Action {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Logs the updating of permission changes for shares
|
|
|
|
*
|
|
|
|
* @param array $params
|
|
|
|
*/
|
2021-03-05 15:02:35 +01:00
|
|
|
public function updatePermissions(array $params): void {
|
2016-06-08 15:25:44 +02:00
|
|
|
$this->log(
|
|
|
|
'The permissions of the shared %s "%s" with ID "%s" have been changed to "%s"',
|
|
|
|
$params,
|
|
|
|
[
|
|
|
|
'itemType',
|
|
|
|
'path',
|
|
|
|
'itemSource',
|
|
|
|
'permissions',
|
|
|
|
]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Logs the password changes for a share
|
|
|
|
*
|
|
|
|
* @param array $params
|
|
|
|
*/
|
2021-03-05 15:02:35 +01:00
|
|
|
public function updatePassword(array $params): void {
|
2016-06-08 15:25:44 +02:00
|
|
|
$this->log(
|
|
|
|
'The password of the publicly shared %s "%s" with ID "%s" has been changed',
|
|
|
|
$params,
|
|
|
|
[
|
|
|
|
'itemType',
|
|
|
|
'token',
|
|
|
|
'itemSource',
|
|
|
|
]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Logs the expiration date changes for a share
|
|
|
|
*
|
|
|
|
* @param array $params
|
|
|
|
*/
|
2021-03-05 15:02:35 +01:00
|
|
|
public function updateExpirationDate(array $params): void {
|
2021-05-19 10:09:48 +02:00
|
|
|
if ($params['date'] === null) {
|
|
|
|
$this->log(
|
2021-06-01 13:31:10 +02:00
|
|
|
'The expiration date of the publicly shared %s with ID "%s" has been removed',
|
2021-05-19 10:09:48 +02:00
|
|
|
$params,
|
|
|
|
[
|
|
|
|
'itemType',
|
|
|
|
'itemSource',
|
|
|
|
]
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
$this->log(
|
|
|
|
'The expiration date of the publicly shared %s with ID "%s" has been changed to "%s"',
|
|
|
|
$params,
|
|
|
|
[
|
|
|
|
'itemType',
|
|
|
|
'itemSource',
|
|
|
|
'date',
|
|
|
|
]
|
|
|
|
);
|
|
|
|
}
|
2016-06-08 15:25:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Logs access of shared files
|
|
|
|
*
|
|
|
|
* @param array $params
|
|
|
|
*/
|
2021-03-05 15:02:35 +01:00
|
|
|
public function shareAccessed(array $params): void {
|
2016-06-08 15:25:44 +02:00
|
|
|
$this->log(
|
|
|
|
'The shared %s with the token "%s" by "%s" has been accessed.',
|
|
|
|
$params,
|
|
|
|
[
|
|
|
|
'itemType',
|
|
|
|
'token',
|
|
|
|
'uidOwner',
|
|
|
|
]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|