diff options
Diffstat (limited to 'apps/admin_audit')
118 files changed, 1750 insertions, 1486 deletions
diff --git a/apps/admin_audit/.noopenapi b/apps/admin_audit/.noopenapi new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/apps/admin_audit/.noopenapi diff --git a/apps/admin_audit/appinfo/info.xml b/apps/admin_audit/appinfo/info.xml index a11d058452d..6bdacf96a2c 100644 --- a/apps/admin_audit/appinfo/info.xml +++ b/apps/admin_audit/appinfo/info.xml @@ -1,11 +1,16 @@ <?xml version="1.0"?> +<!-- + - SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors + - SPDX-FileCopyrightText: 2016 ownCloud, Inc. + - SPDX-License-Identifier: AGPL-3.0-only +--> <info xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd"> <id>admin_audit</id> <name>Auditing / Logging</name> <summary>Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions.</summary> <description>Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions.</description> - <version>1.15.0</version> + <version>1.22.0</version> <licence>agpl</licence> <author>Nextcloud</author> <namespace>AdminAudit</namespace> @@ -15,7 +20,7 @@ <category>monitoring</category> <bugs>https://github.com/nextcloud/server/issues</bugs> <dependencies> - <nextcloud min-version="25" max-version="25"/> + <nextcloud min-version="32" max-version="32"/> </dependencies> <background-jobs> <job>OCA\AdminAudit\BackgroundJobs\Rotate</job> diff --git a/apps/admin_audit/composer/autoload.php b/apps/admin_audit/composer/autoload.php index d316fe42c51..f208c9a23a0 100644 --- a/apps/admin_audit/composer/autoload.php +++ b/apps/admin_audit/composer/autoload.php @@ -3,8 +3,21 @@ // autoload.php @generated by Composer if (PHP_VERSION_ID < 50600) { - echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; - exit(1); + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } + $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; + if (!ini_get('display_errors')) { + if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { + fwrite(STDERR, $err); + } elseif (!headers_sent()) { + echo $err; + } + } + trigger_error( + $err, + E_USER_ERROR + ); } require_once __DIR__ . '/composer/autoload_real.php'; diff --git a/apps/admin_audit/composer/composer/ClassLoader.php b/apps/admin_audit/composer/composer/ClassLoader.php index afef3fa2ad8..7824d8f7eaf 100644 --- a/apps/admin_audit/composer/composer/ClassLoader.php +++ b/apps/admin_audit/composer/composer/ClassLoader.php @@ -42,35 +42,37 @@ namespace Composer\Autoload; */ class ClassLoader { - /** @var ?string */ + /** @var \Closure(string):void */ + private static $includeFile; + + /** @var string|null */ private $vendorDir; // PSR-4 /** - * @var array[] - * @psalm-var array<string, array<string, int>> + * @var array<string, array<string, int>> */ private $prefixLengthsPsr4 = array(); /** - * @var array[] - * @psalm-var array<string, array<int, string>> + * @var array<string, list<string>> */ private $prefixDirsPsr4 = array(); /** - * @var array[] - * @psalm-var array<string, string> + * @var list<string> */ private $fallbackDirsPsr4 = array(); // PSR-0 /** - * @var array[] - * @psalm-var array<string, array<string, string[]>> + * List of PSR-0 prefixes + * + * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) + * + * @var array<string, array<string, list<string>>> */ private $prefixesPsr0 = array(); /** - * @var array[] - * @psalm-var array<string, string> + * @var list<string> */ private $fallbackDirsPsr0 = array(); @@ -78,8 +80,7 @@ class ClassLoader private $useIncludePath = false; /** - * @var string[] - * @psalm-var array<string, string> + * @var array<string, string> */ private $classMap = array(); @@ -87,29 +88,29 @@ class ClassLoader private $classMapAuthoritative = false; /** - * @var bool[] - * @psalm-var array<string, bool> + * @var array<string, bool> */ private $missingClasses = array(); - /** @var ?string */ + /** @var string|null */ private $apcuPrefix; /** - * @var self[] + * @var array<string, self> */ private static $registeredLoaders = array(); /** - * @param ?string $vendorDir + * @param string|null $vendorDir */ public function __construct($vendorDir = null) { $this->vendorDir = $vendorDir; + self::initializeIncludeClosure(); } /** - * @return string[] + * @return array<string, list<string>> */ public function getPrefixes() { @@ -121,8 +122,7 @@ class ClassLoader } /** - * @return array[] - * @psalm-return array<string, array<int, string>> + * @return array<string, list<string>> */ public function getPrefixesPsr4() { @@ -130,8 +130,7 @@ class ClassLoader } /** - * @return array[] - * @psalm-return array<string, string> + * @return list<string> */ public function getFallbackDirs() { @@ -139,8 +138,7 @@ class ClassLoader } /** - * @return array[] - * @psalm-return array<string, string> + * @return list<string> */ public function getFallbackDirsPsr4() { @@ -148,8 +146,7 @@ class ClassLoader } /** - * @return string[] Array of classname => path - * @psalm-return array<string, string> + * @return array<string, string> Array of classname => path */ public function getClassMap() { @@ -157,8 +154,7 @@ class ClassLoader } /** - * @param string[] $classMap Class to filename map - * @psalm-param array<string, string> $classMap + * @param array<string, string> $classMap Class to filename map * * @return void */ @@ -175,24 +171,25 @@ class ClassLoader * Registers a set of PSR-0 directories for a given prefix, either * appending or prepending to the ones previously set for this prefix. * - * @param string $prefix The prefix - * @param string[]|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories + * @param string $prefix The prefix + * @param list<string>|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories * * @return void */ public function add($prefix, $paths, $prepend = false) { + $paths = (array) $paths; if (!$prefix) { if ($prepend) { $this->fallbackDirsPsr0 = array_merge( - (array) $paths, + $paths, $this->fallbackDirsPsr0 ); } else { $this->fallbackDirsPsr0 = array_merge( $this->fallbackDirsPsr0, - (array) $paths + $paths ); } @@ -201,19 +198,19 @@ class ClassLoader $first = $prefix[0]; if (!isset($this->prefixesPsr0[$first][$prefix])) { - $this->prefixesPsr0[$first][$prefix] = (array) $paths; + $this->prefixesPsr0[$first][$prefix] = $paths; return; } if ($prepend) { $this->prefixesPsr0[$first][$prefix] = array_merge( - (array) $paths, + $paths, $this->prefixesPsr0[$first][$prefix] ); } else { $this->prefixesPsr0[$first][$prefix] = array_merge( $this->prefixesPsr0[$first][$prefix], - (array) $paths + $paths ); } } @@ -222,9 +219,9 @@ class ClassLoader * Registers a set of PSR-4 directories for a given namespace, either * appending or prepending to the ones previously set for this namespace. * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param string[]|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list<string>|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories * * @throws \InvalidArgumentException * @@ -232,17 +229,18 @@ class ClassLoader */ public function addPsr4($prefix, $paths, $prepend = false) { + $paths = (array) $paths; if (!$prefix) { // Register directories for the root namespace. if ($prepend) { $this->fallbackDirsPsr4 = array_merge( - (array) $paths, + $paths, $this->fallbackDirsPsr4 ); } else { $this->fallbackDirsPsr4 = array_merge( $this->fallbackDirsPsr4, - (array) $paths + $paths ); } } elseif (!isset($this->prefixDirsPsr4[$prefix])) { @@ -252,18 +250,18 @@ class ClassLoader throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); } $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; + $this->prefixDirsPsr4[$prefix] = $paths; } elseif ($prepend) { // Prepend directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( - (array) $paths, + $paths, $this->prefixDirsPsr4[$prefix] ); } else { // Append directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( $this->prefixDirsPsr4[$prefix], - (array) $paths + $paths ); } } @@ -272,8 +270,8 @@ class ClassLoader * Registers a set of PSR-0 directories for a given prefix, * replacing any others previously set for this prefix. * - * @param string $prefix The prefix - * @param string[]|string $paths The PSR-0 base directories + * @param string $prefix The prefix + * @param list<string>|string $paths The PSR-0 base directories * * @return void */ @@ -290,8 +288,8 @@ class ClassLoader * Registers a set of PSR-4 directories for a given namespace, * replacing any others previously set for this namespace. * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param string[]|string $paths The PSR-4 base directories + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list<string>|string $paths The PSR-4 base directories * * @throws \InvalidArgumentException * @@ -425,7 +423,8 @@ class ClassLoader public function loadClass($class) { if ($file = $this->findFile($class)) { - includeFile($file); + $includeFile = self::$includeFile; + $includeFile($file); return true; } @@ -476,9 +475,9 @@ class ClassLoader } /** - * Returns the currently registered loaders indexed by their corresponding vendor directories. + * Returns the currently registered loaders keyed by their corresponding vendor directories. * - * @return self[] + * @return array<string, self> */ public static function getRegisteredLoaders() { @@ -555,18 +554,26 @@ class ClassLoader return false; } -} -/** - * Scope isolated include. - * - * Prevents access to $this/self from included files. - * - * @param string $file - * @return void - * @private - */ -function includeFile($file) -{ - include $file; + /** + * @return void + */ + private static function initializeIncludeClosure() + { + if (self::$includeFile !== null) { + return; + } + + /** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + */ + self::$includeFile = \Closure::bind(static function($file) { + include $file; + }, null, null); + } } diff --git a/apps/admin_audit/composer/composer/InstalledVersions.php b/apps/admin_audit/composer/composer/InstalledVersions.php index 41bc143c114..51e734a774b 100644 --- a/apps/admin_audit/composer/composer/InstalledVersions.php +++ b/apps/admin_audit/composer/composer/InstalledVersions.php @@ -28,7 +28,7 @@ class InstalledVersions { /** * @var mixed[]|null - * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null + * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null */ private static $installed; @@ -39,7 +39,7 @@ class InstalledVersions /** * @var array[] - * @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}> + * @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}> */ private static $installedByVendor = array(); @@ -98,7 +98,7 @@ class InstalledVersions { foreach (self::getInstalled() as $installed) { if (isset($installed['versions'][$packageName])) { - return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']); + return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false; } } @@ -119,7 +119,7 @@ class InstalledVersions */ public static function satisfies(VersionParser $parser, $packageName, $constraint) { - $constraint = $parser->parseConstraints($constraint); + $constraint = $parser->parseConstraints((string) $constraint); $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); return $provided->matches($constraint); @@ -243,7 +243,7 @@ class InstalledVersions /** * @return array - * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string} + * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool} */ public static function getRootPackage() { @@ -257,7 +257,7 @@ class InstalledVersions * * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. * @return array[] - * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} + * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} */ public static function getRawData() { @@ -280,7 +280,7 @@ class InstalledVersions * Returns the raw data of all installed.php which are currently loaded for custom implementations * * @return array[] - * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}> + * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}> */ public static function getAllRawData() { @@ -303,7 +303,7 @@ class InstalledVersions * @param array[] $data A vendor/composer/installed.php data set * @return void * - * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data + * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data */ public static function reload($data) { @@ -313,7 +313,7 @@ class InstalledVersions /** * @return array[] - * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}> + * @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}> */ private static function getInstalled() { @@ -328,7 +328,9 @@ class InstalledVersions if (isset(self::$installedByVendor[$vendorDir])) { $installed[] = self::$installedByVendor[$vendorDir]; } elseif (is_file($vendorDir.'/composer/installed.php')) { - $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */ + $required = require $vendorDir.'/composer/installed.php'; + $installed[] = self::$installedByVendor[$vendorDir] = $required; if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { self::$installed = $installed[count($installed) - 1]; } @@ -340,12 +342,17 @@ class InstalledVersions // only require the installed.php file if this file is loaded from its dumped location, // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 if (substr(__DIR__, -8, 1) !== 'C') { - self::$installed = require __DIR__ . '/installed.php'; + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */ + $required = require __DIR__ . '/installed.php'; + self::$installed = $required; } else { self::$installed = array(); } } - $installed[] = self::$installed; + + if (self::$installed !== array()) { + $installed[] = self::$installed; + } return $installed; } diff --git a/apps/admin_audit/composer/composer/autoload_classmap.php b/apps/admin_audit/composer/composer/autoload_classmap.php index fc4be52ebbb..b67d90e7689 100644 --- a/apps/admin_audit/composer/composer/autoload_classmap.php +++ b/apps/admin_audit/composer/composer/autoload_classmap.php @@ -8,19 +8,22 @@ $baseDir = $vendorDir; return array( 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', 'OCA\\AdminAudit\\Actions\\Action' => $baseDir . '/../lib/Actions/Action.php', - 'OCA\\AdminAudit\\Actions\\AppManagement' => $baseDir . '/../lib/Actions/AppManagement.php', - 'OCA\\AdminAudit\\Actions\\Auth' => $baseDir . '/../lib/Actions/Auth.php', - 'OCA\\AdminAudit\\Actions\\Console' => $baseDir . '/../lib/Actions/Console.php', 'OCA\\AdminAudit\\Actions\\Files' => $baseDir . '/../lib/Actions/Files.php', - 'OCA\\AdminAudit\\Actions\\GroupManagement' => $baseDir . '/../lib/Actions/GroupManagement.php', - 'OCA\\AdminAudit\\Actions\\Security' => $baseDir . '/../lib/Actions/Security.php', 'OCA\\AdminAudit\\Actions\\Sharing' => $baseDir . '/../lib/Actions/Sharing.php', + 'OCA\\AdminAudit\\Actions\\TagManagement' => $baseDir . '/../lib/Actions/TagManagement.php', 'OCA\\AdminAudit\\Actions\\Trashbin' => $baseDir . '/../lib/Actions/Trashbin.php', - 'OCA\\AdminAudit\\Actions\\UserManagement' => $baseDir . '/../lib/Actions/UserManagement.php', 'OCA\\AdminAudit\\Actions\\Versions' => $baseDir . '/../lib/Actions/Versions.php', 'OCA\\AdminAudit\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php', 'OCA\\AdminAudit\\AuditLogger' => $baseDir . '/../lib/AuditLogger.php', 'OCA\\AdminAudit\\BackgroundJobs\\Rotate' => $baseDir . '/../lib/BackgroundJobs/Rotate.php', 'OCA\\AdminAudit\\IAuditLogger' => $baseDir . '/../lib/IAuditLogger.php', + 'OCA\\AdminAudit\\Listener\\AppManagementEventListener' => $baseDir . '/../lib/Listener/AppManagementEventListener.php', + 'OCA\\AdminAudit\\Listener\\AuthEventListener' => $baseDir . '/../lib/Listener/AuthEventListener.php', + 'OCA\\AdminAudit\\Listener\\ConsoleEventListener' => $baseDir . '/../lib/Listener/ConsoleEventListener.php', 'OCA\\AdminAudit\\Listener\\CriticalActionPerformedEventListener' => $baseDir . '/../lib/Listener/CriticalActionPerformedEventListener.php', + 'OCA\\AdminAudit\\Listener\\FileEventListener' => $baseDir . '/../lib/Listener/FileEventListener.php', + 'OCA\\AdminAudit\\Listener\\GroupManagementEventListener' => $baseDir . '/../lib/Listener/GroupManagementEventListener.php', + 'OCA\\AdminAudit\\Listener\\SecurityEventListener' => $baseDir . '/../lib/Listener/SecurityEventListener.php', + 'OCA\\AdminAudit\\Listener\\SharingEventListener' => $baseDir . '/../lib/Listener/SharingEventListener.php', + 'OCA\\AdminAudit\\Listener\\UserManagementEventListener' => $baseDir . '/../lib/Listener/UserManagementEventListener.php', ); diff --git a/apps/admin_audit/composer/composer/autoload_static.php b/apps/admin_audit/composer/composer/autoload_static.php index 38518c8a9ba..f8fd457edd8 100644 --- a/apps/admin_audit/composer/composer/autoload_static.php +++ b/apps/admin_audit/composer/composer/autoload_static.php @@ -23,21 +23,24 @@ class ComposerStaticInitAdminAudit public static $classMap = array ( 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', 'OCA\\AdminAudit\\Actions\\Action' => __DIR__ . '/..' . '/../lib/Actions/Action.php', - 'OCA\\AdminAudit\\Actions\\AppManagement' => __DIR__ . '/..' . '/../lib/Actions/AppManagement.php', - 'OCA\\AdminAudit\\Actions\\Auth' => __DIR__ . '/..' . '/../lib/Actions/Auth.php', - 'OCA\\AdminAudit\\Actions\\Console' => __DIR__ . '/..' . '/../lib/Actions/Console.php', 'OCA\\AdminAudit\\Actions\\Files' => __DIR__ . '/..' . '/../lib/Actions/Files.php', - 'OCA\\AdminAudit\\Actions\\GroupManagement' => __DIR__ . '/..' . '/../lib/Actions/GroupManagement.php', - 'OCA\\AdminAudit\\Actions\\Security' => __DIR__ . '/..' . '/../lib/Actions/Security.php', 'OCA\\AdminAudit\\Actions\\Sharing' => __DIR__ . '/..' . '/../lib/Actions/Sharing.php', + 'OCA\\AdminAudit\\Actions\\TagManagement' => __DIR__ . '/..' . '/../lib/Actions/TagManagement.php', 'OCA\\AdminAudit\\Actions\\Trashbin' => __DIR__ . '/..' . '/../lib/Actions/Trashbin.php', - 'OCA\\AdminAudit\\Actions\\UserManagement' => __DIR__ . '/..' . '/../lib/Actions/UserManagement.php', 'OCA\\AdminAudit\\Actions\\Versions' => __DIR__ . '/..' . '/../lib/Actions/Versions.php', 'OCA\\AdminAudit\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php', 'OCA\\AdminAudit\\AuditLogger' => __DIR__ . '/..' . '/../lib/AuditLogger.php', 'OCA\\AdminAudit\\BackgroundJobs\\Rotate' => __DIR__ . '/..' . '/../lib/BackgroundJobs/Rotate.php', 'OCA\\AdminAudit\\IAuditLogger' => __DIR__ . '/..' . '/../lib/IAuditLogger.php', + 'OCA\\AdminAudit\\Listener\\AppManagementEventListener' => __DIR__ . '/..' . '/../lib/Listener/AppManagementEventListener.php', + 'OCA\\AdminAudit\\Listener\\AuthEventListener' => __DIR__ . '/..' . '/../lib/Listener/AuthEventListener.php', + 'OCA\\AdminAudit\\Listener\\ConsoleEventListener' => __DIR__ . '/..' . '/../lib/Listener/ConsoleEventListener.php', 'OCA\\AdminAudit\\Listener\\CriticalActionPerformedEventListener' => __DIR__ . '/..' . '/../lib/Listener/CriticalActionPerformedEventListener.php', + 'OCA\\AdminAudit\\Listener\\FileEventListener' => __DIR__ . '/..' . '/../lib/Listener/FileEventListener.php', + 'OCA\\AdminAudit\\Listener\\GroupManagementEventListener' => __DIR__ . '/..' . '/../lib/Listener/GroupManagementEventListener.php', + 'OCA\\AdminAudit\\Listener\\SecurityEventListener' => __DIR__ . '/..' . '/../lib/Listener/SecurityEventListener.php', + 'OCA\\AdminAudit\\Listener\\SharingEventListener' => __DIR__ . '/..' . '/../lib/Listener/SharingEventListener.php', + 'OCA\\AdminAudit\\Listener\\UserManagementEventListener' => __DIR__ . '/..' . '/../lib/Listener/UserManagementEventListener.php', ); public static function getInitializer(ClassLoader $loader) diff --git a/apps/admin_audit/composer/composer/installed.php b/apps/admin_audit/composer/composer/installed.php index 5440719fa40..1a66c7f2416 100644 --- a/apps/admin_audit/composer/composer/installed.php +++ b/apps/admin_audit/composer/composer/installed.php @@ -1,22 +1,22 @@ <?php return array( 'root' => array( + 'name' => '__root__', 'pretty_version' => 'dev-master', 'version' => 'dev-master', + 'reference' => 'b1797842784b250fb01ed5e3bf130705eb94751b', 'type' => 'library', 'install_path' => __DIR__ . '/../', 'aliases' => array(), - 'reference' => 'c6429e6cd19c57582364338362e543580821cf99', - 'name' => '__root__', 'dev' => false, ), 'versions' => array( '__root__' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', + 'reference' => 'b1797842784b250fb01ed5e3bf130705eb94751b', 'type' => 'library', 'install_path' => __DIR__ . '/../', 'aliases' => array(), - 'reference' => 'c6429e6cd19c57582364338362e543580821cf99', 'dev_requirement' => false, ), ), diff --git a/apps/admin_audit/l10n/ar.js b/apps/admin_audit/l10n/ar.js index b90808ff3ec..82932460e9a 100644 --- a/apps/admin_audit/l10n/ar.js +++ b/apps/admin_audit/l10n/ar.js @@ -1,7 +1,7 @@ OC.L10N.register( "admin_audit", { - "Auditing / Logging" : "التدقيق / السجلات", - "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "خاصية سجلات المراقبة لـ نكست كلاود مثل الوصول إلى سجلات الملفات أو المعلومات الحساسة الاخرى." + "Auditing / Logging" : "تدقيق / تسجيل", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "تُوفِّر إمكانيات تسجيل و مراجعة سجل الحركات على نكست كلاود." }, "nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;"); diff --git a/apps/admin_audit/l10n/ar.json b/apps/admin_audit/l10n/ar.json index 2af244c1fb0..04c76c3ba51 100644 --- a/apps/admin_audit/l10n/ar.json +++ b/apps/admin_audit/l10n/ar.json @@ -1,5 +1,5 @@ { "translations": { - "Auditing / Logging" : "التدقيق / السجلات", - "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "خاصية سجلات المراقبة لـ نكست كلاود مثل الوصول إلى سجلات الملفات أو المعلومات الحساسة الاخرى." + "Auditing / Logging" : "تدقيق / تسجيل", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "تُوفِّر إمكانيات تسجيل و مراجعة سجل الحركات على نكست كلاود." },"pluralForm" :"nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;" }
\ No newline at end of file diff --git a/apps/admin_audit/l10n/ast.js b/apps/admin_audit/l10n/ast.js new file mode 100644 index 00000000000..862f01ddb6d --- /dev/null +++ b/apps/admin_audit/l10n/ast.js @@ -0,0 +1,7 @@ +OC.L10N.register( + "admin_audit", + { + "Auditing / Logging" : "Auditoría / Rexistru", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Forne la capacidá de rexistrar, por exemplu, l'accesu a los ficheros o a otres aiciones sensibles de Nextcloud" +}, +"nplurals=2; plural=(n != 1);"); diff --git a/apps/admin_audit/l10n/ast.json b/apps/admin_audit/l10n/ast.json new file mode 100644 index 00000000000..61715be4851 --- /dev/null +++ b/apps/admin_audit/l10n/ast.json @@ -0,0 +1,5 @@ +{ "translations": { + "Auditing / Logging" : "Auditoría / Rexistru", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Forne la capacidá de rexistrar, por exemplu, l'accesu a los ficheros o a otres aiciones sensibles de Nextcloud" +},"pluralForm" :"nplurals=2; plural=(n != 1);" +}
\ No newline at end of file diff --git a/apps/admin_audit/l10n/az.js b/apps/admin_audit/l10n/az.js new file mode 100644 index 00000000000..6cd20e408bd --- /dev/null +++ b/apps/admin_audit/l10n/az.js @@ -0,0 +1,7 @@ +OC.L10N.register( + "admin_audit", + { + "Auditing / Logging" : "Audit / Giriş", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Nextcloud üçün fayl girişləri və ya başqa həssas hərəkətlər kimi giriş imkanlarını təmin edir." +}, +"nplurals=2; plural=(n != 1);"); diff --git a/apps/admin_audit/l10n/az.json b/apps/admin_audit/l10n/az.json new file mode 100644 index 00000000000..a0d4cdaa80d --- /dev/null +++ b/apps/admin_audit/l10n/az.json @@ -0,0 +1,5 @@ +{ "translations": { + "Auditing / Logging" : "Audit / Giriş", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Nextcloud üçün fayl girişləri və ya başqa həssas hərəkətlər kimi giriş imkanlarını təmin edir." +},"pluralForm" :"nplurals=2; plural=(n != 1);" +}
\ No newline at end of file diff --git a/apps/admin_audit/l10n/be.js b/apps/admin_audit/l10n/be.js new file mode 100644 index 00000000000..bb52accdf5c --- /dev/null +++ b/apps/admin_audit/l10n/be.js @@ -0,0 +1,7 @@ +OC.L10N.register( + "admin_audit", + { + "Auditing / Logging" : "Аўдыт / Журнал", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Прадастаўляе магчымасці вядзення журнала дзенняў для Nextcloud, такіх як доступ да файлаў або іншых канфідэнцыйных дзеянняў." +}, +"nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);"); diff --git a/apps/admin_audit/l10n/be.json b/apps/admin_audit/l10n/be.json new file mode 100644 index 00000000000..6b36dae579b --- /dev/null +++ b/apps/admin_audit/l10n/be.json @@ -0,0 +1,5 @@ +{ "translations": { + "Auditing / Logging" : "Аўдыт / Журнал", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Прадастаўляе магчымасці вядзення журнала дзенняў для Nextcloud, такіх як доступ да файлаў або іншых канфідэнцыйных дзеянняў." +},"pluralForm" :"nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);" +}
\ No newline at end of file diff --git a/apps/admin_audit/l10n/bg.js b/apps/admin_audit/l10n/bg.js index cd82e96ec73..2769c6899f8 100644 --- a/apps/admin_audit/l10n/bg.js +++ b/apps/admin_audit/l10n/bg.js @@ -1,7 +1,7 @@ OC.L10N.register( "admin_audit", { - "Auditing / Logging" : "Одитиране/създаване на регистри", - "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Предоставя възможности за регистриране в Nextcloud, като например достъп до файлове за регистриране или други чувствителни действия." + "Auditing / Logging" : "Одитиране / Регистри на действията", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Предоставя възможности за създаване на регистри на действията в \"Nextcloud\", като например кой е осъществил достъп до файл или други действия." }, "nplurals=2; plural=(n != 1);"); diff --git a/apps/admin_audit/l10n/bg.json b/apps/admin_audit/l10n/bg.json index 770ffcbf35a..4d3ac67c0a6 100644 --- a/apps/admin_audit/l10n/bg.json +++ b/apps/admin_audit/l10n/bg.json @@ -1,5 +1,5 @@ { "translations": { - "Auditing / Logging" : "Одитиране/създаване на регистри", - "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Предоставя възможности за регистриране в Nextcloud, като например достъп до файлове за регистриране или други чувствителни действия." + "Auditing / Logging" : "Одитиране / Регистри на действията", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Предоставя възможности за създаване на регистри на действията в \"Nextcloud\", като например кой е осъществил достъп до файл или други действия." },"pluralForm" :"nplurals=2; plural=(n != 1);" }
\ No newline at end of file diff --git a/apps/admin_audit/l10n/br.js b/apps/admin_audit/l10n/br.js new file mode 100644 index 00000000000..3190748725a --- /dev/null +++ b/apps/admin_audit/l10n/br.js @@ -0,0 +1,6 @@ +OC.L10N.register( + "admin_audit", + { + "Auditing / Logging" : "Aodit / Kerzhlevr" +}, +"nplurals=5; plural=((n%10 == 1) && (n%100 != 11) && (n%100 !=71) && (n%100 !=91) ? 0 :(n%10 == 2) && (n%100 != 12) && (n%100 !=72) && (n%100 !=92) ? 1 :(n%10 ==3 || n%10==4 || n%10==9) && (n%100 < 10 || n% 100 > 19) && (n%100 < 70 || n%100 > 79) && (n%100 < 90 || n%100 > 99) ? 2 :(n != 0 && n % 1000000 == 0) ? 3 : 4);"); diff --git a/apps/admin_audit/l10n/br.json b/apps/admin_audit/l10n/br.json new file mode 100644 index 00000000000..b70638a3de0 --- /dev/null +++ b/apps/admin_audit/l10n/br.json @@ -0,0 +1,4 @@ +{ "translations": { + "Auditing / Logging" : "Aodit / Kerzhlevr" +},"pluralForm" :"nplurals=5; plural=((n%10 == 1) && (n%100 != 11) && (n%100 !=71) && (n%100 !=91) ? 0 :(n%10 == 2) && (n%100 != 12) && (n%100 !=72) && (n%100 !=92) ? 1 :(n%10 ==3 || n%10==4 || n%10==9) && (n%100 < 10 || n% 100 > 19) && (n%100 < 70 || n%100 > 79) && (n%100 < 90 || n%100 > 99) ? 2 :(n != 0 && n % 1000000 == 0) ? 3 : 4);" +}
\ No newline at end of file diff --git a/apps/admin_audit/l10n/cy_GB.js b/apps/admin_audit/l10n/cy_GB.js new file mode 100644 index 00000000000..1ee3a47ad75 --- /dev/null +++ b/apps/admin_audit/l10n/cy_GB.js @@ -0,0 +1,7 @@ +OC.L10N.register( + "admin_audit", + { + "Auditing / Logging" : "Archwilio / Cofnodi", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Yn darparu galluoedd cofnodi ar gyfer Nextcloud megis cofnodi mynediadau ffeiliau neu gamau gweithredu sensitif." +}, +"nplurals=4; plural=(n==1) ? 0 : (n==2) ? 1 : (n != 8 && n != 11) ? 2 : 3;"); diff --git a/apps/admin_audit/l10n/cy_GB.json b/apps/admin_audit/l10n/cy_GB.json new file mode 100644 index 00000000000..4f4e0ac3be5 --- /dev/null +++ b/apps/admin_audit/l10n/cy_GB.json @@ -0,0 +1,5 @@ +{ "translations": { + "Auditing / Logging" : "Archwilio / Cofnodi", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Yn darparu galluoedd cofnodi ar gyfer Nextcloud megis cofnodi mynediadau ffeiliau neu gamau gweithredu sensitif." +},"pluralForm" :"nplurals=4; plural=(n==1) ? 0 : (n==2) ? 1 : (n != 8 && n != 11) ? 2 : 3;" +}
\ No newline at end of file diff --git a/apps/admin_audit/l10n/da.js b/apps/admin_audit/l10n/da.js index d8cecb417d2..99e338c5cb2 100644 --- a/apps/admin_audit/l10n/da.js +++ b/apps/admin_audit/l10n/da.js @@ -1,7 +1,7 @@ OC.L10N.register( "admin_audit", { - "Auditing / Logging" : "Revision/Logning", + "Auditing / Logging" : "Revision / Logning", "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Bidrager med lognings funktionalitet til Nextcloud, såsom logning af fil tilgang eller andre sensitive handlinger" }, "nplurals=2; plural=(n != 1);"); diff --git a/apps/admin_audit/l10n/da.json b/apps/admin_audit/l10n/da.json index 1a41591f598..6c91db76c71 100644 --- a/apps/admin_audit/l10n/da.json +++ b/apps/admin_audit/l10n/da.json @@ -1,5 +1,5 @@ { "translations": { - "Auditing / Logging" : "Revision/Logning", + "Auditing / Logging" : "Revision / Logning", "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Bidrager med lognings funktionalitet til Nextcloud, såsom logning af fil tilgang eller andre sensitive handlinger" },"pluralForm" :"nplurals=2; plural=(n != 1);" }
\ No newline at end of file diff --git a/apps/admin_audit/l10n/de.js b/apps/admin_audit/l10n/de.js index a1a76aee7b6..fadf5a18e91 100644 --- a/apps/admin_audit/l10n/de.js +++ b/apps/admin_audit/l10n/de.js @@ -1,7 +1,7 @@ OC.L10N.register( "admin_audit", { - "Auditing / Logging" : "Auditieren / Protokollieren", + "Auditing / Logging" : "Auditieren/Protokollieren", "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Stellt Protokollierungsfunktionen für Nextcloud zur Verfügung wie Dateizugriffe oder andere vertrauliche Aktionen." }, "nplurals=2; plural=(n != 1);"); diff --git a/apps/admin_audit/l10n/de.json b/apps/admin_audit/l10n/de.json index 7a55fd1457a..7dbf404aa65 100644 --- a/apps/admin_audit/l10n/de.json +++ b/apps/admin_audit/l10n/de.json @@ -1,5 +1,5 @@ { "translations": { - "Auditing / Logging" : "Auditieren / Protokollieren", + "Auditing / Logging" : "Auditieren/Protokollieren", "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Stellt Protokollierungsfunktionen für Nextcloud zur Verfügung wie Dateizugriffe oder andere vertrauliche Aktionen." },"pluralForm" :"nplurals=2; plural=(n != 1);" }
\ No newline at end of file diff --git a/apps/admin_audit/l10n/eo.js b/apps/admin_audit/l10n/eo.js new file mode 100644 index 00000000000..17becacc88e --- /dev/null +++ b/apps/admin_audit/l10n/eo.js @@ -0,0 +1,7 @@ +OC.L10N.register( + "admin_audit", + { + "Auditing / Logging" : "Ekzamenado / Protokolado", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Ebligas protokoladon, ekzemple protokolado de aliroj al dosieroj aŭ aliaj delikataj agoj." +}, +"nplurals=2; plural=(n != 1);"); diff --git a/apps/admin_audit/l10n/eo.json b/apps/admin_audit/l10n/eo.json new file mode 100644 index 00000000000..293d8cce025 --- /dev/null +++ b/apps/admin_audit/l10n/eo.json @@ -0,0 +1,5 @@ +{ "translations": { + "Auditing / Logging" : "Ekzamenado / Protokolado", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Ebligas protokoladon, ekzemple protokolado de aliroj al dosieroj aŭ aliaj delikataj agoj." +},"pluralForm" :"nplurals=2; plural=(n != 1);" +}
\ No newline at end of file diff --git a/apps/admin_audit/l10n/es.js b/apps/admin_audit/l10n/es.js index aa0c641209c..7b31da2f983 100644 --- a/apps/admin_audit/l10n/es.js +++ b/apps/admin_audit/l10n/es.js @@ -4,4 +4,4 @@ OC.L10N.register( "Auditing / Logging" : "Auditoría / Registro", "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Ofrece a Nextcloud capacidades de registro tales como registrar los accesos a archivos u otras acciones sensibles." }, -"nplurals=2; plural=(n != 1);"); +"nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;"); diff --git a/apps/admin_audit/l10n/es.json b/apps/admin_audit/l10n/es.json index b34ee67f6b7..fbab4d86643 100644 --- a/apps/admin_audit/l10n/es.json +++ b/apps/admin_audit/l10n/es.json @@ -1,5 +1,5 @@ { "translations": { "Auditing / Logging" : "Auditoría / Registro", "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Ofrece a Nextcloud capacidades de registro tales como registrar los accesos a archivos u otras acciones sensibles." -},"pluralForm" :"nplurals=2; plural=(n != 1);" +},"pluralForm" :"nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;" }
\ No newline at end of file diff --git a/apps/admin_audit/l10n/es_AR.js b/apps/admin_audit/l10n/es_AR.js index 5ff10c5d3d1..a978b6fd112 100644 --- a/apps/admin_audit/l10n/es_AR.js +++ b/apps/admin_audit/l10n/es_AR.js @@ -4,4 +4,4 @@ OC.L10N.register( "Auditing / Logging" : "Auditando / Logueando", "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Proporciona capacidades de registro para Nextcloud, como el acceso a archivos de registro o acciones sensibles." }, -"nplurals=2; plural=(n != 1);"); +"nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;"); diff --git a/apps/admin_audit/l10n/es_AR.json b/apps/admin_audit/l10n/es_AR.json index 17c1e49d704..23d75328c3a 100644 --- a/apps/admin_audit/l10n/es_AR.json +++ b/apps/admin_audit/l10n/es_AR.json @@ -1,5 +1,5 @@ { "translations": { "Auditing / Logging" : "Auditando / Logueando", "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Proporciona capacidades de registro para Nextcloud, como el acceso a archivos de registro o acciones sensibles." -},"pluralForm" :"nplurals=2; plural=(n != 1);" +},"pluralForm" :"nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;" }
\ No newline at end of file diff --git a/apps/admin_audit/l10n/es_CL.js b/apps/admin_audit/l10n/es_CL.js new file mode 100644 index 00000000000..f39d29b3ea7 --- /dev/null +++ b/apps/admin_audit/l10n/es_CL.js @@ -0,0 +1,7 @@ +OC.L10N.register( + "admin_audit", + { + "Auditing / Logging" : "Auditoría / Registro", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Proporciona capacidades de registro para Nextcloud, como el registro de accesos a archivos o acciones confidenciales." +}, +"nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;"); diff --git a/apps/admin_audit/l10n/es_CL.json b/apps/admin_audit/l10n/es_CL.json new file mode 100644 index 00000000000..4fb9f38c21f --- /dev/null +++ b/apps/admin_audit/l10n/es_CL.json @@ -0,0 +1,5 @@ +{ "translations": { + "Auditing / Logging" : "Auditoría / Registro", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Proporciona capacidades de registro para Nextcloud, como el registro de accesos a archivos o acciones confidenciales." +},"pluralForm" :"nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;" +}
\ No newline at end of file diff --git a/apps/admin_audit/l10n/es_CO.js b/apps/admin_audit/l10n/es_CO.js index e9232163cb6..3d19eb30c2f 100644 --- a/apps/admin_audit/l10n/es_CO.js +++ b/apps/admin_audit/l10n/es_CO.js @@ -4,4 +4,4 @@ OC.L10N.register( "Auditing / Logging" : "Auditoría / Registro", "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Proporciona capacidades de registro para Nextcloud, como el acceso a archivos de registro o acciones sensibles." }, -"nplurals=2; plural=(n != 1);"); +"nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;"); diff --git a/apps/admin_audit/l10n/es_CO.json b/apps/admin_audit/l10n/es_CO.json index 1af0b9da6bb..aa059be08ae 100644 --- a/apps/admin_audit/l10n/es_CO.json +++ b/apps/admin_audit/l10n/es_CO.json @@ -1,5 +1,5 @@ { "translations": { "Auditing / Logging" : "Auditoría / Registro", "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Proporciona capacidades de registro para Nextcloud, como el acceso a archivos de registro o acciones sensibles." -},"pluralForm" :"nplurals=2; plural=(n != 1);" +},"pluralForm" :"nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;" }
\ No newline at end of file diff --git a/apps/admin_audit/l10n/es_CR.js b/apps/admin_audit/l10n/es_CR.js new file mode 100644 index 00000000000..a051b8053d3 --- /dev/null +++ b/apps/admin_audit/l10n/es_CR.js @@ -0,0 +1,7 @@ +OC.L10N.register( + "admin_audit", + { + "Auditing / Logging" : "Auditoría / Registros", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Proporciona capacidades de registro para Nextcloud, como el registro de accesos a archivos o acciones sensibles." +}, +"nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;"); diff --git a/apps/admin_audit/l10n/es_CR.json b/apps/admin_audit/l10n/es_CR.json new file mode 100644 index 00000000000..00a101b11b8 --- /dev/null +++ b/apps/admin_audit/l10n/es_CR.json @@ -0,0 +1,5 @@ +{ "translations": { + "Auditing / Logging" : "Auditoría / Registros", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Proporciona capacidades de registro para Nextcloud, como el registro de accesos a archivos o acciones sensibles." +},"pluralForm" :"nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;" +}
\ No newline at end of file diff --git a/apps/admin_audit/l10n/es_DO.js b/apps/admin_audit/l10n/es_DO.js index e9232163cb6..3d19eb30c2f 100644 --- a/apps/admin_audit/l10n/es_DO.js +++ b/apps/admin_audit/l10n/es_DO.js @@ -4,4 +4,4 @@ OC.L10N.register( "Auditing / Logging" : "Auditoría / Registro", "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Proporciona capacidades de registro para Nextcloud, como el acceso a archivos de registro o acciones sensibles." }, -"nplurals=2; plural=(n != 1);"); +"nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;"); diff --git a/apps/admin_audit/l10n/es_DO.json b/apps/admin_audit/l10n/es_DO.json index 1af0b9da6bb..aa059be08ae 100644 --- a/apps/admin_audit/l10n/es_DO.json +++ b/apps/admin_audit/l10n/es_DO.json @@ -1,5 +1,5 @@ { "translations": { "Auditing / Logging" : "Auditoría / Registro", "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Proporciona capacidades de registro para Nextcloud, como el acceso a archivos de registro o acciones sensibles." -},"pluralForm" :"nplurals=2; plural=(n != 1);" +},"pluralForm" :"nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;" }
\ No newline at end of file diff --git a/apps/admin_audit/l10n/es_EC.js b/apps/admin_audit/l10n/es_EC.js new file mode 100644 index 00000000000..f39d29b3ea7 --- /dev/null +++ b/apps/admin_audit/l10n/es_EC.js @@ -0,0 +1,7 @@ +OC.L10N.register( + "admin_audit", + { + "Auditing / Logging" : "Auditoría / Registro", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Proporciona capacidades de registro para Nextcloud, como el registro de accesos a archivos o acciones confidenciales." +}, +"nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;"); diff --git a/apps/admin_audit/l10n/es_EC.json b/apps/admin_audit/l10n/es_EC.json new file mode 100644 index 00000000000..4fb9f38c21f --- /dev/null +++ b/apps/admin_audit/l10n/es_EC.json @@ -0,0 +1,5 @@ +{ "translations": { + "Auditing / Logging" : "Auditoría / Registro", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Proporciona capacidades de registro para Nextcloud, como el registro de accesos a archivos o acciones confidenciales." +},"pluralForm" :"nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;" +}
\ No newline at end of file diff --git a/apps/admin_audit/l10n/es_MX.js b/apps/admin_audit/l10n/es_MX.js index 61766ce7915..02a4e01c33d 100644 --- a/apps/admin_audit/l10n/es_MX.js +++ b/apps/admin_audit/l10n/es_MX.js @@ -2,6 +2,6 @@ OC.L10N.register( "admin_audit", { "Auditing / Logging" : "Auditoría / Registros", - "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Habilita las opciones de bitácora de Nextcloud tales como registro de acceso a archivos o de acciones delicadas." + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Proporciona capacidades de registro para Nextcloud, tales como el registro de accesos a archivos o de acciones delicadas." }, -"nplurals=2; plural=(n != 1);"); +"nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;"); diff --git a/apps/admin_audit/l10n/es_MX.json b/apps/admin_audit/l10n/es_MX.json index 61f0d5f38cc..2f483b93cf0 100644 --- a/apps/admin_audit/l10n/es_MX.json +++ b/apps/admin_audit/l10n/es_MX.json @@ -1,5 +1,5 @@ { "translations": { "Auditing / Logging" : "Auditoría / Registros", - "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Habilita las opciones de bitácora de Nextcloud tales como registro de acceso a archivos o de acciones delicadas." -},"pluralForm" :"nplurals=2; plural=(n != 1);" + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Proporciona capacidades de registro para Nextcloud, tales como el registro de accesos a archivos o de acciones delicadas." +},"pluralForm" :"nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;" }
\ No newline at end of file diff --git a/apps/admin_audit/l10n/eu.js b/apps/admin_audit/l10n/eu.js index 1340bd61767..b71c2183f90 100644 --- a/apps/admin_audit/l10n/eu.js +++ b/apps/admin_audit/l10n/eu.js @@ -2,6 +2,6 @@ OC.L10N.register( "admin_audit", { "Auditing / Logging" : "Auditoretza / Erregistroa", - "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Nextcloud-i gaitasuna ematen dio, adibidez, fitxategien atzipenak edo bestelako ekintza babesgarriak erregistratzeko." + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Nextcloudi gaitasuna ematen dio, adibidez, saio-hasiera fitxategiak atzitzeko edo beste kontuzko ekintza batzuetarako." }, "nplurals=2; plural=(n != 1);"); diff --git a/apps/admin_audit/l10n/eu.json b/apps/admin_audit/l10n/eu.json index f4350e60eee..24dffe45273 100644 --- a/apps/admin_audit/l10n/eu.json +++ b/apps/admin_audit/l10n/eu.json @@ -1,5 +1,5 @@ { "translations": { "Auditing / Logging" : "Auditoretza / Erregistroa", - "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Nextcloud-i gaitasuna ematen dio, adibidez, fitxategien atzipenak edo bestelako ekintza babesgarriak erregistratzeko." + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Nextcloudi gaitasuna ematen dio, adibidez, saio-hasiera fitxategiak atzitzeko edo beste kontuzko ekintza batzuetarako." },"pluralForm" :"nplurals=2; plural=(n != 1);" }
\ No newline at end of file diff --git a/apps/admin_audit/l10n/fr.js b/apps/admin_audit/l10n/fr.js index 31f8de41cf8..e44fbce045e 100644 --- a/apps/admin_audit/l10n/fr.js +++ b/apps/admin_audit/l10n/fr.js @@ -1,7 +1,7 @@ OC.L10N.register( "admin_audit", { - "Auditing / Logging" : "Audit / journalisation", - "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Fournit des capacités de journalisation pour Nextcloud telles que l'enregistrement des accès aux fichiers ou d'autres actions sensibles." + "Auditing / Logging" : "Audit / Journalisation", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Fournit des capacités de journalisation pour Nextcloud, telles que la journalisation des accès aux fichiers ou d’autres actions sensibles." }, -"nplurals=2; plural=(n > 1);"); +"nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;"); diff --git a/apps/admin_audit/l10n/fr.json b/apps/admin_audit/l10n/fr.json index 2cd134664f3..5c2205ed460 100644 --- a/apps/admin_audit/l10n/fr.json +++ b/apps/admin_audit/l10n/fr.json @@ -1,5 +1,5 @@ { "translations": { - "Auditing / Logging" : "Audit / journalisation", - "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Fournit des capacités de journalisation pour Nextcloud telles que l'enregistrement des accès aux fichiers ou d'autres actions sensibles." -},"pluralForm" :"nplurals=2; plural=(n > 1);" + "Auditing / Logging" : "Audit / Journalisation", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Fournit des capacités de journalisation pour Nextcloud, telles que la journalisation des accès aux fichiers ou d’autres actions sensibles." +},"pluralForm" :"nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;" }
\ No newline at end of file diff --git a/apps/admin_audit/l10n/ga.js b/apps/admin_audit/l10n/ga.js new file mode 100644 index 00000000000..e1114fc18aa --- /dev/null +++ b/apps/admin_audit/l10n/ga.js @@ -0,0 +1,7 @@ +OC.L10N.register( + "admin_audit", + { + "Auditing / Logging" : "Iniúchóireacht / Logáil", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Soláthraíonn sé cumais logála do Nextcloud, cosúil le rochtain ar chomhaid nó gníomhartha íogaire eile a logáil." +}, +"nplurals=5; plural=(n==1 ? 0 : n==2 ? 1 : n<7 ? 2 : n<11 ? 3 : 4);"); diff --git a/apps/admin_audit/l10n/ga.json b/apps/admin_audit/l10n/ga.json new file mode 100644 index 00000000000..5864c9faef5 --- /dev/null +++ b/apps/admin_audit/l10n/ga.json @@ -0,0 +1,5 @@ +{ "translations": { + "Auditing / Logging" : "Iniúchóireacht / Logáil", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Soláthraíonn sé cumais logála do Nextcloud, cosúil le rochtain ar chomhaid nó gníomhartha íogaire eile a logáil." +},"pluralForm" :"nplurals=5; plural=(n==1 ? 0 : n==2 ? 1 : n<7 ? 2 : n<11 ? 3 : 4);" +}
\ No newline at end of file diff --git a/apps/admin_audit/l10n/gl.js b/apps/admin_audit/l10n/gl.js index 24d085532a4..114c760a5ea 100644 --- a/apps/admin_audit/l10n/gl.js +++ b/apps/admin_audit/l10n/gl.js @@ -2,6 +2,6 @@ OC.L10N.register( "admin_audit", { "Auditing / Logging" : "Auditoría / Rexistro", - "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Fornece recursos de rexistro para o Nextcloud como rexistros de acceso a ficheiros ou calquera outra acción sensíbel." + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Fornece recursos de rexistro para Nextcloud como rexistros de acceso a ficheiros ou calquera outra acción sensíbel." }, "nplurals=2; plural=(n != 1);"); diff --git a/apps/admin_audit/l10n/gl.json b/apps/admin_audit/l10n/gl.json index bcfc4ecb0f1..187504dcdca 100644 --- a/apps/admin_audit/l10n/gl.json +++ b/apps/admin_audit/l10n/gl.json @@ -1,5 +1,5 @@ { "translations": { "Auditing / Logging" : "Auditoría / Rexistro", - "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Fornece recursos de rexistro para o Nextcloud como rexistros de acceso a ficheiros ou calquera outra acción sensíbel." + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Fornece recursos de rexistro para Nextcloud como rexistros de acceso a ficheiros ou calquera outra acción sensíbel." },"pluralForm" :"nplurals=2; plural=(n != 1);" }
\ No newline at end of file diff --git a/apps/admin_audit/l10n/he.js b/apps/admin_audit/l10n/he.js index 0dc99e30a97..f9e7d252c4f 100644 --- a/apps/admin_audit/l10n/he.js +++ b/apps/admin_audit/l10n/he.js @@ -2,6 +2,6 @@ OC.L10N.register( "admin_audit", { "Auditing / Logging" : "פיקוח / תיעוד", - "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "מספר יכולות תיעוד ל־Nextcloud כגון תיעוד גישה ליומן התיעוד או פעולות רגישות אחרות." + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "מספק יכולות תיעוד ל־Nextcloud כגון תיעוד גישה ליומן התיעוד או פעולות רגישות אחרות." }, -"nplurals=4; plural=(n == 1 && n % 1 == 0) ? 0 : (n == 2 && n % 1 == 0) ? 1: (n % 10 == 0 && n % 1 == 0 && n > 10) ? 2 : 3;"); +"nplurals=3; plural=(n == 1 && n % 1 == 0) ? 0 : (n == 2 && n % 1 == 0) ? 1: 2;"); diff --git a/apps/admin_audit/l10n/he.json b/apps/admin_audit/l10n/he.json index dc33bd55f11..3a675abec35 100644 --- a/apps/admin_audit/l10n/he.json +++ b/apps/admin_audit/l10n/he.json @@ -1,5 +1,5 @@ { "translations": { "Auditing / Logging" : "פיקוח / תיעוד", - "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "מספר יכולות תיעוד ל־Nextcloud כגון תיעוד גישה ליומן התיעוד או פעולות רגישות אחרות." -},"pluralForm" :"nplurals=4; plural=(n == 1 && n % 1 == 0) ? 0 : (n == 2 && n % 1 == 0) ? 1: (n % 10 == 0 && n % 1 == 0 && n > 10) ? 2 : 3;" + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "מספק יכולות תיעוד ל־Nextcloud כגון תיעוד גישה ליומן התיעוד או פעולות רגישות אחרות." +},"pluralForm" :"nplurals=3; plural=(n == 1 && n % 1 == 0) ? 0 : (n == 2 && n % 1 == 0) ? 1: 2;" }
\ No newline at end of file diff --git a/apps/admin_audit/l10n/hi_IN.js b/apps/admin_audit/l10n/hi_IN.js new file mode 100644 index 00000000000..51717d8df5f --- /dev/null +++ b/apps/admin_audit/l10n/hi_IN.js @@ -0,0 +1,7 @@ +OC.L10N.register( + "admin_audit", + { + "Auditing / Logging" : "ऑडिटिंग/लॉगिंग", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "नेक्स्टक्लाउड के लिए लॉगिंग क्षमताएं प्रदान करता है जैसे फ़ाइल एक्सेस या अन्यथा संवेदनशील कार्यों को लॉग करना।" +}, +"nplurals=2; plural=(n != 1);"); diff --git a/apps/admin_audit/l10n/hi_IN.json b/apps/admin_audit/l10n/hi_IN.json new file mode 100644 index 00000000000..a2ad91b2ba5 --- /dev/null +++ b/apps/admin_audit/l10n/hi_IN.json @@ -0,0 +1,5 @@ +{ "translations": { + "Auditing / Logging" : "ऑडिटिंग/लॉगिंग", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "नेक्स्टक्लाउड के लिए लॉगिंग क्षमताएं प्रदान करता है जैसे फ़ाइल एक्सेस या अन्यथा संवेदनशील कार्यों को लॉग करना।" +},"pluralForm" :"nplurals=2; plural=(n != 1);" +}
\ No newline at end of file diff --git a/apps/admin_audit/l10n/hy.js b/apps/admin_audit/l10n/hy.js new file mode 100644 index 00000000000..12a7cf5ab92 --- /dev/null +++ b/apps/admin_audit/l10n/hy.js @@ -0,0 +1,7 @@ +OC.L10N.register( + "admin_audit", + { + "Auditing / Logging" : "Աուդիտ / Տեղեկագրում", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Nextcloud ֊ի համար տրամադրում է տեղեկագրման հնարավորություն՝ նիշքերի հասանելիության և զգայուն գործողություինների պահպանումը տեղեկամատյանում։" +}, +"nplurals=2; plural=(n != 1);"); diff --git a/apps/admin_audit/l10n/hy.json b/apps/admin_audit/l10n/hy.json new file mode 100644 index 00000000000..43cf433d8dd --- /dev/null +++ b/apps/admin_audit/l10n/hy.json @@ -0,0 +1,5 @@ +{ "translations": { + "Auditing / Logging" : "Աուդիտ / Տեղեկագրում", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Nextcloud ֊ի համար տրամադրում է տեղեկագրման հնարավորություն՝ նիշքերի հասանելիության և զգայուն գործողություինների պահպանումը տեղեկամատյանում։" +},"pluralForm" :"nplurals=2; plural=(n != 1);" +}
\ No newline at end of file diff --git a/apps/admin_audit/l10n/id.js b/apps/admin_audit/l10n/id.js index 441f1940069..144a85299f1 100644 --- a/apps/admin_audit/l10n/id.js +++ b/apps/admin_audit/l10n/id.js @@ -1,7 +1,7 @@ OC.L10N.register( "admin_audit", { - "Auditing / Logging" : "Pemeriksaan / Pencatatan", - "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Menyediakan kemampuan pencatatan untuk Nextcloud seperti pencatatan akses berkas atau tindakan sensitif lainnya." + "Auditing / Logging" : "Pengauditan/Pencatatan", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Menyediakan kemampuan pencatatan untuk Nextcloud, misalnya pencatatan akses file atau tindakan sensitif lainnya." }, "nplurals=1; plural=0;"); diff --git a/apps/admin_audit/l10n/id.json b/apps/admin_audit/l10n/id.json index 91af029f895..868f7c94d32 100644 --- a/apps/admin_audit/l10n/id.json +++ b/apps/admin_audit/l10n/id.json @@ -1,5 +1,5 @@ { "translations": { - "Auditing / Logging" : "Pemeriksaan / Pencatatan", - "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Menyediakan kemampuan pencatatan untuk Nextcloud seperti pencatatan akses berkas atau tindakan sensitif lainnya." + "Auditing / Logging" : "Pengauditan/Pencatatan", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Menyediakan kemampuan pencatatan untuk Nextcloud, misalnya pencatatan akses file atau tindakan sensitif lainnya." },"pluralForm" :"nplurals=1; plural=0;" }
\ No newline at end of file diff --git a/apps/admin_audit/l10n/is.js b/apps/admin_audit/l10n/is.js new file mode 100644 index 00000000000..b3c70f494af --- /dev/null +++ b/apps/admin_audit/l10n/is.js @@ -0,0 +1,7 @@ +OC.L10N.register( + "admin_audit", + { + "Auditing / Logging" : "Eftirlit / Atvikaskráning", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Býður upp á atvikaskráningu fyrir Nextcloud, eins og að skrá aðgang að skrám og fleiri viðkvæmar aðgerðir." +}, +"nplurals=2; plural=(n % 10 != 1 || n % 100 == 11);"); diff --git a/apps/admin_audit/l10n/is.json b/apps/admin_audit/l10n/is.json new file mode 100644 index 00000000000..62b5a13e6be --- /dev/null +++ b/apps/admin_audit/l10n/is.json @@ -0,0 +1,5 @@ +{ "translations": { + "Auditing / Logging" : "Eftirlit / Atvikaskráning", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Býður upp á atvikaskráningu fyrir Nextcloud, eins og að skrá aðgang að skrám og fleiri viðkvæmar aðgerðir." +},"pluralForm" :"nplurals=2; plural=(n % 10 != 1 || n % 100 == 11);" +}
\ No newline at end of file diff --git a/apps/admin_audit/l10n/it.js b/apps/admin_audit/l10n/it.js index 0fa3385be04..200f5c9506f 100644 --- a/apps/admin_audit/l10n/it.js +++ b/apps/admin_audit/l10n/it.js @@ -4,4 +4,4 @@ OC.L10N.register( "Auditing / Logging" : "Auditing / Registrazione", "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Fornisce capacità di registrazione per Nextcloud come la registrazione di accessi ai file o azioni altrimenti sensibili." }, -"nplurals=2; plural=(n != 1);"); +"nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;"); diff --git a/apps/admin_audit/l10n/it.json b/apps/admin_audit/l10n/it.json index ed9c60318b9..62e98d4e652 100644 --- a/apps/admin_audit/l10n/it.json +++ b/apps/admin_audit/l10n/it.json @@ -1,5 +1,5 @@ { "translations": { "Auditing / Logging" : "Auditing / Registrazione", "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Fornisce capacità di registrazione per Nextcloud come la registrazione di accessi ai file o azioni altrimenti sensibili." -},"pluralForm" :"nplurals=2; plural=(n != 1);" +},"pluralForm" :"nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;" }
\ No newline at end of file diff --git a/apps/admin_audit/l10n/ka.js b/apps/admin_audit/l10n/ka.js new file mode 100644 index 00000000000..c0e69e4b5a8 --- /dev/null +++ b/apps/admin_audit/l10n/ka.js @@ -0,0 +1,7 @@ +OC.L10N.register( + "admin_audit", + { + "Auditing / Logging" : "აუდიტი / ჟურნალი", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "იძლევა ჟურნალის შესაძლებლობებს Nextcloud-ისთვის, როგორიცაა ფაილებზე წვდომის ან სხვა მგრძნობიარე ქმედებების ჩაწერა." +}, +"nplurals=2; plural=(n!=1);"); diff --git a/apps/admin_audit/l10n/ka.json b/apps/admin_audit/l10n/ka.json new file mode 100644 index 00000000000..4184b9c2493 --- /dev/null +++ b/apps/admin_audit/l10n/ka.json @@ -0,0 +1,5 @@ +{ "translations": { + "Auditing / Logging" : "აუდიტი / ჟურნალი", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "იძლევა ჟურნალის შესაძლებლობებს Nextcloud-ისთვის, როგორიცაა ფაილებზე წვდომის ან სხვა მგრძნობიარე ქმედებების ჩაწერა." +},"pluralForm" :"nplurals=2; plural=(n!=1);" +}
\ No newline at end of file diff --git a/apps/admin_audit/l10n/lv.js b/apps/admin_audit/l10n/lv.js new file mode 100644 index 00000000000..9aba6a9da59 --- /dev/null +++ b/apps/admin_audit/l10n/lv.js @@ -0,0 +1,7 @@ +OC.L10N.register( + "admin_audit", + { + "Auditing / Logging" : "Auditēšana / Žurnalizēšana", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Nodrošina Nextcloud žurnalēšanas spējas, piemēram, datņu piekļuves žurnalēšanu vai citas jūtīgas darbības." +}, +"nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2);"); diff --git a/apps/admin_audit/l10n/lv.json b/apps/admin_audit/l10n/lv.json new file mode 100644 index 00000000000..8fa3c22ebd3 --- /dev/null +++ b/apps/admin_audit/l10n/lv.json @@ -0,0 +1,5 @@ +{ "translations": { + "Auditing / Logging" : "Auditēšana / Žurnalizēšana", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Nodrošina Nextcloud žurnalēšanas spējas, piemēram, datņu piekļuves žurnalēšanu vai citas jūtīgas darbības." +},"pluralForm" :"nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2);" +}
\ No newline at end of file diff --git a/apps/admin_audit/l10n/mk.js b/apps/admin_audit/l10n/mk.js new file mode 100644 index 00000000000..71a3701e663 --- /dev/null +++ b/apps/admin_audit/l10n/mk.js @@ -0,0 +1,7 @@ +OC.L10N.register( + "admin_audit", + { + "Auditing / Logging" : "Ревизија / Евиденција", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Обезбедува можности за евидентирање на Nextcloud, како што се евидентирање пристапи до датотеки или на друг начин чувствителни дејства." +}, +"nplurals=2; plural=(n % 10 == 1 && n % 100 != 11) ? 0 : 1;"); diff --git a/apps/admin_audit/l10n/mk.json b/apps/admin_audit/l10n/mk.json new file mode 100644 index 00000000000..4e6d9c82711 --- /dev/null +++ b/apps/admin_audit/l10n/mk.json @@ -0,0 +1,5 @@ +{ "translations": { + "Auditing / Logging" : "Ревизија / Евиденција", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Обезбедува можности за евидентирање на Nextcloud, како што се евидентирање пристапи до датотеки или на друг начин чувствителни дејства." +},"pluralForm" :"nplurals=2; plural=(n % 10 == 1 && n % 100 != 11) ? 0 : 1;" +}
\ No newline at end of file diff --git a/apps/admin_audit/l10n/ms_MY.js b/apps/admin_audit/l10n/ms_MY.js new file mode 100644 index 00000000000..59221642a6d --- /dev/null +++ b/apps/admin_audit/l10n/ms_MY.js @@ -0,0 +1,7 @@ +OC.L10N.register( + "admin_audit", + { + "Auditing / Logging" : "Pengauditan / Pengelogan", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Menyediakan kebolehan pengelogan untuk Nextcloud seperti akses fail log atau tindakan sensitif." +}, +"nplurals=1; plural=0;"); diff --git a/apps/admin_audit/l10n/ms_MY.json b/apps/admin_audit/l10n/ms_MY.json new file mode 100644 index 00000000000..c81561ca4b5 --- /dev/null +++ b/apps/admin_audit/l10n/ms_MY.json @@ -0,0 +1,5 @@ +{ "translations": { + "Auditing / Logging" : "Pengauditan / Pengelogan", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Menyediakan kebolehan pengelogan untuk Nextcloud seperti akses fail log atau tindakan sensitif." +},"pluralForm" :"nplurals=1; plural=0;" +}
\ No newline at end of file diff --git a/apps/admin_audit/l10n/pt_BR.js b/apps/admin_audit/l10n/pt_BR.js index 03736d2b309..67b7e27fad8 100644 --- a/apps/admin_audit/l10n/pt_BR.js +++ b/apps/admin_audit/l10n/pt_BR.js @@ -2,6 +2,6 @@ OC.L10N.register( "admin_audit", { "Auditing / Logging" : "Auditoria / Registro", - "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Fornece recursos de registro para Nextcloud, como registros de acesso a arquivos ou outras ações confidenciais." + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Fornece recursos de registro para o Nextcloud, como acessos a arquivos de registro ou outras ações sensíveis." }, -"nplurals=2; plural=(n > 1);"); +"nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;"); diff --git a/apps/admin_audit/l10n/pt_BR.json b/apps/admin_audit/l10n/pt_BR.json index 392c961c5c4..2d745b9c979 100644 --- a/apps/admin_audit/l10n/pt_BR.json +++ b/apps/admin_audit/l10n/pt_BR.json @@ -1,5 +1,5 @@ { "translations": { "Auditing / Logging" : "Auditoria / Registro", - "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Fornece recursos de registro para Nextcloud, como registros de acesso a arquivos ou outras ações confidenciais." -},"pluralForm" :"nplurals=2; plural=(n > 1);" + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Fornece recursos de registro para o Nextcloud, como acessos a arquivos de registro ou outras ações sensíveis." +},"pluralForm" :"nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;" }
\ No newline at end of file diff --git a/apps/admin_audit/l10n/pt_PT.js b/apps/admin_audit/l10n/pt_PT.js index c85ea42cf2e..2289d0fa8e7 100644 --- a/apps/admin_audit/l10n/pt_PT.js +++ b/apps/admin_audit/l10n/pt_PT.js @@ -1,7 +1,7 @@ OC.L10N.register( "admin_audit", { - "Auditing / Logging" : "Auditoria / registo", - "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Fornece a funcionalidade de registo ao Nextcloud como o registo de acesso a ficheiros ou acções sensíveis." + "Auditing / Logging" : "Auditorias / registos", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Fornece funcionalidades de registo para o Nextcloud como registar acessos a ficheiros ou outras ações sensíveis. " }, -"nplurals=2; plural=(n != 1);"); +"nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;"); diff --git a/apps/admin_audit/l10n/pt_PT.json b/apps/admin_audit/l10n/pt_PT.json index 7851be0cc27..ba9810d585c 100644 --- a/apps/admin_audit/l10n/pt_PT.json +++ b/apps/admin_audit/l10n/pt_PT.json @@ -1,5 +1,5 @@ { "translations": { - "Auditing / Logging" : "Auditoria / registo", - "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Fornece a funcionalidade de registo ao Nextcloud como o registo de acesso a ficheiros ou acções sensíveis." -},"pluralForm" :"nplurals=2; plural=(n != 1);" + "Auditing / Logging" : "Auditorias / registos", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Fornece funcionalidades de registo para o Nextcloud como registar acessos a ficheiros ou outras ações sensíveis. " +},"pluralForm" :"nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;" }
\ No newline at end of file diff --git a/apps/admin_audit/l10n/sr@latin.js b/apps/admin_audit/l10n/sr@latin.js new file mode 100644 index 00000000000..bab487e832d --- /dev/null +++ b/apps/admin_audit/l10n/sr@latin.js @@ -0,0 +1,7 @@ +OC.L10N.register( + "admin_audit", + { + "Auditing / Logging" : "Praćenje / Beleženje", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Daje Nextcloudu mogućnost beleženja, poput pristupa fajlovima ili drugih osetljivih radnji." +}, +"nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);"); diff --git a/apps/admin_audit/l10n/sr@latin.json b/apps/admin_audit/l10n/sr@latin.json new file mode 100644 index 00000000000..a01ecd856c0 --- /dev/null +++ b/apps/admin_audit/l10n/sr@latin.json @@ -0,0 +1,5 @@ +{ "translations": { + "Auditing / Logging" : "Praćenje / Beleženje", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Daje Nextcloudu mogućnost beleženja, poput pristupa fajlovima ili drugih osetljivih radnji." +},"pluralForm" :"nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);" +}
\ No newline at end of file diff --git a/apps/admin_audit/l10n/sw.js b/apps/admin_audit/l10n/sw.js new file mode 100644 index 00000000000..58fd34da654 --- /dev/null +++ b/apps/admin_audit/l10n/sw.js @@ -0,0 +1,7 @@ +OC.L10N.register( + "admin_audit", + { + "Auditing / Logging" : "Ukaguzi/kuweka kumbukumbu", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Hutoa uwezo wa kuweka kumbukumbu kwa Nextcloud kama vile ufikiaji wa faili za kumbukumbu au vitendo nyeti." +}, +"nplurals=2; plural=(n != 1);"); diff --git a/apps/admin_audit/l10n/sw.json b/apps/admin_audit/l10n/sw.json new file mode 100644 index 00000000000..3775e3f2982 --- /dev/null +++ b/apps/admin_audit/l10n/sw.json @@ -0,0 +1,5 @@ +{ "translations": { + "Auditing / Logging" : "Ukaguzi/kuweka kumbukumbu", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Hutoa uwezo wa kuweka kumbukumbu kwa Nextcloud kama vile ufikiaji wa faili za kumbukumbu au vitendo nyeti." +},"pluralForm" :"nplurals=2; plural=(n != 1);" +}
\ No newline at end of file diff --git a/apps/admin_audit/l10n/th.js b/apps/admin_audit/l10n/th.js new file mode 100644 index 00000000000..c5fa45119e1 --- /dev/null +++ b/apps/admin_audit/l10n/th.js @@ -0,0 +1,7 @@ +OC.L10N.register( + "admin_audit", + { + "Auditing / Logging" : "การตรวจสอบ / บันทึก", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "ให้ความสามารถในการบันทึก (logging) สำหรับ Nextcloud เช่น การบันทึกการเข้าถึงไฟล์ หรือการดำเนินการที่ละเอียดอ่อน" +}, +"nplurals=1; plural=0;"); diff --git a/apps/admin_audit/l10n/th.json b/apps/admin_audit/l10n/th.json new file mode 100644 index 00000000000..b8902498ff7 --- /dev/null +++ b/apps/admin_audit/l10n/th.json @@ -0,0 +1,5 @@ +{ "translations": { + "Auditing / Logging" : "การตรวจสอบ / บันทึก", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "ให้ความสามารถในการบันทึก (logging) สำหรับ Nextcloud เช่น การบันทึกการเข้าถึงไฟล์ หรือการดำเนินการที่ละเอียดอ่อน" +},"pluralForm" :"nplurals=1; plural=0;" +}
\ No newline at end of file diff --git a/apps/admin_audit/l10n/ug.js b/apps/admin_audit/l10n/ug.js new file mode 100644 index 00000000000..f46e189dbe7 --- /dev/null +++ b/apps/admin_audit/l10n/ug.js @@ -0,0 +1,7 @@ +OC.L10N.register( + "admin_audit", + { + "Auditing / Logging" : "ئىقتىسادىي تەپتىش / خاتىرىلەش", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Nextcloud غا تىزىمغا كىرىش ئىقتىدارى بىلەن تەمىنلەيدۇ ، مەسىلەن ھۆججەتلەرنى زىيارەت قىلىش ياكى باشقا سەزگۈر ھەرىكەتلەر." +}, +"nplurals=2; plural=(n != 1);"); diff --git a/apps/admin_audit/l10n/ug.json b/apps/admin_audit/l10n/ug.json new file mode 100644 index 00000000000..dd79f09b8a5 --- /dev/null +++ b/apps/admin_audit/l10n/ug.json @@ -0,0 +1,5 @@ +{ "translations": { + "Auditing / Logging" : "ئىقتىسادىي تەپتىش / خاتىرىلەش", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Nextcloud غا تىزىمغا كىرىش ئىقتىدارى بىلەن تەمىنلەيدۇ ، مەسىلەن ھۆججەتلەرنى زىيارەت قىلىش ياكى باشقا سەزگۈر ھەرىكەتلەر." +},"pluralForm" :"nplurals=2; plural=(n != 1);" +}
\ No newline at end of file diff --git a/apps/admin_audit/l10n/uz.js b/apps/admin_audit/l10n/uz.js new file mode 100644 index 00000000000..007c8bb77e1 --- /dev/null +++ b/apps/admin_audit/l10n/uz.js @@ -0,0 +1,7 @@ +OC.L10N.register( + "admin_audit", + { + "Auditing / Logging" : "Audit / Kirish", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Next bulut uchun tizimga kirish qobiliyatini ta'minlaydi, masalan, faylga kirish yoki boshqa sezgir harakatlar." +}, +"nplurals=1; plural=0;"); diff --git a/apps/admin_audit/l10n/uz.json b/apps/admin_audit/l10n/uz.json new file mode 100644 index 00000000000..025df6c2786 --- /dev/null +++ b/apps/admin_audit/l10n/uz.json @@ -0,0 +1,5 @@ +{ "translations": { + "Auditing / Logging" : "Audit / Kirish", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Next bulut uchun tizimga kirish qobiliyatini ta'minlaydi, masalan, faylga kirish yoki boshqa sezgir harakatlar." +},"pluralForm" :"nplurals=1; plural=0;" +}
\ No newline at end of file diff --git a/apps/admin_audit/l10n/vi.js b/apps/admin_audit/l10n/vi.js index c434b4322c4..9ad698afa1a 100644 --- a/apps/admin_audit/l10n/vi.js +++ b/apps/admin_audit/l10n/vi.js @@ -1,7 +1,7 @@ OC.L10N.register( "admin_audit", { - "Auditing / Logging" : "Kiểm tra / Nhật ký", - "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Cung cấp khả năng ghi nhật ký cho Nextcloud, chẳng hạn như ghi nhật ký quyền truy cập tệp hoặc các hành động nhạy cảm khác." + "Auditing / Logging" : "Kiểm tra / Nhật ký", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Cung cấp khả năng ghi nhật ký cho Nextcloud, chẳng hạn như ghi nhật ký quyền truy cập tệp hoặc các hành động nhạy cảm khác." }, "nplurals=1; plural=0;"); diff --git a/apps/admin_audit/l10n/vi.json b/apps/admin_audit/l10n/vi.json index 80fc8765f11..26ea23a322c 100644 --- a/apps/admin_audit/l10n/vi.json +++ b/apps/admin_audit/l10n/vi.json @@ -1,5 +1,5 @@ { "translations": { - "Auditing / Logging" : "Kiểm tra / Nhật ký", - "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Cung cấp khả năng ghi nhật ký cho Nextcloud, chẳng hạn như ghi nhật ký quyền truy cập tệp hoặc các hành động nhạy cảm khác." + "Auditing / Logging" : "Kiểm tra / Nhật ký", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Cung cấp khả năng ghi nhật ký cho Nextcloud, chẳng hạn như ghi nhật ký quyền truy cập tệp hoặc các hành động nhạy cảm khác." },"pluralForm" :"nplurals=1; plural=0;" }
\ No newline at end of file diff --git a/apps/admin_audit/l10n/zh_TW.js b/apps/admin_audit/l10n/zh_TW.js index 8c0cdedb78e..496a40683ed 100644 --- a/apps/admin_audit/l10n/zh_TW.js +++ b/apps/admin_audit/l10n/zh_TW.js @@ -1,7 +1,7 @@ OC.L10N.register( "admin_audit", { - "Auditing / Logging" : "稽核/記錄", - "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "提供 Nextcloud 的記錄功能,例如記錄檔存取或其他敏感操作。" + "Auditing / Logging" : "稽核/記錄", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "提供 Nextcloud 的記錄功能,例如紀錄檔存取,或其他敏感操作。" }, "nplurals=1; plural=0;"); diff --git a/apps/admin_audit/l10n/zh_TW.json b/apps/admin_audit/l10n/zh_TW.json index 84a0946e953..ceffb30fa44 100644 --- a/apps/admin_audit/l10n/zh_TW.json +++ b/apps/admin_audit/l10n/zh_TW.json @@ -1,5 +1,5 @@ { "translations": { - "Auditing / Logging" : "稽核/記錄", - "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "提供 Nextcloud 的記錄功能,例如記錄檔存取或其他敏感操作。" + "Auditing / Logging" : "稽核/記錄", + "Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "提供 Nextcloud 的記錄功能,例如紀錄檔存取,或其他敏感操作。" },"pluralForm" :"nplurals=1; plural=0;" }
\ No newline at end of file diff --git a/apps/admin_audit/lib/Actions/Action.php b/apps/admin_audit/lib/Actions/Action.php index 0eaf06b8c0f..acd415d82ea 100644 --- a/apps/admin_audit/lib/Actions/Action.php +++ b/apps/admin_audit/lib/Actions/Action.php @@ -1,41 +1,19 @@ <?php declare(strict_types=1); - /** - * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch> - * - * @author Christoph Wurst <christoph@winzerhof-wurst.at> - * @author Joas Schilling <coding@schilljs.com> - * @author Lukas Reschke <lukas@statuscode.ch> - * @author Roeland Jago Douma <roeland@famdouma.nl> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * + * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ namespace OCA\AdminAudit\Actions; use OCA\AdminAudit\IAuditLogger; class Action { - /** @var IAuditLogger */ - private $logger; - public function __construct(IAuditLogger $logger) { - $this->logger = $logger; + public function __construct( + private IAuditLogger $logger, + ) { } /** @@ -47,23 +25,20 @@ class Action { * @param bool $obfuscateParameters */ public function log(string $text, - array $params, - array $elements, - bool $obfuscateParameters = false): void { + array $params, + array $elements, + bool $obfuscateParameters = false): void { foreach ($elements as $element) { if (!isset($params[$element])) { if ($obfuscateParameters) { $this->logger->critical( - '$params["'.$element.'"] was missing.', + '$params["' . $element . '"] was missing.', ['app' => 'admin_audit'] ); } else { $this->logger->critical( - sprintf( - '$params["'.$element.'"] was missing. Transferred value: %s', - print_r($params, true) - ), - ['app' => 'admin_audit'] + '$params["' . $element . '"] was missing. Transferred value: {params}', + ['app' => 'admin_audit', 'params' => $params] ); } return; diff --git a/apps/admin_audit/lib/Actions/AppManagement.php b/apps/admin_audit/lib/Actions/AppManagement.php deleted file mode 100644 index d6bc7d2c61f..00000000000 --- a/apps/admin_audit/lib/Actions/AppManagement.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php - -declare(strict_types=1); - -/** - * @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com> - * - * @author Joas Schilling <coding@schilljs.com> - * @author Roeland Jago Douma <roeland@famdouma.nl> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -namespace OCA\AdminAudit\Actions; - -class AppManagement extends Action { - - /** - * @param string $appName - */ - public function enableApp(string $appName): void { - $this->log('App "%s" enabled', - ['app' => $appName], - ['app'] - ); - } - - /** - * @param string $appName - * @param string[] $groups - */ - public function enableAppForGroups(string $appName, array $groups): void { - $this->log('App "%1$s" enabled for groups: %2$s', - ['app' => $appName, 'groups' => implode(', ', $groups)], - ['app', 'groups'] - ); - } - - /** - * @param string $appName - */ - public function disableApp(string $appName): void { - $this->log('App "%s" disabled', - ['app' => $appName], - ['app'] - ); - } -} diff --git a/apps/admin_audit/lib/Actions/Auth.php b/apps/admin_audit/lib/Actions/Auth.php deleted file mode 100644 index 27722d4a41c..00000000000 --- a/apps/admin_audit/lib/Actions/Auth.php +++ /dev/null @@ -1,65 +0,0 @@ -<?php - -declare(strict_types=1); - -/** - * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch> - * - * @author Joas Schilling <coding@schilljs.com> - * @author Lukas Reschke <lukas@statuscode.ch> - * @author Roeland Jago Douma <roeland@famdouma.nl> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -namespace OCA\AdminAudit\Actions; - -/** - * Class Auth logs all auth related actions - * - * @package OCA\AdminAudit\Actions - */ -class Auth extends Action { - public function loginAttempt(array $params): void { - $this->log( - 'Login attempt: "%s"', - $params, - [ - 'uid', - ], - true - ); - } - - public function loginSuccessful(array $params): void { - $this->log( - 'Login successful: "%s"', - $params, - [ - 'uid', - ], - true - ); - } - - public function logout(array $params): void { - $this->log( - 'Logout occurred', - [], - [] - ); - } -} diff --git a/apps/admin_audit/lib/Actions/Console.php b/apps/admin_audit/lib/Actions/Console.php deleted file mode 100644 index a69d1f5ff82..00000000000 --- a/apps/admin_audit/lib/Actions/Console.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php - -declare(strict_types=1); - -/** - * @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com> - * - * @author Daniel Kesselberg <mail@danielkesselberg.de> - * @author Joas Schilling <coding@schilljs.com> - * @author Roeland Jago Douma <roeland@famdouma.nl> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -namespace OCA\AdminAudit\Actions; - -class Console extends Action { - /** - * @param $arguments - */ - public function runCommand(array $arguments): void { - if (!isset($arguments[1]) || $arguments[1] === '_completion') { - // Don't log autocompletion - return; - } - - // Remove `./occ` - array_shift($arguments); - - $this->log('Console command executed: %s', - ['arguments' => implode(' ', $arguments)], - ['arguments'] - ); - } -} diff --git a/apps/admin_audit/lib/Actions/Files.php b/apps/admin_audit/lib/Actions/Files.php index b02f9a4f02b..7be4a7cd581 100644 --- a/apps/admin_audit/lib/Actions/Files.php +++ b/apps/admin_audit/lib/Actions/Files.php @@ -1,32 +1,24 @@ <?php declare(strict_types=1); - /** - * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch> - * - * @author Joas Schilling <coding@schilljs.com> - * @author Lukas Reschke <lukas@statuscode.ch> - * @author Roeland Jago Douma <roeland@famdouma.nl> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * + * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ namespace OCA\AdminAudit\Actions; +use OC\Files\Node\NonExistingFile; +use OCP\Files\Events\Node\BeforeNodeDeletedEvent; +use OCP\Files\Events\Node\BeforeNodeReadEvent; +use OCP\Files\Events\Node\NodeCopiedEvent; +use OCP\Files\Events\Node\NodeCreatedEvent; +use OCP\Files\Events\Node\NodeRenamedEvent; +use OCP\Files\Events\Node\NodeWrittenEvent; +use OCP\Files\InvalidPathException; +use OCP\Files\NotFoundException; +use OCP\Server; +use Psr\Log\LoggerInterface; + /** * Class Files logs the actions to files * @@ -35,135 +27,149 @@ namespace OCA\AdminAudit\Actions; class Files extends Action { /** * Logs file read actions - * - * @param array $params */ - public function read(array $params): void { + public function read(BeforeNodeReadEvent $event): void { + try { + $node = $event->getNode(); + $params = [ + 'id' => $node instanceof NonExistingFile ? null : $node->getId(), + 'path' => $node->getPath(), + ]; + } catch (InvalidPathException|NotFoundException $e) { + Server::get(LoggerInterface::class)->error( + 'Exception thrown in file read: ' . $e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] + ); + return; + } $this->log( - 'File accessed: "%s"', + 'File with id "%s" accessed: "%s"', $params, - [ - 'path', - ] + array_keys($params) ); } /** * Logs rename actions of files - * - * @param array $params */ - public function rename(array $params): void { + public function afterRename(NodeRenamedEvent $event): void { + try { + $target = $event->getTarget(); + $source = $event->getSource(); + $params = [ + 'newid' => $target->getId(), + 'oldpath' => $source->getPath(), + 'newpath' => $target->getPath(), + ]; + } catch (InvalidPathException|NotFoundException $e) { + Server::get(LoggerInterface::class)->error( + 'Exception thrown in file rename: ' . $e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] + ); + return; + } + $this->log( - 'File renamed: "%s" to "%s"', + 'File renamed with id "%s" from "%s" to "%s"', $params, - [ - 'oldpath', - 'newpath', - ] + array_keys($params) ); } + /** * Logs creation of files - * - * @param array $params */ - public function create(array $params): void { - if ($params['path'] === '/' || $params['path'] === '' || $params['path'] === null) { + public function create(NodeCreatedEvent $event): void { + try { + $params = [ + 'id' => $event->getNode()->getId(), + 'path' => $event->getNode()->getPath(), + ]; + } catch (InvalidPathException|NotFoundException $e) { + Server::get(LoggerInterface::class)->error( + 'Exception thrown in file create: ' . $e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] + ); + return; + } + if ($params['path'] === '/' || $params['path'] === '') { return; } - $this->log( - 'File created: "%s"', + 'File with id "%s" created: "%s"', $params, - [ - 'path', - ] + array_keys($params) ); } /** * Logs copying of files - * - * @param array $params */ - public function copy(array $params): void { + public function copy(NodeCopiedEvent $event): void { + try { + $params = [ + 'oldid' => $event->getSource()->getId(), + 'newid' => $event->getTarget()->getId(), + 'oldpath' => $event->getSource()->getPath(), + 'newpath' => $event->getTarget()->getPath(), + ]; + } catch (InvalidPathException|NotFoundException $e) { + Server::get(LoggerInterface::class)->error( + 'Exception thrown in file copy: ' . $e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] + ); + return; + } $this->log( - 'File copied: "%s" to "%s"', + 'File id copied from: "%s" to "%s", path from "%s" to "%s"', $params, - [ - 'oldpath', - 'newpath', - ] + array_keys($params) ); } /** * Logs writing of files - * - * @param array $params */ - public function write(array $params): void { - if ($params['path'] === '/' || $params['path'] === '' || $params['path'] === null) { + public function write(NodeWrittenEvent $event): void { + $node = $event->getNode(); + try { + $params = [ + 'id' => $node->getId(), + 'path' => $node->getPath(), + ]; + } catch (InvalidPathException|NotFoundException $e) { + Server::get(LoggerInterface::class)->error( + 'Exception thrown in file write: ' . $e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] + ); + return; + } + if ($params['path'] === '/' || $params['path'] === '') { return; } $this->log( - 'File written to: "%s"', - $params, - [ - 'path', - ] - ); - } - - /** - * Logs update of files - * - * @param array $params - */ - public function update(array $params): void { - $this->log( - 'File updated: "%s"', + 'File with id "%s" written to: "%s"', $params, - [ - 'path', - ] + array_keys($params) ); } /** * Logs deletions of files - * - * @param array $params */ - public function delete(array $params): void { - $this->log( - 'File deleted: "%s"', - $params, - [ - 'path', - ] - ); - } - - /** - * Logs preview access to a file - * - * @param array $params - */ - public function preview(array $params): void { + public function delete(BeforeNodeDeletedEvent $event): void { + try { + $params = [ + 'id' => $event->getNode()->getId(), + 'path' => $event->getNode()->getPath(), + ]; + } catch (InvalidPathException|NotFoundException $e) { + Server::get(LoggerInterface::class)->error( + 'Exception thrown in file delete: ' . $e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] + ); + return; + } $this->log( - 'Preview accessed: "%s" (width: "%s", height: "%s" crop: "%s", mode: "%s")', + 'File with id "%s" deleted: "%s"', $params, - [ - 'path', - 'width', - 'height', - 'crop', - 'mode' - ] + array_keys($params) ); } } diff --git a/apps/admin_audit/lib/Actions/GroupManagement.php b/apps/admin_audit/lib/Actions/GroupManagement.php deleted file mode 100644 index e79b86bb88b..00000000000 --- a/apps/admin_audit/lib/Actions/GroupManagement.php +++ /dev/null @@ -1,109 +0,0 @@ -<?php - -declare(strict_types=1); - -/** - * @copyright Copyright (c) 2016 Bjoern Schiessle <bjoern@schiessle.org> - * - * @author Bjoern Schiessle <bjoern@schiessle.org> - * @author Joas Schilling <coding@schilljs.com> - * @author Lukas Reschke <lukas@statuscode.ch> - * @author Roeland Jago Douma <roeland@famdouma.nl> - * @author Roger Szabo <roger.szabo@web.de> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -namespace OCA\AdminAudit\Actions; - -use OCP\IGroup; -use OCP\IUser; - -/** - * Class GroupManagement logs all group manager related events - * - * @package OCA\AdminAudit\Actions - */ -class GroupManagement extends Action { - - /** - * log add user to group event - * - * @param IGroup $group - * @param IUser $user - */ - public function addUser(IGroup $group, IUser $user): void { - $this->log('User "%s" added to group "%s"', - [ - 'group' => $group->getGID(), - 'user' => $user->getUID() - ], - [ - 'user', 'group' - ] - ); - } - - /** - * log remove user from group event - * - * @param IGroup $group - * @param IUser $user - */ - public function removeUser(IGroup $group, IUser $user): void { - $this->log('User "%s" removed from group "%s"', - [ - 'group' => $group->getGID(), - 'user' => $user->getUID() - ], - [ - 'user', 'group' - ] - ); - } - - /** - * log create group to group event - * - * @param IGroup $group - */ - public function createGroup(IGroup $group): void { - $this->log('Group created: "%s"', - [ - 'group' => $group->getGID() - ], - [ - 'group' - ] - ); - } - - /** - * log delete group to group event - * - * @param IGroup $group - */ - public function deleteGroup(IGroup $group): void { - $this->log('Group deleted: "%s"', - [ - 'group' => $group->getGID() - ], - [ - 'group' - ] - ); - } -} diff --git a/apps/admin_audit/lib/Actions/Security.php b/apps/admin_audit/lib/Actions/Security.php deleted file mode 100644 index e4831ac6fc1..00000000000 --- a/apps/admin_audit/lib/Actions/Security.php +++ /dev/null @@ -1,78 +0,0 @@ -<?php - -declare(strict_types=1); - -/** - * @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.nl> - * - * @author Christoph Wurst <christoph@winzerhof-wurst.at> - * @author Roeland Jago Douma <roeland@famdouma.nl> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -namespace OCA\AdminAudit\Actions; - -use OCP\IUser; - -/** - * Class Sharing logs the sharing actions - * - * @package OCA\AdminAudit\Actions - */ -class Security extends Action { - /** - * Log twofactor auth enabled - * - * @param IUser $user - * @param array $params - */ - public function twofactorFailed(IUser $user, array $params): void { - $params['uid'] = $user->getUID(); - $params['displayName'] = $user->getDisplayName(); - - $this->log( - 'Failed two factor attempt by user %s (%s) with provider %s', - $params, - [ - 'displayName', - 'uid', - 'provider', - ] - ); - } - - /** - * Logs unsharing of data - * - * @param IUser $user - * @param array $params - */ - public function twofactorSuccess(IUser $user, array $params): void { - $params['uid'] = $user->getUID(); - $params['displayName'] = $user->getDisplayName(); - - $this->log( - 'Successful two factor attempt by user %s (%s) with provider %s', - $params, - [ - 'displayName', - 'uid', - 'provider', - ] - ); - } -} diff --git a/apps/admin_audit/lib/Actions/Sharing.php b/apps/admin_audit/lib/Actions/Sharing.php index 329ed740b53..8f021d5f210 100644 --- a/apps/admin_audit/lib/Actions/Sharing.php +++ b/apps/admin_audit/lib/Actions/Sharing.php @@ -1,283 +1,18 @@ <?php declare(strict_types=1); - /** - * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch> - * - * @author Daniel Calviño Sánchez <danxuliu@gmail.com> - * @author Joas Schilling <coding@schilljs.com> - * @author Julius Härtl <jus@bitgrid.net> - * @author Lukas Reschke <lukas@statuscode.ch> - * @author Roeland Jago Douma <roeland@famdouma.nl> - * @author Sascha Wiswedel <sascha.wiswedel@nextcloud.com> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * + * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ namespace OCA\AdminAudit\Actions; -use OCP\Share\IShare; - /** * Class Sharing logs the sharing actions * * @package OCA\AdminAudit\Actions */ class Sharing extends Action { - /** - * Logs sharing of data - * - * @param array $params - */ - public function shared(array $params): void { - if ($params['shareType'] === IShare::TYPE_LINK) { - $this->log( - 'The %s "%s" with ID "%s" has been shared via link with permissions "%s" (Share ID: %s)', - $params, - [ - 'itemType', - 'path', - 'itemSource', - 'permissions', - 'id', - ] - ); - } elseif ($params['shareType'] === IShare::TYPE_USER) { - $this->log( - 'The %s "%s" with ID "%s" has been shared to the user "%s" with permissions "%s" (Share ID: %s)', - $params, - [ - 'itemType', - 'path', - 'itemSource', - 'shareWith', - 'permissions', - 'id', - ] - ); - } elseif ($params['shareType'] === IShare::TYPE_GROUP) { - $this->log( - 'The %s "%s" with ID "%s" has been shared to the group "%s" with permissions "%s" (Share ID: %s)', - $params, - [ - 'itemType', - 'path', - 'itemSource', - 'shareWith', - 'permissions', - 'id', - ] - ); - } elseif ($params['shareType'] === IShare::TYPE_ROOM) { - $this->log( - 'The %s "%s" with ID "%s" has been shared to the room "%s" with permissions "%s" (Share ID: %s)', - $params, - [ - 'itemType', - 'path', - 'itemSource', - 'shareWith', - 'permissions', - 'id', - ] - ); - } elseif ($params['shareType'] === IShare::TYPE_EMAIL) { - $this->log( - 'The %s "%s" with ID "%s" has been shared to the email recipient "%s" with permissions "%s" (Share ID: %s)', - $params, - [ - 'itemType', - 'path', - 'itemSource', - 'shareWith', - 'permissions', - 'id', - ] - ); - } elseif ($params['shareType'] === IShare::TYPE_CIRCLE) { - $this->log( - 'The %s "%s" with ID "%s" has been shared to the circle "%s" with permissions "%s" (Share ID: %s)', - $params, - [ - 'itemType', - 'path', - 'itemSource', - 'shareWith', - 'permissions', - 'id', - ] - ); - } elseif ($params['shareType'] === IShare::TYPE_REMOTE) { - $this->log( - 'The %s "%s" with ID "%s" has been shared to the remote user "%s" with permissions "%s" (Share ID: %s)', - $params, - [ - 'itemType', - 'path', - 'itemSource', - 'shareWith', - 'permissions', - 'id', - ] - ); - } elseif ($params['shareType'] === IShare::TYPE_REMOTE_GROUP) { - $this->log( - 'The %s "%s" with ID "%s" has been shared to the remote group "%s" with permissions "%s" (Share ID: %s)', - $params, - [ - 'itemType', - 'path', - 'itemSource', - 'shareWith', - 'permissions', - 'id', - ] - ); - } elseif ($params['shareType'] === IShare::TYPE_DECK) { - $this->log( - 'The %s "%s" with ID "%s" has been shared to the deck card "%s" with permissions "%s" (Share ID: %s)', - $params, - [ - 'itemType', - 'path', - 'itemSource', - 'shareWith', - 'permissions', - 'id', - ] - ); - } - } - - /** - * Logs unsharing of data - * - * @param array $params - */ - public function unshare(array $params): void { - if ($params['shareType'] === IShare::TYPE_LINK) { - $this->log( - 'The %s "%s" with ID "%s" has been unshared (Share ID: %s)', - $params, - [ - 'itemType', - 'fileTarget', - 'itemSource', - 'id', - ] - ); - } elseif ($params['shareType'] === IShare::TYPE_USER) { - $this->log( - 'The %s "%s" with ID "%s" has been unshared from the user "%s" (Share ID: %s)', - $params, - [ - 'itemType', - 'fileTarget', - 'itemSource', - 'shareWith', - 'id', - ] - ); - } elseif ($params['shareType'] === IShare::TYPE_GROUP) { - $this->log( - 'The %s "%s" with ID "%s" has been unshared from the group "%s" (Share ID: %s)', - $params, - [ - 'itemType', - 'fileTarget', - 'itemSource', - 'shareWith', - 'id', - ] - ); - } elseif ($params['shareType'] === IShare::TYPE_ROOM) { - $this->log( - 'The %s "%s" with ID "%s" has been unshared from the room "%s" (Share ID: %s)', - $params, - [ - 'itemType', - 'fileTarget', - 'itemSource', - 'shareWith', - 'id', - ] - ); - } elseif ($params['shareType'] === IShare::TYPE_EMAIL) { - $this->log( - 'The %s "%s" with ID "%s" has been unshared from the email recipient "%s" (Share ID: %s)', - $params, - [ - 'itemType', - 'fileTarget', - 'itemSource', - 'shareWith', - 'id', - ] - ); - } elseif ($params['shareType'] === IShare::TYPE_CIRCLE) { - $this->log( - 'The %s "%s" with ID "%s" has been unshared from the circle "%s" (Share ID: %s)', - $params, - [ - 'itemType', - 'fileTarget', - 'itemSource', - 'shareWith', - 'id', - ] - ); - } elseif ($params['shareType'] === IShare::TYPE_REMOTE) { - $this->log( - 'The %s "%s" with ID "%s" has been unshared from the remote user "%s" (Share ID: %s)', - $params, - [ - 'itemType', - 'fileTarget', - 'itemSource', - 'shareWith', - 'id', - ] - ); - } elseif ($params['shareType'] === IShare::TYPE_REMOTE_GROUP) { - $this->log( - 'The %s "%s" with ID "%s" has been unshared from the remote group "%s" (Share ID: %s)', - $params, - [ - 'itemType', - 'fileTarget', - 'itemSource', - 'shareWith', - 'id', - ] - ); - } elseif ($params['shareType'] === IShare::TYPE_DECK) { - $this->log( - 'The %s "%s" with ID "%s" has been unshared from the deck card "%s" (Share ID: %s)', - $params, - [ - 'itemType', - 'fileTarget', - 'itemSource', - 'shareWith', - 'id', - ] - ); - } - } /** * Logs the updating of permission changes for shares diff --git a/apps/admin_audit/lib/Actions/TagManagement.php b/apps/admin_audit/lib/Actions/TagManagement.php new file mode 100644 index 00000000000..a167017aec3 --- /dev/null +++ b/apps/admin_audit/lib/Actions/TagManagement.php @@ -0,0 +1,27 @@ +<?php + +declare(strict_types=1); + +/*! + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +namespace OCA\AdminAudit\Actions; + +use OCP\SystemTag\ISystemTag; + +class TagManagement extends Action { + /** + * @param ISystemTag $tag newly created tag + */ + public function createTag(ISystemTag $tag): void { + $this->log('System tag "%s" (%s, %s) created', + [ + 'name' => $tag->getName(), + 'visbility' => $tag->isUserVisible() ? 'visible' : 'invisible', + 'assignable' => $tag->isUserAssignable() ? 'user assignable' : 'system only', + ], + ['name', 'visibility', 'assignable'] + ); + } +} diff --git a/apps/admin_audit/lib/Actions/Trashbin.php b/apps/admin_audit/lib/Actions/Trashbin.php index ab2863399e5..c1e994da3a5 100644 --- a/apps/admin_audit/lib/Actions/Trashbin.php +++ b/apps/admin_audit/lib/Actions/Trashbin.php @@ -1,29 +1,9 @@ <?php declare(strict_types=1); - /** - * @copyright Copyright (c) 2016 Bjoern Schiessle <bjoern@schiessle.org> - * - * @author Bjoern Schiessle <bjoern@schiessle.org> - * @author Joas Schilling <coding@schilljs.com> - * @author Roeland Jago Douma <roeland@famdouma.nl> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * + * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ namespace OCA\AdminAudit\Actions; diff --git a/apps/admin_audit/lib/Actions/UserManagement.php b/apps/admin_audit/lib/Actions/UserManagement.php deleted file mode 100644 index 02d5b60d2fa..00000000000 --- a/apps/admin_audit/lib/Actions/UserManagement.php +++ /dev/null @@ -1,146 +0,0 @@ -<?php - -declare(strict_types=1); - -/** - * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch> - * - * @author Arthur Schiwon <blizzz@arthur-schiwon.de> - * @author Bjoern Schiessle <bjoern@schiessle.org> - * @author Christoph Wurst <christoph@winzerhof-wurst.at> - * @author Joas Schilling <coding@schilljs.com> - * @author John Molakvoæ <skjnldsv@protonmail.com> - * @author Lukas Reschke <lukas@statuscode.ch> - * @author Roeland Jago Douma <roeland@famdouma.nl> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -namespace OCA\AdminAudit\Actions; - -use OCP\IUser; - -/** - * Class UserManagement logs all user management related actions. - * - * @package OCA\AdminAudit\Actions - */ -class UserManagement extends Action { - /** - * Log creation of users - * - * @param array $params - */ - public function create(array $params): void { - $this->log( - 'User created: "%s"', - $params, - [ - 'uid', - ] - ); - } - - /** - * Log assignments of users (typically user backends) - * - * @param string $uid - */ - public function assign(string $uid): void { - $this->log( - 'UserID assigned: "%s"', - [ 'uid' => $uid ], - [ 'uid' ] - ); - } - - /** - * Log deletion of users - * - * @param array $params - */ - public function delete(array $params): void { - $this->log( - 'User deleted: "%s"', - $params, - [ - 'uid', - ] - ); - } - - /** - * Log unassignments of users (typically user backends, no data removed) - * - * @param string $uid - */ - public function unassign(string $uid): void { - $this->log( - 'UserID unassigned: "%s"', - [ 'uid' => $uid ], - [ 'uid' ] - ); - } - - /** - * Log enabling of users - * - * @param array $params - */ - public function change(array $params): void { - switch ($params['feature']) { - case 'enabled': - $this->log( - $params['value'] === true - ? 'User enabled: "%s"' - : 'User disabled: "%s"', - ['user' => $params['user']->getUID()], - [ - 'user', - ] - ); - break; - case 'eMailAddress': - $this->log( - 'Email address changed for user %s', - ['user' => $params['user']->getUID()], - [ - 'user', - ] - ); - break; - } - } - - /** - * Logs changing of the user scope - * - * @param IUser $user - */ - public function setPassword(IUser $user): void { - if ($user->getBackendClassName() === 'Database') { - $this->log( - 'Password of user "%s" has been changed', - [ - 'user' => $user->getUID(), - ], - [ - 'user', - ] - ); - } - } -} diff --git a/apps/admin_audit/lib/Actions/Versions.php b/apps/admin_audit/lib/Actions/Versions.php index acd3b0e77e7..b3fdefd011d 100644 --- a/apps/admin_audit/lib/Actions/Versions.php +++ b/apps/admin_audit/lib/Actions/Versions.php @@ -1,43 +1,13 @@ <?php declare(strict_types=1); - /** - * @copyright Bjoern Schiessle <bjoern@schiessle.org> - * - * @author Bjoern Schiessle <bjoern@schiessle.org> - * @author Joas Schilling <coding@schilljs.com> - * @author Roeland Jago Douma <roeland@famdouma.nl> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * + * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ namespace OCA\AdminAudit\Actions; class Versions extends Action { - public function rollback(array $params): void { - $this->log('Version "%s" of "%s" was restored.', - [ - 'version' => $params['revision'], - 'path' => $params['path'] - ], - ['version', 'path'] - ); - } - public function delete(array $params): void { $this->log('Version "%s" was deleted.', ['path' => $params['path']], diff --git a/apps/admin_audit/lib/AppInfo/Application.php b/apps/admin_audit/lib/AppInfo/Application.php index 1160d151710..63a1d065bc8 100644 --- a/apps/admin_audit/lib/AppInfo/Application.php +++ b/apps/admin_audit/lib/AppInfo/Application.php @@ -3,90 +3,126 @@ declare(strict_types=1); /** - * @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com> - * - * @author Arthur Schiwon <blizzz@arthur-schiwon.de> - * @author Bjoern Schiessle <bjoern@schiessle.org> - * @author Christoph Wurst <christoph@winzerhof-wurst.at> - * @author Daniel Kesselberg <mail@danielkesselberg.de> - * @author GrayFix <grayfix@gmail.com> - * @author Joas Schilling <coding@schilljs.com> - * @author Morris Jobke <hey@morrisjobke.de> - * @author Roeland Jago Douma <roeland@famdouma.nl> - * @author Tiago Flores <tiago.flores@yahoo.com.br> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * + * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\AdminAudit\AppInfo; -use Closure; -use OC\Files\Filesystem; -use OC\Files\Node\File; -use OC\Group\Manager as GroupManager; -use OC\User\Session as UserSession; -use OCA\AdminAudit\Actions\AppManagement; use OCA\AdminAudit\Actions\Auth; use OCA\AdminAudit\Actions\Console; use OCA\AdminAudit\Actions\Files; -use OCA\AdminAudit\Actions\GroupManagement; -use OCA\AdminAudit\Actions\Security; use OCA\AdminAudit\Actions\Sharing; +use OCA\AdminAudit\Actions\TagManagement; use OCA\AdminAudit\Actions\Trashbin; -use OCA\AdminAudit\Actions\UserManagement; use OCA\AdminAudit\Actions\Versions; use OCA\AdminAudit\AuditLogger; use OCA\AdminAudit\IAuditLogger; +use OCA\AdminAudit\Listener\AppManagementEventListener; +use OCA\AdminAudit\Listener\AuthEventListener; +use OCA\AdminAudit\Listener\ConsoleEventListener; use OCA\AdminAudit\Listener\CriticalActionPerformedEventListener; -use OCP\App\ManagerEvent; +use OCA\AdminAudit\Listener\FileEventListener; +use OCA\AdminAudit\Listener\GroupManagementEventListener; +use OCA\AdminAudit\Listener\SecurityEventListener; +use OCA\AdminAudit\Listener\SharingEventListener; +use OCA\AdminAudit\Listener\UserManagementEventListener; +use OCA\Files_Versions\Events\VersionRestoredEvent; +use OCP\App\Events\AppDisableEvent; +use OCP\App\Events\AppEnableEvent; +use OCP\App\Events\AppUpdateEvent; use OCP\AppFramework\App; use OCP\AppFramework\Bootstrap\IBootContext; use OCP\AppFramework\Bootstrap\IBootstrap; use OCP\AppFramework\Bootstrap\IRegistrationContext; -use OCP\Authentication\TwoFactorAuth\IProvider; +use OCP\Authentication\Events\AnyLoginFailedEvent; +use OCP\Authentication\TwoFactorAuth\TwoFactorProviderChallengeFailed; +use OCP\Authentication\TwoFactorAuth\TwoFactorProviderChallengePassed; use OCP\Console\ConsoleEvent; +use OCP\EventDispatcher\IEventDispatcher; +use OCP\Files\Events\Node\BeforeNodeDeletedEvent; +use OCP\Files\Events\Node\BeforeNodeReadEvent; +use OCP\Files\Events\Node\NodeCopiedEvent; +use OCP\Files\Events\Node\NodeCreatedEvent; +use OCP\Files\Events\Node\NodeRenamedEvent; +use OCP\Files\Events\Node\NodeWrittenEvent; +use OCP\Group\Events\GroupCreatedEvent; +use OCP\Group\Events\GroupDeletedEvent; +use OCP\Group\Events\UserAddedEvent; +use OCP\Group\Events\UserRemovedEvent; use OCP\IConfig; -use OCP\IGroupManager; -use OCP\IPreview; -use OCP\IServerContainer; -use OCP\IUserSession; use OCP\Log\Audit\CriticalActionPerformedEvent; use OCP\Log\ILogFactory; +use OCP\Preview\BeforePreviewFetchedEvent; use OCP\Share; +use OCP\Share\Events\ShareCreatedEvent; +use OCP\Share\Events\ShareDeletedEvent; +use OCP\SystemTag\ManagerEvent; +use OCP\User\Events\BeforeUserLoggedInEvent; +use OCP\User\Events\BeforeUserLoggedOutEvent; +use OCP\User\Events\PasswordUpdatedEvent; +use OCP\User\Events\UserChangedEvent; +use OCP\User\Events\UserCreatedEvent; +use OCP\User\Events\UserDeletedEvent; +use OCP\User\Events\UserIdAssignedEvent; +use OCP\User\Events\UserIdUnassignedEvent; +use OCP\User\Events\UserLoggedInEvent; +use OCP\User\Events\UserLoggedInWithCookieEvent; use OCP\Util; use Psr\Container\ContainerInterface; -use Psr\Log\LoggerInterface; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\GenericEvent; class Application extends App implements IBootstrap { - - /** @var LoggerInterface */ - protected $logger; - public function __construct() { parent::__construct('admin_audit'); } public function register(IRegistrationContext $context): void { $context->registerService(IAuditLogger::class, function (ContainerInterface $c) { - return new AuditLogger($c->get(ILogFactory::class), $c->get(Iconfig::class)); + return new AuditLogger($c->get(ILogFactory::class), $c->get(IConfig::class)); }); $context->registerEventListener(CriticalActionPerformedEvent::class, CriticalActionPerformedEventListener::class); + + // User management events + $context->registerEventListener(UserCreatedEvent::class, UserManagementEventListener::class); + $context->registerEventListener(UserDeletedEvent::class, UserManagementEventListener::class); + $context->registerEventListener(UserChangedEvent::class, UserManagementEventListener::class); + $context->registerEventListener(PasswordUpdatedEvent::class, UserManagementEventListener::class); + $context->registerEventListener(UserIdAssignedEvent::class, UserManagementEventListener::class); + $context->registerEventListener(UserIdUnassignedEvent::class, UserManagementEventListener::class); + + // Group management events + $context->registerEventListener(UserAddedEvent::class, GroupManagementEventListener::class); + $context->registerEventListener(UserRemovedEvent::class, GroupManagementEventListener::class); + $context->registerEventListener(GroupCreatedEvent::class, GroupManagementEventListener::class); + $context->registerEventListener(GroupDeletedEvent::class, GroupManagementEventListener::class); + + // Sharing events + $context->registerEventListener(ShareCreatedEvent::class, SharingEventListener::class); + $context->registerEventListener(ShareDeletedEvent::class, SharingEventListener::class); + + // Auth events + $context->registerEventListener(BeforeUserLoggedInEvent::class, AuthEventListener::class); + $context->registerEventListener(UserLoggedInWithCookieEvent::class, AuthEventListener::class); + $context->registerEventListener(UserLoggedInEvent::class, AuthEventListener::class); + $context->registerEventListener(BeforeUserLoggedOutEvent::class, AuthEventListener::class); + $context->registerEventListener(AnyLoginFailedEvent::class, AuthEventListener::class); + + // File events + $context->registerEventListener(BeforePreviewFetchedEvent::class, FileEventListener::class); + $context->registerEventListener(VersionRestoredEvent::class, FileEventListener::class); + + // Security events + $context->registerEventListener(TwoFactorProviderChallengePassed::class, SecurityEventListener::class); + $context->registerEventListener(TwoFactorProviderChallengeFailed::class, SecurityEventListener::class); + + // App management events + $context->registerEventListener(AppEnableEvent::class, AppManagementEventListener::class); + $context->registerEventListener(AppDisableEvent::class, AppManagementEventListener::class); + $context->registerEventListener(AppUpdateEvent::class, AppManagementEventListener::class); + + // Console events + $context->registerEventListener(ConsoleEvent::class, ConsoleEventListener::class); } public function boot(IBootContext $context): void { @@ -97,166 +133,87 @@ class Application extends App implements IBootstrap { * TODO: once the hooks are migrated to lazy events, this should be done * in \OCA\AdminAudit\AppInfo\Application::register */ - $this->registerHooks($logger, $context->getServerContainer()); + $this->registerLegacyHooks($logger, $context->getServerContainer()); } /** * Register hooks in order to log them */ - private function registerHooks(IAuditLogger $logger, - IServerContainer $serverContainer): void { - $this->userManagementHooks($logger, $serverContainer->get(IUserSession::class)); - $this->groupHooks($logger, $serverContainer->get(IGroupManager::class)); - $this->authHooks($logger); - - /** @var EventDispatcherInterface $eventDispatcher */ - $eventDispatcher = $serverContainer->get(EventDispatcherInterface::class); - $this->consoleHooks($logger, $eventDispatcher); - $this->appHooks($logger, $eventDispatcher); - - $this->sharingHooks($logger); - + private function registerLegacyHooks(IAuditLogger $logger, ContainerInterface $serverContainer): void { + /** @var IEventDispatcher $eventDispatcher */ + $eventDispatcher = $serverContainer->get(IEventDispatcher::class); + $this->sharingLegacyHooks($logger); $this->fileHooks($logger, $eventDispatcher); $this->trashbinHooks($logger); $this->versionsHooks($logger); - - $this->securityHooks($logger, $eventDispatcher); - } - - private function userManagementHooks(IAuditLogger $logger, - IUserSession $userSession): void { - $userActions = new UserManagement($logger); - - Util::connectHook('OC_User', 'post_createUser', $userActions, 'create'); - Util::connectHook('OC_User', 'post_deleteUser', $userActions, 'delete'); - Util::connectHook('OC_User', 'changeUser', $userActions, 'change'); - - assert($userSession instanceof UserSession); - $userSession->listen('\OC\User', 'postSetPassword', [$userActions, 'setPassword']); - $userSession->listen('\OC\User', 'assignedUserId', [$userActions, 'assign']); - $userSession->listen('\OC\User', 'postUnassignedUserId', [$userActions, 'unassign']); - } - - private function groupHooks(IAuditLogger $logger, - IGroupManager $groupManager): void { - $groupActions = new GroupManagement($logger); - - assert($groupManager instanceof GroupManager); - $groupManager->listen('\OC\Group', 'postRemoveUser', [$groupActions, 'removeUser']); - $groupManager->listen('\OC\Group', 'postAddUser', [$groupActions, 'addUser']); - $groupManager->listen('\OC\Group', 'postDelete', [$groupActions, 'deleteGroup']); - $groupManager->listen('\OC\Group', 'postCreate', [$groupActions, 'createGroup']); + $this->tagHooks($logger, $eventDispatcher); } - private function sharingHooks(IAuditLogger $logger): void { + private function sharingLegacyHooks(IAuditLogger $logger): void { $shareActions = new Sharing($logger); - Util::connectHook(Share::class, 'post_shared', $shareActions, 'shared'); - Util::connectHook(Share::class, 'post_unshare', $shareActions, 'unshare'); - Util::connectHook(Share::class, 'post_unshareFromSelf', $shareActions, 'unshare'); Util::connectHook(Share::class, 'post_update_permissions', $shareActions, 'updatePermissions'); Util::connectHook(Share::class, 'post_update_password', $shareActions, 'updatePassword'); Util::connectHook(Share::class, 'post_set_expiration_date', $shareActions, 'updateExpirationDate'); Util::connectHook(Share::class, 'share_link_access', $shareActions, 'shareAccessed'); } - private function authHooks(IAuditLogger $logger): void { - $authActions = new Auth($logger); - - Util::connectHook('OC_User', 'pre_login', $authActions, 'loginAttempt'); - Util::connectHook('OC_User', 'post_login', $authActions, 'loginSuccessful'); - Util::connectHook('OC_User', 'logout', $authActions, 'logout'); - } - - private function appHooks(IAuditLogger $logger, - EventDispatcherInterface $eventDispatcher): void { - $eventDispatcher->addListener(ManagerEvent::EVENT_APP_ENABLE, function (ManagerEvent $event) use ($logger) { - $appActions = new AppManagement($logger); - $appActions->enableApp($event->getAppID()); - }); - $eventDispatcher->addListener(ManagerEvent::EVENT_APP_ENABLE_FOR_GROUPS, function (ManagerEvent $event) use ($logger) { - $appActions = new AppManagement($logger); - $appActions->enableAppForGroups($event->getAppID(), $event->getGroups()); - }); - $eventDispatcher->addListener(ManagerEvent::EVENT_APP_DISABLE, function (ManagerEvent $event) use ($logger) { - $appActions = new AppManagement($logger); - $appActions->disableApp($event->getAppID()); - }); - } - - private function consoleHooks(IAuditLogger $logger, - EventDispatcherInterface $eventDispatcher): void { - $eventDispatcher->addListener(ConsoleEvent::EVENT_RUN, function (ConsoleEvent $event) use ($logger) { - $appActions = new Console($logger); - $appActions->runCommand($event->getArguments()); + private function tagHooks(IAuditLogger $logger, + IEventDispatcher $eventDispatcher): void { + $eventDispatcher->addListener(ManagerEvent::EVENT_CREATE, function (ManagerEvent $event) use ($logger): void { + $tagActions = new TagManagement($logger); + $tagActions->createTag($event->getTag()); }); } - private function fileHooks(IAuditLogger $logger, - EventDispatcherInterface $eventDispatcher): void { + private function fileHooks(IAuditLogger $logger, IEventDispatcher $eventDispatcher): void { $fileActions = new Files($logger); + $eventDispatcher->addListener( - IPreview::EVENT, - function (GenericEvent $event) use ($fileActions) { - /** @var File $file */ - $file = $event->getSubject(); - $fileActions->preview([ - 'path' => mb_substr($file->getInternalPath(), 5), - 'width' => $event->getArguments()['width'], - 'height' => $event->getArguments()['height'], - 'crop' => $event->getArguments()['crop'], - 'mode' => $event->getArguments()['mode'] - ]); + NodeRenamedEvent::class, + function (NodeRenamedEvent $event) use ($fileActions): void { + $fileActions->afterRename($event); } ); - Util::connectHook( - Filesystem::CLASSNAME, - Filesystem::signal_post_rename, - $fileActions, - 'rename' - ); - Util::connectHook( - Filesystem::CLASSNAME, - Filesystem::signal_post_create, - $fileActions, - 'create' - ); - Util::connectHook( - Filesystem::CLASSNAME, - Filesystem::signal_post_copy, - $fileActions, - 'copy' + $eventDispatcher->addListener( + NodeCreatedEvent::class, + function (NodeCreatedEvent $event) use ($fileActions): void { + $fileActions->create($event); + } ); - Util::connectHook( - Filesystem::CLASSNAME, - Filesystem::signal_post_write, - $fileActions, - 'write' + + $eventDispatcher->addListener( + NodeCopiedEvent::class, + function (NodeCopiedEvent $event) use ($fileActions): void { + $fileActions->copy($event); + } ); - Util::connectHook( - Filesystem::CLASSNAME, - Filesystem::signal_post_update, - $fileActions, - 'update' + + $eventDispatcher->addListener( + NodeWrittenEvent::class, + function (NodeWrittenEvent $event) use ($fileActions): void { + $fileActions->write($event); + } ); - Util::connectHook( - Filesystem::CLASSNAME, - Filesystem::signal_read, - $fileActions, - 'read' + + $eventDispatcher->addListener( + BeforeNodeReadEvent::class, + function (BeforeNodeReadEvent $event) use ($fileActions): void { + $fileActions->read($event); + } ); - Util::connectHook( - Filesystem::CLASSNAME, - Filesystem::signal_delete, - $fileActions, - 'delete' + + $eventDispatcher->addListener( + BeforeNodeDeletedEvent::class, + function (BeforeNodeDeletedEvent $event) use ($fileActions): void { + $fileActions->delete($event); + } ); } private function versionsHooks(IAuditLogger $logger): void { $versionsActions = new Versions($logger); - Util::connectHook('\OCP\Versions', 'rollback', $versionsActions, 'rollback'); Util::connectHook('\OCP\Versions', 'delete', $versionsActions, 'delete'); } @@ -265,16 +222,4 @@ class Application extends App implements IBootstrap { Util::connectHook('\OCP\Trashbin', 'preDelete', $trashActions, 'delete'); Util::connectHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', $trashActions, 'restore'); } - - private function securityHooks(IAuditLogger $logger, - EventDispatcherInterface $eventDispatcher): void { - $eventDispatcher->addListener(IProvider::EVENT_SUCCESS, function (GenericEvent $event) use ($logger) { - $security = new Security($logger); - $security->twofactorSuccess($event->getSubject(), $event->getArguments()); - }); - $eventDispatcher->addListener(IProvider::EVENT_FAILED, function (GenericEvent $event) use ($logger) { - $security = new Security($logger); - $security->twofactorFailed($event->getSubject(), $event->getArguments()); - }); - } } diff --git a/apps/admin_audit/lib/AuditLogger.php b/apps/admin_audit/lib/AuditLogger.php index 0a7a330a743..a622794dc08 100644 --- a/apps/admin_audit/lib/AuditLogger.php +++ b/apps/admin_audit/lib/AuditLogger.php @@ -1,24 +1,10 @@ <?php + +declare(strict_types=1); + /** - * @copyright Copyright (c) 2022 Carl Schwan <carl@carlschwan.eu> - * - * @author Carl Schwan <carl@carlschwan.eu> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * + * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ namespace OCA\AdminAudit; @@ -32,8 +18,7 @@ use Psr\Log\LoggerInterface; */ class AuditLogger implements IAuditLogger { - /** @var LoggerInterface */ - private $parentLogger; + private LoggerInterface $parentLogger; public function __construct(ILogFactory $logFactory, IConfig $config) { $auditType = $config->getSystemValueString('log_type_audit', 'file'); @@ -50,39 +35,39 @@ class AuditLogger implements IAuditLogger { $this->parentLogger = $logFactory->getCustomPsrLogger($logFile, $auditType, $auditTag); } - public function emergency($message, array $context = array()) { + public function emergency($message, array $context = []): void { $this->parentLogger->emergency($message, $context); } - public function alert($message, array $context = array()) { + public function alert($message, array $context = []): void { $this->parentLogger->alert($message, $context); } - public function critical($message, array $context = array()) { + public function critical($message, array $context = []): void { $this->parentLogger->critical($message, $context); } - public function error($message, array $context = array()) { + public function error($message, array $context = []): void { $this->parentLogger->error($message, $context); } - public function warning($message, array $context = array()) { + public function warning($message, array $context = []): void { $this->parentLogger->warning($message, $context); } - public function notice($message, array $context = array()) { + public function notice($message, array $context = []): void { $this->parentLogger->notice($message, $context); } - public function info($message, array $context = array()) { + public function info($message, array $context = []): void { $this->parentLogger->info($message, $context); } - public function debug($message, array $context = array()) { + public function debug($message, array $context = []): void { $this->parentLogger->debug($message, $context); } - public function log($level, $message, array $context = array()) { + public function log($level, $message, array $context = []): void { $this->parentLogger->log($level, $message, $context); } } diff --git a/apps/admin_audit/lib/BackgroundJobs/Rotate.php b/apps/admin_audit/lib/BackgroundJobs/Rotate.php index 27d5109fd3f..deb0f4a922c 100644..100755 --- a/apps/admin_audit/lib/BackgroundJobs/Rotate.php +++ b/apps/admin_audit/lib/BackgroundJobs/Rotate.php @@ -1,49 +1,30 @@ <?php declare(strict_types=1); - /** - * @copyright Copyright (c) 2018 Arthur Schiwon <blizzz@arthur-schiwon.de> - * - * @author Arthur Schiwon <blizzz@arthur-schiwon.de> - * @author Christoph Wurst <christoph@winzerhof-wurst.at> - * @author Roeland Jago Douma <roeland@famdouma.nl> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * + * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ namespace OCA\AdminAudit\BackgroundJobs; -use OC\BackgroundJob\TimedJob; +use OCP\AppFramework\Utility\ITimeFactory; +use OCP\BackgroundJob\TimedJob; use OCP\IConfig; use OCP\Log\RotationTrait; class Rotate extends TimedJob { use RotationTrait; - /** @var IConfig */ - private $config; - - public function __construct(IConfig $config) { - $this->config = $config; + public function __construct( + ITimeFactory $time, + private IConfig $config, + ) { + parent::__construct($time); $this->setInterval(60 * 60 * 3); } - protected function run($argument) { + protected function run($argument): void { $default = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/audit.log'; $this->filePath = $this->config->getAppValue('admin_audit', 'logfile', $default); diff --git a/apps/admin_audit/lib/IAuditLogger.php b/apps/admin_audit/lib/IAuditLogger.php index b55d36b942d..f17afa6852e 100644 --- a/apps/admin_audit/lib/IAuditLogger.php +++ b/apps/admin_audit/lib/IAuditLogger.php @@ -1,26 +1,9 @@ <?php + /** - * @copyright Copyright (c) 2022 Carl Schwan <carl@carlschwan.eu> - * - * @author Carl Schwan <carl@carlschwan.eu> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * + * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ - namespace OCA\AdminAudit; use Psr\Log\LoggerInterface; diff --git a/apps/admin_audit/lib/Listener/AppManagementEventListener.php b/apps/admin_audit/lib/Listener/AppManagementEventListener.php new file mode 100644 index 00000000000..c20bdd481d6 --- /dev/null +++ b/apps/admin_audit/lib/Listener/AppManagementEventListener.php @@ -0,0 +1,60 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OCA\AdminAudit\Listener; + +use OCA\AdminAudit\Actions\Action; +use OCP\App\Events\AppDisableEvent; +use OCP\App\Events\AppEnableEvent; +use OCP\App\Events\AppUpdateEvent; +use OCP\EventDispatcher\Event; +use OCP\EventDispatcher\IEventListener; + +/** + * @template-implements IEventListener<AppEnableEvent|AppDisableEvent|AppUpdateEvent> + */ +class AppManagementEventListener extends Action implements IEventListener { + public function handle(Event $event): void { + if ($event instanceof AppEnableEvent) { + $this->appEnable($event); + } elseif ($event instanceof AppDisableEvent) { + $this->appDisable($event); + } elseif ($event instanceof AppUpdateEvent) { + $this->appUpdate($event); + } + } + + private function appEnable(AppEnableEvent $event): void { + if (empty($event->getGroupIds())) { + $this->log('App "%s" enabled', + ['app' => $event->getAppId()], + ['app'] + ); + } else { + $this->log('App "%1$s" enabled for groups: %2$s', + ['app' => $event->getAppId(), 'groups' => implode(', ', $event->getGroupIds())], + ['app', 'groups'] + ); + } + } + + private function appDisable(AppDisableEvent $event): void { + $this->log('App "%s" disabled', + ['app' => $event->getAppId()], + ['app'] + ); + } + + private function appUpdate(AppUpdateEvent $event): void { + $this->log('App "%s" updated', + ['app' => $event->getAppId()], + ['app'] + ); + } +} diff --git a/apps/admin_audit/lib/Listener/AuthEventListener.php b/apps/admin_audit/lib/Listener/AuthEventListener.php new file mode 100644 index 00000000000..88be8555a4d --- /dev/null +++ b/apps/admin_audit/lib/Listener/AuthEventListener.php @@ -0,0 +1,83 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OCA\AdminAudit\Listener; + +use OCA\AdminAudit\Actions\Action; +use OCP\Authentication\Events\AnyLoginFailedEvent; +use OCP\EventDispatcher\Event; +use OCP\EventDispatcher\IEventListener; +use OCP\User\Events\BeforeUserLoggedInEvent; +use OCP\User\Events\BeforeUserLoggedOutEvent; +use OCP\User\Events\UserLoggedInEvent; +use OCP\User\Events\UserLoggedInWithCookieEvent; + +/** + * @template-implements IEventListener<BeforeUserLoggedInEvent|UserLoggedInWithCookieEvent|UserLoggedInEvent|BeforeUserLoggedOutEvent|AnyLoginFailedEvent> + */ +class AuthEventListener extends Action implements IEventListener { + public function handle(Event $event): void { + if ($event instanceof BeforeUserLoggedInEvent) { + $this->beforeUserLoggedIn($event); + } elseif ($event instanceof UserLoggedInWithCookieEvent || $event instanceof UserLoggedInEvent) { + $this->userLoggedIn($event); + } elseif ($event instanceof BeforeUserLoggedOutEvent) { + $this->beforeUserLogout($event); + } elseif ($event instanceof AnyLoginFailedEvent) { + $this->anyLoginFailed($event); + } + } + + private function beforeUserLoggedIn(BeforeUserLoggedInEvent $event): void { + $this->log( + 'Login attempt: "%s"', + [ + 'uid' => $event->getUsername() + ], + [ + 'uid', + ], + true + ); + } + + private function userLoggedIn(UserLoggedInWithCookieEvent|UserLoggedInEvent $event): void { + $this->log( + 'Login successful: "%s"', + [ + 'uid' => $event->getUser()->getUID() + ], + [ + 'uid', + ], + true + ); + } + + private function beforeUserLogout(BeforeUserLoggedOutEvent $event): void { + $this->log( + 'Logout occurred', + [], + [] + ); + } + + private function anyLoginFailed(AnyLoginFailedEvent $event): void { + $this->log( + 'Login failed: "%s"', + [ + 'loginName' => $event->getLoginName() + ], + [ + 'loginName', + ], + true + ); + } +} diff --git a/apps/admin_audit/lib/Listener/ConsoleEventListener.php b/apps/admin_audit/lib/Listener/ConsoleEventListener.php new file mode 100644 index 00000000000..aa6029f2016 --- /dev/null +++ b/apps/admin_audit/lib/Listener/ConsoleEventListener.php @@ -0,0 +1,42 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OCA\AdminAudit\Listener; + +use OCA\AdminAudit\Actions\Action; +use OCP\Console\ConsoleEvent; +use OCP\EventDispatcher\Event; +use OCP\EventDispatcher\IEventListener; + +/** + * @template-implements IEventListener<ConsoleEvent> + */ +class ConsoleEventListener extends Action implements IEventListener { + public function handle(Event $event): void { + if ($event instanceof ConsoleEvent) { + $this->runCommand($event); + } + } + + private function runCommand(ConsoleEvent $event): void { + $arguments = $event->getArguments(); + if (!isset($arguments[1]) || $arguments[1] === '_completion') { + // Don't log autocompletion + return; + } + + // Remove `./occ` + array_shift($arguments); + + $this->log('Console command executed: %s', + ['arguments' => implode(' ', $arguments)], + ['arguments'] + ); + } +} diff --git a/apps/admin_audit/lib/Listener/CriticalActionPerformedEventListener.php b/apps/admin_audit/lib/Listener/CriticalActionPerformedEventListener.php index 3f91c0c2731..bc3652a08bc 100644 --- a/apps/admin_audit/lib/Listener/CriticalActionPerformedEventListener.php +++ b/apps/admin_audit/lib/Listener/CriticalActionPerformedEventListener.php @@ -3,26 +3,10 @@ declare(strict_types=1); /** - * @copyright Copyright (c) 2021 Joas Schilling <coding@schilljs.com> - * - * @author Joas Schilling <coding@schilljs.com> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * + * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ + namespace OCA\AdminAudit\Listener; use OCA\AdminAudit\Actions\Action; @@ -30,6 +14,7 @@ use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; use OCP\Log\Audit\CriticalActionPerformedEvent; +/** @template-implements IEventListener<CriticalActionPerformedEvent> */ class CriticalActionPerformedEventListener extends Action implements IEventListener { public function handle(Event $event): void { if (!($event instanceof CriticalActionPerformedEvent)) { diff --git a/apps/admin_audit/lib/Listener/FileEventListener.php b/apps/admin_audit/lib/Listener/FileEventListener.php new file mode 100644 index 00000000000..46a4962123b --- /dev/null +++ b/apps/admin_audit/lib/Listener/FileEventListener.php @@ -0,0 +1,74 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OCA\AdminAudit\Listener; + +use OCA\AdminAudit\Actions\Action; +use OCA\Files_Versions\Events\VersionRestoredEvent; +use OCP\EventDispatcher\Event; +use OCP\EventDispatcher\IEventListener; +use OCP\Files\InvalidPathException; +use OCP\Files\NotFoundException; +use OCP\Preview\BeforePreviewFetchedEvent; +use OCP\Server; +use Psr\Log\LoggerInterface; + +/** + * @template-implements IEventListener<BeforePreviewFetchedEvent|VersionRestoredEvent> + */ +class FileEventListener extends Action implements IEventListener { + public function handle(Event $event): void { + if ($event instanceof BeforePreviewFetchedEvent) { + $this->beforePreviewFetched($event); + } elseif ($event instanceof VersionRestoredEvent) { + $this->versionRestored($event); + } + } + + /** + * Logs preview access to a file + */ + private function beforePreviewFetched(BeforePreviewFetchedEvent $event): void { + try { + $file = $event->getNode(); + $params = [ + 'id' => $file->getId(), + 'width' => $event->getWidth(), + 'height' => $event->getHeight(), + 'crop' => $event->isCrop(), + 'mode' => $event->getMode(), + 'path' => $file->getPath(), + ]; + $this->log( + 'Preview accessed: (id: "%s", width: "%s", height: "%s" crop: "%s", mode: "%s", path: "%s")', + $params, + array_keys($params) + ); + } catch (InvalidPathException|NotFoundException $e) { + Server::get(LoggerInterface::class)->error( + 'Exception thrown in file preview: ' . $e->getMessage(), ['app' => 'admin_audit', 'exception' => $e] + ); + return; + } + } + + /** + * Logs when a version is restored + */ + private function versionRestored(VersionRestoredEvent $event): void { + $version = $event->getVersion(); + $this->log('Version "%s" of "%s" was restored.', + [ + 'version' => $version->getRevisionId(), + 'path' => $version->getVersionPath() + ], + ['version', 'path'] + ); + } +} diff --git a/apps/admin_audit/lib/Listener/GroupManagementEventListener.php b/apps/admin_audit/lib/Listener/GroupManagementEventListener.php new file mode 100644 index 00000000000..df937447e70 --- /dev/null +++ b/apps/admin_audit/lib/Listener/GroupManagementEventListener.php @@ -0,0 +1,81 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OCA\AdminAudit\Listener; + +use OCA\AdminAudit\Actions\Action; +use OCP\EventDispatcher\Event; +use OCP\EventDispatcher\IEventListener; +use OCP\Group\Events\GroupCreatedEvent; +use OCP\Group\Events\GroupDeletedEvent; +use OCP\Group\Events\UserAddedEvent; +use OCP\Group\Events\UserRemovedEvent; + +/** + * @template-implements IEventListener<UserAddedEvent|UserRemovedEvent|GroupCreatedEvent|GroupDeletedEvent> + */ +class GroupManagementEventListener extends Action implements IEventListener { + public function handle(Event $event): void { + if ($event instanceof UserAddedEvent) { + $this->userAdded($event); + } elseif ($event instanceof UserRemovedEvent) { + $this->userRemoved($event); + } elseif ($event instanceof GroupCreatedEvent) { + $this->groupCreated($event); + } elseif ($event instanceof GroupDeletedEvent) { + $this->groupDeleted($event); + } + } + + private function userAdded(UserAddedEvent $event): void { + $this->log('User "%s" added to group "%s"', + [ + 'group' => $event->getGroup()->getGID(), + 'user' => $event->getUser()->getUID() + ], + [ + 'user', 'group' + ] + ); + } + + private function userRemoved(UserRemovedEvent $event): void { + $this->log('User "%s" removed from group "%s"', + [ + 'group' => $event->getGroup()->getGID(), + 'user' => $event->getUser()->getUID() + ], + [ + 'user', 'group' + ] + ); + } + + private function groupCreated(GroupCreatedEvent $event): void { + $this->log('Group created: "%s"', + [ + 'group' => $event->getGroup()->getGID() + ], + [ + 'group' + ] + ); + } + + private function groupDeleted(GroupDeletedEvent $event): void { + $this->log('Group deleted: "%s"', + [ + 'group' => $event->getGroup()->getGID() + ], + [ + 'group' + ] + ); + } +} diff --git a/apps/admin_audit/lib/Listener/SecurityEventListener.php b/apps/admin_audit/lib/Listener/SecurityEventListener.php new file mode 100644 index 00000000000..17253aa384c --- /dev/null +++ b/apps/admin_audit/lib/Listener/SecurityEventListener.php @@ -0,0 +1,61 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OCA\AdminAudit\Listener; + +use OCA\AdminAudit\Actions\Action; +use OCP\Authentication\TwoFactorAuth\TwoFactorProviderChallengeFailed; +use OCP\Authentication\TwoFactorAuth\TwoFactorProviderChallengePassed; +use OCP\EventDispatcher\Event; +use OCP\EventDispatcher\IEventListener; + +/** + * @template-implements IEventListener<TwoFactorProviderChallengePassed|TwoFactorProviderChallengeFailed> + */ +class SecurityEventListener extends Action implements IEventListener { + public function handle(Event $event): void { + if ($event instanceof TwoFactorProviderChallengePassed) { + $this->twoFactorProviderChallengePassed($event); + } elseif ($event instanceof TwoFactorProviderChallengeFailed) { + $this->twoFactorProviderChallengeFailed($event); + } + } + + private function twoFactorProviderChallengePassed(TwoFactorProviderChallengePassed $event): void { + $this->log( + 'Successful two factor attempt by user %s (%s) with provider %s', + [ + 'uid' => $event->getUser()->getUID(), + 'displayName' => $event->getUser()->getDisplayName(), + 'provider' => $event->getProvider()->getDisplayName() + ], + [ + 'displayName', + 'uid', + 'provider', + ] + ); + } + + private function twoFactorProviderChallengeFailed(TwoFactorProviderChallengeFailed $event): void { + $this->log( + 'Failed two factor attempt by user %s (%s) with provider %s', + [ + 'uid' => $event->getUser()->getUID(), + 'displayName' => $event->getUser()->getDisplayName(), + 'provider' => $event->getProvider()->getDisplayName() + ], + [ + 'displayName', + 'uid', + 'provider', + ] + ); + } +} diff --git a/apps/admin_audit/lib/Listener/SharingEventListener.php b/apps/admin_audit/lib/Listener/SharingEventListener.php new file mode 100644 index 00000000000..1ba3c6f49d3 --- /dev/null +++ b/apps/admin_audit/lib/Listener/SharingEventListener.php @@ -0,0 +1,291 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OCA\AdminAudit\Listener; + +use OCA\AdminAudit\Actions\Action; +use OCP\EventDispatcher\Event; +use OCP\EventDispatcher\IEventListener; +use OCP\Share\Events\ShareCreatedEvent; +use OCP\Share\Events\ShareDeletedEvent; +use OCP\Share\IShare; + +/** + * @template-implements IEventListener<ShareCreatedEvent|ShareDeletedEvent> + */ +class SharingEventListener extends Action implements IEventListener { + public function handle(Event $event): void { + if ($event instanceof ShareCreatedEvent) { + $this->shareCreated($event); + } elseif ($event instanceof ShareDeletedEvent) { + $this->shareDeleted($event); + } + } + + private function shareCreated(ShareCreatedEvent $event): void { + $share = $event->getShare(); + + $params = [ + 'itemType' => $share->getNodeType(), + 'path' => $share->getNode()->getPath(), + 'itemSource' => $share->getNodeId(), + 'shareWith' => $share->getSharedWith(), + 'permissions' => $share->getPermissions(), + 'id' => $share->getId() + ]; + + match ($share->getShareType()) { + IShare::TYPE_LINK => $this->log( + 'The %s "%s" with ID "%s" has been shared via link with permissions "%s" (Share ID: %s)', + $params, + [ + 'itemType', + 'path', + 'itemSource', + 'permissions', + 'id', + ] + ), + IShare::TYPE_USER => $this->log( + 'The %s "%s" with ID "%s" has been shared to the user "%s" with permissions "%s" (Share ID: %s)', + $params, + [ + 'itemType', + 'path', + 'itemSource', + 'shareWith', + 'permissions', + 'id', + ] + ), + IShare::TYPE_GROUP => $this->log( + 'The %s "%s" with ID "%s" has been shared to the group "%s" with permissions "%s" (Share ID: %s)', + $params, + [ + 'itemType', + 'path', + 'itemSource', + 'shareWith', + 'permissions', + 'id', + ] + ), + IShare::TYPE_ROOM => $this->log( + 'The %s "%s" with ID "%s" has been shared to the room "%s" with permissions "%s" (Share ID: %s)', + $params, + [ + 'itemType', + 'path', + 'itemSource', + 'shareWith', + 'permissions', + 'id', + ] + ), + IShare::TYPE_EMAIL => $this->log( + 'The %s "%s" with ID "%s" has been shared to the email recipient "%s" with permissions "%s" (Share ID: %s)', + $params, + [ + 'itemType', + 'path', + 'itemSource', + 'shareWith', + 'permissions', + 'id', + ] + ), + IShare::TYPE_CIRCLE => $this->log( + 'The %s "%s" with ID "%s" has been shared to the circle "%s" with permissions "%s" (Share ID: %s)', + $params, + [ + 'itemType', + 'path', + 'itemSource', + 'shareWith', + 'permissions', + 'id', + ] + ), + IShare::TYPE_REMOTE => $this->log( + 'The %s "%s" with ID "%s" has been shared to the remote user "%s" with permissions "%s" (Share ID: %s)', + $params, + [ + 'itemType', + 'path', + 'itemSource', + 'shareWith', + 'permissions', + 'id', + ] + ), + IShare::TYPE_REMOTE_GROUP => $this->log( + 'The %s "%s" with ID "%s" has been shared to the remote group "%s" with permissions "%s" (Share ID: %s)', + $params, + [ + 'itemType', + 'path', + 'itemSource', + 'shareWith', + 'permissions', + 'id', + ] + ), + IShare::TYPE_DECK => $this->log( + 'The %s "%s" with ID "%s" has been shared to the deck card "%s" with permissions "%s" (Share ID: %s)', + $params, + [ + 'itemType', + 'path', + 'itemSource', + 'shareWith', + 'permissions', + 'id', + ] + ), + IShare::TYPE_SCIENCEMESH => $this->log( + 'The %s "%s" with ID "%s" has been shared to the sciencemesh user "%s" with permissions "%s" (Share ID: %s)', + $params, + [ + 'itemType', + 'path', + 'itemSource', + 'shareWith', + 'permissions', + 'id', + ] + ), + default => null + }; + } + + private function shareDeleted(ShareDeletedEvent $event): void { + $share = $event->getShare(); + + $params = [ + 'itemType' => $share->getNodeType(), + 'fileTarget' => $share->getTarget(), + 'itemSource' => $share->getNodeId(), + 'shareWith' => $share->getSharedWith(), + 'id' => $share->getId() + ]; + + match ($share->getShareType()) { + IShare::TYPE_LINK => $this->log( + 'The %s "%s" with ID "%s" has been unshared (Share ID: %s)', + $params, + [ + 'itemType', + 'fileTarget', + 'itemSource', + 'id', + ] + ), + IShare::TYPE_USER => $this->log( + 'The %s "%s" with ID "%s" has been unshared from the user "%s" (Share ID: %s)', + $params, + [ + 'itemType', + 'fileTarget', + 'itemSource', + 'shareWith', + 'id', + ] + ), + IShare::TYPE_GROUP => $this->log( + 'The %s "%s" with ID "%s" has been unshared from the group "%s" (Share ID: %s)', + $params, + [ + 'itemType', + 'fileTarget', + 'itemSource', + 'shareWith', + 'id', + ] + ), + IShare::TYPE_ROOM => $this->log( + 'The %s "%s" with ID "%s" has been unshared from the room "%s" (Share ID: %s)', + $params, + [ + 'itemType', + 'fileTarget', + 'itemSource', + 'shareWith', + 'id', + ] + ), + IShare::TYPE_EMAIL => $this->log( + 'The %s "%s" with ID "%s" has been unshared from the email recipient "%s" (Share ID: %s)', + $params, + [ + 'itemType', + 'fileTarget', + 'itemSource', + 'shareWith', + 'id', + ] + ), + IShare::TYPE_CIRCLE => $this->log( + 'The %s "%s" with ID "%s" has been unshared from the circle "%s" (Share ID: %s)', + $params, + [ + 'itemType', + 'fileTarget', + 'itemSource', + 'shareWith', + 'id', + ] + ), + IShare::TYPE_REMOTE => $this->log( + 'The %s "%s" with ID "%s" has been unshared from the remote user "%s" (Share ID: %s)', + $params, + [ + 'itemType', + 'fileTarget', + 'itemSource', + 'shareWith', + 'id', + ] + ), + IShare::TYPE_REMOTE_GROUP => $this->log( + 'The %s "%s" with ID "%s" has been unshared from the remote group "%s" (Share ID: %s)', + $params, + [ + 'itemType', + 'fileTarget', + 'itemSource', + 'shareWith', + 'id', + ] + ), + IShare::TYPE_DECK => $this->log( + 'The %s "%s" with ID "%s" has been unshared from the deck card "%s" (Share ID: %s)', + $params, + [ + 'itemType', + 'fileTarget', + 'itemSource', + 'shareWith', + 'id', + ] + ), + IShare::TYPE_SCIENCEMESH => $this->log( + 'The %s "%s" with ID "%s" has been unshared from the sciencemesh user "%s" (Share ID: %s)', + $params, + [ + 'itemType', + 'fileTarget', + 'itemSource', + 'shareWith', + 'id', + ] + ), + default => null + }; + } +} diff --git a/apps/admin_audit/lib/Listener/UserManagementEventListener.php b/apps/admin_audit/lib/Listener/UserManagementEventListener.php new file mode 100644 index 00000000000..c22d04dce9a --- /dev/null +++ b/apps/admin_audit/lib/Listener/UserManagementEventListener.php @@ -0,0 +1,126 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OCA\AdminAudit\Listener; + +use OCA\AdminAudit\Actions\Action; +use OCP\EventDispatcher\Event; +use OCP\EventDispatcher\IEventListener; +use OCP\User\Events\PasswordUpdatedEvent; +use OCP\User\Events\UserChangedEvent; +use OCP\User\Events\UserCreatedEvent; +use OCP\User\Events\UserDeletedEvent; +use OCP\User\Events\UserIdAssignedEvent; +use OCP\User\Events\UserIdUnassignedEvent; + +/** + * @template-implements IEventListener<UserCreatedEvent|UserDeletedEvent|UserChangedEvent|PasswordUpdatedEvent|UserIdAssignedEvent|UserIdUnassignedEvent> + */ +class UserManagementEventListener extends Action implements IEventListener { + public function handle(Event $event): void { + if ($event instanceof UserCreatedEvent) { + $this->userCreated($event); + } elseif ($event instanceof UserDeletedEvent) { + $this->userDeleted($event); + } elseif ($event instanceof UserChangedEvent) { + $this->userChanged($event); + } elseif ($event instanceof PasswordUpdatedEvent) { + $this->passwordUpdated($event); + } elseif ($event instanceof UserIdAssignedEvent) { + $this->userIdAssigned($event); + } elseif ($event instanceof UserIdUnassignedEvent) { + $this->userIdUnassigned($event); + } + } + + private function userCreated(UserCreatedEvent $event): void { + $this->log( + 'User created: "%s"', + [ + 'uid' => $event->getUid() + ], + [ + 'uid', + ] + ); + } + + private function userDeleted(UserDeletedEvent $event): void { + $this->log( + 'User deleted: "%s"', + [ + 'uid' => $event->getUser()->getUID() + ], + [ + 'uid', + ] + ); + } + + private function userChanged(UserChangedEvent $event): void { + switch ($event->getFeature()) { + case 'enabled': + $this->log( + $event->getValue() === true + ? 'User enabled: "%s"' + : 'User disabled: "%s"', + ['user' => $event->getUser()->getUID()], + [ + 'user', + ] + ); + break; + case 'eMailAddress': + $this->log( + 'Email address changed for user %s', + ['user' => $event->getUser()->getUID()], + [ + 'user', + ] + ); + break; + } + } + + private function passwordUpdated(PasswordUpdatedEvent $event): void { + if ($event->getUser()->getBackendClassName() === 'Database') { + $this->log( + 'Password of user "%s" has been changed', + [ + 'user' => $event->getUser()->getUID(), + ], + [ + 'user', + ] + ); + } + } + + /** + * Log assignments of users (typically user backends) + */ + private function userIdAssigned(UserIdAssignedEvent $event): void { + $this->log( + 'UserID assigned: "%s"', + [ 'uid' => $event->getUserId() ], + [ 'uid' ] + ); + } + + /** + * Log unassignments of users (typically user backends, no data removed) + */ + private function userIdUnassigned(UserIdUnassignedEvent $event): void { + $this->log( + 'UserID unassigned: "%s"', + [ 'uid' => $event->getUserId() ], + [ 'uid' ] + ); + } +} diff --git a/apps/admin_audit/tests/Actions/SecurityTest.php b/apps/admin_audit/tests/Actions/SecurityTest.php deleted file mode 100644 index d45cbb75a64..00000000000 --- a/apps/admin_audit/tests/Actions/SecurityTest.php +++ /dev/null @@ -1,76 +0,0 @@ -<?php - -declare(strict_types=1); - -/** - * @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.nl> - * - * @author Morris Jobke <hey@morrisjobke.de> - * @author Roeland Jago Douma <roeland@famdouma.nl> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -namespace OCA\AdminAudit\Tests\Actions; - -use OCA\AdminAudit\Actions\Security; -use OCP\IUser; -use OCA\AdminAudit\AuditLogger; -use Test\TestCase; - -class SecurityTest extends TestCase { - /** @var AuditLogger|\PHPUnit\Framework\MockObject\MockObject */ - private $logger; - - /** @var Security */ - private $security; - - /** @var IUser|\PHPUnit\Framework\MockObject\MockObject */ - private $user; - - protected function setUp(): void { - parent::setUp(); - - $this->logger = $this->createMock(AuditLogger::class); - $this->security = new Security($this->logger); - - $this->user = $this->createMock(IUser::class); - $this->user->method('getUID')->willReturn('myuid'); - $this->user->method('getDisplayName')->willReturn('mydisplayname'); - } - - public function testTwofactorFailed() { - $this->logger->expects($this->once()) - ->method('info') - ->with( - $this->equalTo('Failed two factor attempt by user mydisplayname (myuid) with provider myprovider'), - ['app' => 'admin_audit'] - ); - - $this->security->twofactorFailed($this->user, ['provider' => 'myprovider']); - } - - public function testTwofactorSuccess() { - $this->logger->expects($this->once()) - ->method('info') - ->with( - $this->equalTo('Successful two factor attempt by user mydisplayname (myuid) with provider myprovider'), - ['app' => 'admin_audit'] - ); - - $this->security->twofactorSuccess($this->user, ['provider' => 'myprovider']); - } -} diff --git a/apps/admin_audit/tests/Listener/SecurityEventListenerTest.php b/apps/admin_audit/tests/Listener/SecurityEventListenerTest.php new file mode 100644 index 00000000000..48230108530 --- /dev/null +++ b/apps/admin_audit/tests/Listener/SecurityEventListenerTest.php @@ -0,0 +1,65 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OCA\AdminAudit\Tests\Listener; + +use OCA\AdminAudit\AuditLogger; +use OCA\AdminAudit\Listener\SecurityEventListener; +use OCP\Authentication\TwoFactorAuth\IProvider; +use OCP\Authentication\TwoFactorAuth\TwoFactorProviderChallengeFailed; +use OCP\Authentication\TwoFactorAuth\TwoFactorProviderChallengePassed; +use OCP\IUser; +use PHPUnit\Framework\MockObject\MockObject; +use Test\TestCase; + +class SecurityEventListenerTest extends TestCase { + private AuditLogger|MockObject $logger; + + private SecurityEventListener $security; + + private MockObject|IUser $user; + + /** @var IProvider&MockObject */ + private $provider; + + protected function setUp(): void { + parent::setUp(); + + $this->logger = $this->createMock(AuditLogger::class); + $this->security = new SecurityEventListener($this->logger); + + $this->user = $this->createMock(IUser::class); + $this->user->method('getUID')->willReturn('myuid'); + $this->user->method('getDisplayName')->willReturn('mydisplayname'); + $this->provider = $this->createMock(IProvider::class); + $this->provider->method('getDisplayName')->willReturn('myprovider'); + } + + public function testTwofactorFailed(): void { + $this->logger->expects($this->once()) + ->method('info') + ->with( + $this->equalTo('Failed two factor attempt by user mydisplayname (myuid) with provider myprovider'), + ['app' => 'admin_audit'] + ); + + $this->security->handle(new twoFactorProviderChallengeFailed($this->user, $this->provider)); + } + + public function testTwofactorSuccess(): void { + $this->logger->expects($this->once()) + ->method('info') + ->with( + $this->equalTo('Successful two factor attempt by user mydisplayname (myuid) with provider myprovider'), + ['app' => 'admin_audit'] + ); + + $this->security->handle(new TwoFactorProviderChallengePassed($this->user, $this->provider)); + } +} diff --git a/apps/admin_audit/tests/Listener/UserManagementEventListenerTest.php b/apps/admin_audit/tests/Listener/UserManagementEventListenerTest.php new file mode 100644 index 00000000000..c8cb0281113 --- /dev/null +++ b/apps/admin_audit/tests/Listener/UserManagementEventListenerTest.php @@ -0,0 +1,92 @@ +<?php + +declare(strict_types=1); +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +namespace OCA\AdminAudit\Tests\Actions; + +use OCA\AdminAudit\IAuditLogger; +use OCA\AdminAudit\Listener\UserManagementEventListener; +use OCP\IUser; +use OCP\User\Events\UserChangedEvent; +use PHPUnit\Framework\MockObject\MockObject; +use Test\TestCase; + +class UserManagementEventListenerTest extends TestCase { + private IAuditLogger&MockObject $logger; + + private UserManagementEventListener $listener; + + private MockObject&IUser $user; + + protected function setUp(): void { + parent::setUp(); + + $this->logger = $this->createMock(IAuditLogger::class); + $this->listener = new UserManagementEventListener($this->logger); + + $this->user = $this->createMock(IUser::class); + $this->user->method('getUID')->willReturn('alice'); + $this->user->method('getDisplayName')->willReturn('Alice'); + } + + public function testSkipUnsupported(): void { + $this->logger->expects($this->never()) + ->method('info'); + + $event = new UserChangedEvent( + $this->user, + 'unsupported', + 'value', + ); + + $this->listener->handle($event); + } + + public function testUserEnabled(): void { + $this->logger->expects($this->once()) + ->method('info') + ->with('User enabled: "alice"', ['app' => 'admin_audit']); + + $event = new UserChangedEvent( + $this->user, + 'enabled', + true, + false, + ); + + $this->listener->handle($event); + } + + public function testUserDisabled(): void { + $this->logger->expects($this->once()) + ->method('info') + ->with('User disabled: "alice"', ['app' => 'admin_audit']); + + $event = new UserChangedEvent( + $this->user, + 'enabled', + false, + true, + ); + + $this->listener->handle($event); + } + + public function testEmailChanged(): void { + $this->logger->expects($this->once()) + ->method('info') + ->with('Email address changed for user alice', ['app' => 'admin_audit']); + + $event = new UserChangedEvent( + $this->user, + 'eMailAddress', + 'alice@alice.com', + '', + ); + + $this->listener->handle($event); + } +} |