Skip to content

Commit

Permalink
Fixed user deletion with ajax cron jos
Browse files Browse the repository at this point in the history
  • Loading branch information
marius-wieschollek committed Jul 5, 2018
1 parent 2f92d2e commit 9629583
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/lib/Helper/User/DeleteUserDataHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use OCA\Passwords\Db\EntityInterface;
use OCA\Passwords\Helper\Settings\UserSettingsHelper;
use OCA\Passwords\Services\ConfigurationService;
use OCA\Passwords\Services\EnvironmentService;
use OCA\Passwords\Services\Object\AbstractModelService;
use OCA\Passwords\Services\Object\AbstractService;
use OCA\Passwords\Services\Object\FolderService;
Expand Down Expand Up @@ -73,24 +74,24 @@ class DeleteUserDataHelper {
/**
* DeleteUserDataHelper constructor.
*
* @param null|string $userId
* @param TagService $tagService
* @param ShareService $shareService
* @param UserSettingsHelper $settings
* @param FolderService $folderService
* @param ConfigurationService $config
* @param EnvironmentService $environment
* @param PasswordService $passwordService
*/
public function __construct(
?string $userId,
TagService $tagService,
ShareService $shareService,
UserSettingsHelper $settings,
FolderService $folderService,
ConfigurationService $config,
EnvironmentService $environment,
PasswordService $passwordService
) {
$this->userId = $userId;
$this->userId = $environment->getUserId();
$this->config = $config;
$this->settings = $settings;
$this->tagService = $tagService;
Expand Down Expand Up @@ -125,7 +126,9 @@ protected function deleteObjects(AbstractService $service, string $userId): void
/** @var EntityInterface $objects */
$objects = $service->findByUserId($userId);

foreach($objects as $tag) $service->delete($tag);
foreach($objects as $tag) {
$service->delete($tag);
}
}

/**
Expand All @@ -134,13 +137,17 @@ protected function deleteObjects(AbstractService $service, string $userId): void
protected function deleteUserSettings(string $userId): void {
$settings = array_keys($this->settings->list($userId));

foreach($settings as $setting) $this->settings->reset($setting, $userId);
foreach($settings as $setting) {
$this->settings->reset($setting, $userId);
}
}

/**
* @param string $userId
*/
protected function deleteUserConfig(string $userId): void {
foreach($this->userConfigKeys as $key) $this->config->deleteUserValue($key, $userId);
foreach($this->userConfigKeys as $key) {
$this->config->deleteUserValue($key, $userId);
}
}
}

0 comments on commit 9629583

Please sign in to comment.