Issues (496)

lib/Service/UserService.php (2 issues)

Labels
Severity
1
<?php
2
/**
3
 * Analytics
4
 *
5
 * SPDX-FileCopyrightText: 2019-2022 Marcel Scherello
6
 * SPDX-License-Identifier: AGPL-3.0-or-later
7
 */
8
9
namespace OCA\Analytics\Service;
10
11
use OCP\DB\Exception;
0 ignored issues
show
The type OCP\DB\Exception was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use Psr\Log\LoggerInterface;
0 ignored issues
show
The type Psr\Log\LoggerInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
14
class UserService {
15
	private $logger;
16
	private $ShareService;
17
	private $ReportService;
18
	private $DatasetService;
19
	private $PanoramaService;
20
21
	public function __construct(
22
		LoggerInterface $logger,
23
		ReportService   $ReportService,
24
		DatasetService  $DatasetService,
25
		ShareService    $ShareService,
26
		PanoramaService $PanoramaService
27
	) {
28
		$this->logger = $logger;
29
		$this->ReportService = $ReportService;
30
		$this->DatasetService = $DatasetService;
31
		$this->ShareService = $ShareService;
32
		$this->PanoramaService = $PanoramaService;
33
	}
34
35
	/**
36
	 * delete all user data
37
	 *
38
	 * @param $userId
39
	 * @return bool
40
	 * @throws Exception
41
	 */
42
	public function deleteUserData($userId) {
43
		$this->logger->info('Deleting all Analytics data for: ' . $userId);
44
		$this->ReportService->deleteByUser($userId);
45
		$this->DatasetService->deleteByUser($userId);
46
		$this->ShareService->deleteByUser($userId);
47
		$this->PanoramaService->deleteByUser($userId);
48
		return true;
49
	}
50
}