mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-11 19:06:57 +01:00
refactor: [WIP] Remove circular dependency.
Signed-off-by: Rubén D <nuxsmin@syspass.org>
This commit is contained in:
@@ -46,12 +46,11 @@ use SP\Domain\Account\PublicLinkServiceInterface;
|
||||
use SP\Domain\Account\Services\AccountAcl;
|
||||
use SP\Domain\Account\Services\PublicLinkService;
|
||||
use SP\Domain\Category\CategoryServiceInterface;
|
||||
use SP\Domain\Category\Services\CategoryService;
|
||||
use SP\Domain\Client\ClientServiceInterface;
|
||||
use SP\Domain\Client\Services\ClientService;
|
||||
use SP\Domain\Crypt\MasterPassServiceInterface;
|
||||
use SP\Domain\CustomField\CustomFieldServiceInterface;
|
||||
use SP\Domain\ItemPreset\ItemPresetInterface;
|
||||
use SP\Domain\ItemPreset\Services\ItemPresetService;
|
||||
use SP\Domain\ItemPreset\ItemPresetServiceInterface;
|
||||
use SP\Domain\Tag\Services\TagService;
|
||||
use SP\Domain\User\Services\UpdatedMasterPassException;
|
||||
use SP\Domain\User\Services\UserGroupService;
|
||||
@@ -73,16 +72,17 @@ final class AccountHelper extends HelperBase
|
||||
{
|
||||
use ItemTrait;
|
||||
|
||||
private Acl $acl;
|
||||
private \SP\Domain\Account\AccountServiceInterface $accountService;
|
||||
private AccountHistoryServiceInterface $accountHistoryService;
|
||||
private PublicLinkService $publicLinkService;
|
||||
private ItemPresetService $itemPresetService;
|
||||
private Acl $acl;
|
||||
private AccountServiceInterface $accountService;
|
||||
private AccountHistoryServiceInterface $accountHistoryService;
|
||||
private PublicLinkServiceInterface $publicLinkService;
|
||||
private ItemPresetServiceInterface $itemPresetService;
|
||||
private MasterPassServiceInterface $masterPassService;
|
||||
private AccountActionsHelper $accountActionsHelper;
|
||||
private \SP\Domain\Account\AccountAclServiceInterface $accountAclService;
|
||||
private CategoryService $categoryService;
|
||||
private ClientService $clientService;
|
||||
private AccountActionsHelper $accountActionsHelper;
|
||||
private AccountAclServiceInterface $accountAclService;
|
||||
private CategoryServiceInterface $categoryService;
|
||||
private ClientServiceInterface $clientService;
|
||||
private CustomFieldServiceInterface $customFieldService;
|
||||
private ?int $actionId = null;
|
||||
private ?AccountAcl $accountAcl = null;
|
||||
private ?int $accountId = null;
|
||||
@@ -94,14 +94,15 @@ final class AccountHelper extends HelperBase
|
||||
RequestInterface $request,
|
||||
Acl $acl,
|
||||
AccountServiceInterface $accountService,
|
||||
\SP\Domain\Account\AccountHistoryServiceInterface $accountHistoryService,
|
||||
AccountHistoryServiceInterface $accountHistoryService,
|
||||
PublicLinkServiceInterface $publicLinkService,
|
||||
ItemPresetService $itemPresetService,
|
||||
ItemPresetServiceInterface $itemPresetService,
|
||||
MasterPassServiceInterface $masterPassService,
|
||||
AccountActionsHelper $accountActionsHelper,
|
||||
AccountAclServiceInterface $accountAclService,
|
||||
CategoryServiceInterface $categoryService,
|
||||
ClientServiceInterface $clientService
|
||||
ClientServiceInterface $clientService,
|
||||
CustomFieldServiceInterface $customFieldService
|
||||
) {
|
||||
parent::__construct($application, $template, $request);
|
||||
|
||||
@@ -115,6 +116,7 @@ final class AccountHelper extends HelperBase
|
||||
$this->accountAclService = $accountAclService;
|
||||
$this->categoryService = $categoryService;
|
||||
$this->clientService = $clientService;
|
||||
$this->customFieldService = $customFieldService;
|
||||
|
||||
$this->view->assign('changesHash');
|
||||
$this->view->assign('chkUserEdit', false);
|
||||
@@ -385,7 +387,8 @@ final class AccountHelper extends HelperBase
|
||||
'customFields',
|
||||
$this->getCustomFieldsForItem(
|
||||
ActionsInterface::ACCOUNT,
|
||||
$this->accountId
|
||||
$this->accountId,
|
||||
$this->customFieldService
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -35,8 +35,8 @@ use SP\Domain\Common\Services\Service;
|
||||
use SP\Domain\Common\Services\ServiceException;
|
||||
use SP\Domain\Common\Services\ServiceItemTrait;
|
||||
use SP\Domain\CustomField\CustomFieldDefServiceInterface;
|
||||
use SP\Domain\CustomField\CustomFieldServiceInterface;
|
||||
use SP\Domain\CustomField\In\CustomFieldDefRepositoryInterface;
|
||||
use SP\Domain\CustomField\In\CustomFieldRepositoryInterface;
|
||||
use SP\Infrastructure\Common\Repositories\NoSuchItemException;
|
||||
use SP\Infrastructure\Database\DatabaseInterface;
|
||||
use SP\Infrastructure\Database\QueryResult;
|
||||
@@ -51,19 +51,19 @@ final class CustomFieldDefService extends Service implements CustomFieldDefServi
|
||||
use ServiceItemTrait;
|
||||
|
||||
protected CustomFieldDefRepositoryInterface $customFieldDefRepository;
|
||||
protected CustomFieldServiceInterface $customFieldService;
|
||||
protected CustomFieldRepositoryInterface $customFieldRepository;
|
||||
private DatabaseInterface $database;
|
||||
|
||||
public function __construct(
|
||||
Application $application,
|
||||
CustomFieldDefRepositoryInterface $customFieldDefRepository,
|
||||
CustomFieldServiceInterface $customFieldService,
|
||||
CustomFieldRepositoryInterface $customFieldRepository,
|
||||
DatabaseInterface $database
|
||||
) {
|
||||
parent::__construct($application);
|
||||
|
||||
$this->customFieldDefRepository = $customFieldDefRepository;
|
||||
$this->customFieldService = $customFieldService;
|
||||
$this->customFieldRepository = $customFieldRepository;
|
||||
$this->database = $database;
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ final class CustomFieldDefService extends Service implements CustomFieldDefServi
|
||||
{
|
||||
$this->transactionAware(
|
||||
function () use ($id) {
|
||||
$this->customFieldService->deleteCustomFieldDefinitionData($id);
|
||||
$this->customFieldRepository->deleteCustomFieldDefinitionData($id);
|
||||
|
||||
if ($this->customFieldDefRepository->delete($id) === 0) {
|
||||
throw new NoSuchItemException(__u('Field not found'), SPException::INFO);
|
||||
@@ -133,7 +133,7 @@ final class CustomFieldDefService extends Service implements CustomFieldDefServi
|
||||
{
|
||||
$this->transactionAware(
|
||||
function () use ($ids) {
|
||||
$this->customFieldService->deleteCustomFieldDefinitionDataBatch($ids);
|
||||
$this->customFieldRepository->deleteCustomFieldDefinitionDataBatch($ids);
|
||||
|
||||
if ($this->customFieldDefRepository->deleteByIdBatch($ids) !== count($ids)) {
|
||||
throw new ServiceException(
|
||||
@@ -181,7 +181,7 @@ final class CustomFieldDefService extends Service implements CustomFieldDefServi
|
||||
|
||||
// Delete the data used by the items using the previous definition
|
||||
if ($customFieldDefinitionData->getModuleId() !== $itemData->moduleId) {
|
||||
$this->customFieldService->deleteCustomFieldDefinitionData($customFieldDefinitionData->getId());
|
||||
$this->customFieldRepository->deleteCustomFieldDefinitionData($customFieldDefinitionData->getId());
|
||||
}
|
||||
|
||||
if ($this->customFieldDefRepository->update($itemData) !== 1) {
|
||||
|
||||
@@ -34,9 +34,9 @@ use SP\DataModel\CustomFieldData;
|
||||
use SP\Domain\Common\Services\Service;
|
||||
use SP\Domain\Common\Services\ServiceException;
|
||||
use SP\Domain\CustomField\CustomFieldServiceInterface;
|
||||
use SP\Domain\CustomField\In\CustomFieldDefRepositoryInterface;
|
||||
use SP\Domain\CustomField\In\CustomFieldRepositoryInterface;
|
||||
use SP\Infrastructure\Common\Repositories\NoSuchItemException;
|
||||
use SP\Infrastructure\CustomField\Repositories\CustomFieldRepository;
|
||||
|
||||
/**
|
||||
* Class CustomFieldService
|
||||
@@ -45,18 +45,18 @@ use SP\Infrastructure\CustomField\Repositories\CustomFieldRepository;
|
||||
*/
|
||||
final class CustomFieldService extends Service implements CustomFieldServiceInterface
|
||||
{
|
||||
protected CustomFieldRepository $customFieldRepository;
|
||||
protected CustomFieldDefService $customFieldDefService;
|
||||
protected CustomFieldRepositoryInterface $customFieldRepository;
|
||||
protected CustomFieldDefRepositoryInterface $customFieldDefRepository;
|
||||
|
||||
public function __construct(
|
||||
Application $application,
|
||||
CustomFieldRepositoryInterface $customFieldRepository,
|
||||
CustomFieldDefService $customFieldDefService
|
||||
CustomFieldDefRepositoryInterface $customFieldDefRepository
|
||||
) {
|
||||
parent::__construct($application);
|
||||
|
||||
$this->customFieldRepository = $customFieldRepository;
|
||||
$this->customFieldDefService = $customFieldDefService;
|
||||
$this->customFieldDefRepository = $customFieldDefRepository;
|
||||
}
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ final class CustomFieldService extends Service implements CustomFieldServiceInte
|
||||
return $this->create($customFieldData);
|
||||
}
|
||||
|
||||
if ($this->customFieldDefService->getById($customFieldData->getDefinitionId())->getisEncrypted()) {
|
||||
if ($this->customFieldDefRepository->getById($customFieldData->getDefinitionId())->getisEncrypted()) {
|
||||
$this->setSecureData($customFieldData);
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ final class CustomFieldService extends Service implements CustomFieldServiceInte
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->customFieldDefService->getById($customFieldData->getDefinitionId())->getisEncrypted()) {
|
||||
if ($this->customFieldDefRepository->getById($customFieldData->getDefinitionId())->getisEncrypted()) {
|
||||
$this->setSecureData($customFieldData);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user