mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-03 07:04:07 +01:00
refactor: [WIP] Create base classes for account view and save.
Signed-off-by: Rubén D <nuxsmin@syspass.org>
This commit is contained in:
@@ -28,6 +28,9 @@ use SP\Core\Context\ContextBase;
|
||||
use SP\Domain\Account\Services\AccountAclService;
|
||||
use SP\Modules\Web\Controllers\ControllerBase;
|
||||
|
||||
/**
|
||||
* AccountControllerBase
|
||||
*/
|
||||
abstract class AccountControllerBase extends ControllerBase
|
||||
{
|
||||
private const LOGIN_NOT_REQUIRED = ['ViewLinkController'];
|
||||
@@ -38,7 +41,7 @@ abstract class AccountControllerBase extends ControllerBase
|
||||
* @throws \SP\Core\Exceptions\SessionTimeout
|
||||
* @throws \SP\Domain\Auth\Services\AuthException
|
||||
*/
|
||||
protected function initialize(): void
|
||||
final protected function initialize(): void
|
||||
{
|
||||
if (in_array(static::class, self::LOGIN_NOT_REQUIRED)) {
|
||||
$this->checkLoggedIn();
|
||||
|
||||
64
app/modules/web/Controllers/Account/AccountSaveBase.php
Normal file
64
app/modules/web/Controllers/Account/AccountSaveBase.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/*
|
||||
* sysPass
|
||||
*
|
||||
* @author nuxsmin
|
||||
* @link https://syspass.org
|
||||
* @copyright 2012-2022, Rubén Domínguez nuxsmin@$syspass.org
|
||||
*
|
||||
* This file is part of sysPass.
|
||||
*
|
||||
* sysPass is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* sysPass 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace SP\Modules\Web\Controllers\Account;
|
||||
|
||||
|
||||
use SP\Core\Application;
|
||||
use SP\Domain\Account\AccountPresetServiceInterface;
|
||||
use SP\Domain\Account\AccountServiceInterface;
|
||||
use SP\Domain\CustomField\CustomFieldServiceInterface;
|
||||
use SP\Modules\Web\Controllers\Traits\JsonTrait;
|
||||
use SP\Modules\Web\Forms\AccountForm;
|
||||
use SP\Mvc\Controller\ItemTrait;
|
||||
use SP\Mvc\Controller\WebControllerHelper;
|
||||
|
||||
/**
|
||||
* Class AccountSaveBase
|
||||
*/
|
||||
abstract class AccountSaveBase extends AccountControllerBase
|
||||
{
|
||||
use JsonTrait, ItemTrait;
|
||||
|
||||
protected AccountServiceInterface $accountService;
|
||||
protected AccountForm $accountForm;
|
||||
protected CustomFieldServiceInterface $customFieldService;
|
||||
|
||||
public function __construct(
|
||||
Application $application,
|
||||
WebControllerHelper $webControllerHelper,
|
||||
AccountServiceInterface $accountService,
|
||||
AccountPresetServiceInterface $accountPresetService,
|
||||
CustomFieldServiceInterface $customFieldService
|
||||
) {
|
||||
parent::__construct(
|
||||
$application,
|
||||
$webControllerHelper
|
||||
);
|
||||
|
||||
$this->accountService = $accountService;
|
||||
$this->customFieldService = $customFieldService;
|
||||
$this->accountForm = new AccountForm($application, $this->request, $accountPresetService);
|
||||
}
|
||||
}
|
||||
54
app/modules/web/Controllers/Account/AccountViewBase.php
Normal file
54
app/modules/web/Controllers/Account/AccountViewBase.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/*
|
||||
* sysPass
|
||||
*
|
||||
* @author nuxsmin
|
||||
* @link https://syspass.org
|
||||
* @copyright 2012-2022, Rubén Domínguez nuxsmin@$syspass.org
|
||||
*
|
||||
* This file is part of sysPass.
|
||||
*
|
||||
* sysPass is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* sysPass 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace SP\Modules\Web\Controllers\Account;
|
||||
|
||||
use SP\Core\Application;
|
||||
use SP\Core\UI\ThemeIcons;
|
||||
use SP\Domain\Account\AccountServiceInterface;
|
||||
use SP\Modules\Web\Controllers\Helpers\Account\AccountHelper;
|
||||
use SP\Mvc\Controller\WebControllerHelper;
|
||||
|
||||
/**
|
||||
* A class for al viewable actions
|
||||
*/
|
||||
abstract class AccountViewBase extends AccountControllerBase
|
||||
{
|
||||
protected AccountServiceInterface $accountService;
|
||||
protected AccountHelper $accountHelper;
|
||||
protected ThemeIcons $icons;
|
||||
|
||||
public function __construct(
|
||||
Application $application,
|
||||
WebControllerHelper $webControllerHelper,
|
||||
AccountServiceInterface $accountService,
|
||||
AccountHelper $accountHelper
|
||||
) {
|
||||
parent::__construct($application, $webControllerHelper);
|
||||
|
||||
$this->accountService = $accountService;
|
||||
$this->accountHelper = $accountHelper;
|
||||
$this->icons = $this->theme->getIcons();
|
||||
}
|
||||
}
|
||||
@@ -24,39 +24,16 @@
|
||||
|
||||
namespace SP\Modules\Web\Controllers\Account;
|
||||
|
||||
|
||||
use Exception;
|
||||
use SP\Core\Acl\ActionsInterface;
|
||||
use SP\Core\Application;
|
||||
use SP\Core\Events\Event;
|
||||
use SP\Core\UI\ThemeIcons;
|
||||
use SP\Domain\Account\AccountServiceInterface;
|
||||
use SP\Modules\Web\Controllers\Helpers\Account\AccountHelper;
|
||||
use SP\Mvc\Controller\WebControllerHelper;
|
||||
use SP\Util\ErrorUtil;
|
||||
|
||||
final class CopyController extends AccountControllerBase
|
||||
/**
|
||||
* Class CopyController
|
||||
*/
|
||||
final class CopyController extends AccountViewBase
|
||||
{
|
||||
private AccountHelper $accountHelper;
|
||||
private ThemeIcons $icons;
|
||||
private AccountServiceInterface $accountService;
|
||||
|
||||
public function __construct(
|
||||
Application $application,
|
||||
WebControllerHelper $webControllerHelper,
|
||||
AccountHelper $accountHelper,
|
||||
AccountServiceInterface $accountService
|
||||
) {
|
||||
parent::__construct(
|
||||
$application,
|
||||
$webControllerHelper
|
||||
);
|
||||
|
||||
$this->accountHelper = $accountHelper;
|
||||
$this->accountService = $accountService;
|
||||
$this->icons = $this->theme->getIcons();
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy action
|
||||
*
|
||||
@@ -94,10 +71,7 @@ final class CopyController extends AccountControllerBase
|
||||
} catch (Exception $e) {
|
||||
processException($e);
|
||||
|
||||
$this->eventDispatcher->notifyEvent(
|
||||
'exception',
|
||||
new Event($e)
|
||||
);
|
||||
$this->eventDispatcher->notifyEvent('exception', new Event($e));
|
||||
|
||||
if ($this->isAjax === false && !$this->view->isUpgraded()) {
|
||||
$this->upgradeView();
|
||||
|
||||
@@ -28,21 +28,25 @@ namespace SP\Modules\Web\Controllers\Account;
|
||||
use SP\Core\Application;
|
||||
use SP\Core\Events\Event;
|
||||
use SP\Core\Events\EventMessage;
|
||||
use SP\Domain\Account\AccountServiceInterface;
|
||||
use SP\Modules\Web\Controllers\Helpers\Account\AccountPasswordHelper;
|
||||
use SP\Modules\Web\Controllers\Traits\JsonTrait;
|
||||
use SP\Mvc\Controller\WebControllerHelper;
|
||||
|
||||
/**
|
||||
* Class CopyPassController
|
||||
*/
|
||||
final class CopyPassController extends AccountControllerBase
|
||||
{
|
||||
use JsonTrait;
|
||||
|
||||
private \SP\Domain\Account\AccountServiceInterface $accountService;
|
||||
private AccountPasswordHelper $accountPasswordHelper;
|
||||
private AccountServiceInterface $accountService;
|
||||
private AccountPasswordHelper $accountPasswordHelper;
|
||||
|
||||
public function __construct(
|
||||
Application $application,
|
||||
WebControllerHelper $webControllerHelper,
|
||||
\SP\Domain\Account\AccountServiceInterface $accountService,
|
||||
AccountServiceInterface $accountService,
|
||||
AccountPasswordHelper $accountPasswordHelper,
|
||||
) {
|
||||
parent::__construct(
|
||||
|
||||
@@ -24,25 +24,28 @@
|
||||
|
||||
namespace SP\Modules\Web\Controllers\Account;
|
||||
|
||||
|
||||
use SP\Core\Application;
|
||||
use SP\Core\Events\Event;
|
||||
use SP\Core\Events\EventMessage;
|
||||
use SP\Domain\Account\AccountServiceInterface;
|
||||
use SP\Modules\Web\Controllers\Helpers\Account\AccountPasswordHelper;
|
||||
use SP\Modules\Web\Controllers\Traits\JsonTrait;
|
||||
use SP\Mvc\Controller\WebControllerHelper;
|
||||
|
||||
/**
|
||||
* Class CopyPassHistoryController
|
||||
*/
|
||||
final class CopyPassHistoryController extends AccountControllerBase
|
||||
{
|
||||
use JsonTrait;
|
||||
|
||||
private \SP\Domain\Account\AccountServiceInterface $accountService;
|
||||
private AccountPasswordHelper $accountPasswordHelper;
|
||||
private AccountServiceInterface $accountService;
|
||||
private AccountPasswordHelper $accountPasswordHelper;
|
||||
|
||||
public function __construct(
|
||||
Application $application,
|
||||
WebControllerHelper $webControllerHelper,
|
||||
\SP\Domain\Account\AccountServiceInterface $accountService,
|
||||
AccountServiceInterface $accountService,
|
||||
AccountPasswordHelper $accountPasswordHelper,
|
||||
) {
|
||||
parent::__construct(
|
||||
|
||||
@@ -24,35 +24,16 @@
|
||||
|
||||
namespace SP\Modules\Web\Controllers\Account;
|
||||
|
||||
|
||||
use Exception;
|
||||
use SP\Core\Acl\ActionsInterface;
|
||||
use SP\Core\Application;
|
||||
use SP\Core\Events\Event;
|
||||
use SP\Core\UI\ThemeIcons;
|
||||
use SP\Modules\Web\Controllers\Helpers\Account\AccountHelper;
|
||||
use SP\Mvc\Controller\WebControllerHelper;
|
||||
use SP\Util\ErrorUtil;
|
||||
|
||||
final class CreateController extends AccountControllerBase
|
||||
/**
|
||||
* Class CreateController
|
||||
*/
|
||||
final class CreateController extends AccountViewBase
|
||||
{
|
||||
private AccountHelper $accountHelper;
|
||||
private ThemeIcons $icons;
|
||||
|
||||
public function __construct(
|
||||
Application $application,
|
||||
WebControllerHelper $webControllerHelper,
|
||||
AccountHelper $accountHelper
|
||||
) {
|
||||
parent::__construct(
|
||||
$application,
|
||||
$webControllerHelper
|
||||
);
|
||||
|
||||
$this->accountHelper = $accountHelper;
|
||||
$this->icons = $this->theme->getIcons();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create action
|
||||
*/
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
namespace SP\Modules\Web\Controllers\Account;
|
||||
|
||||
|
||||
use Exception;
|
||||
use SP\Core\Acl\ActionsInterface;
|
||||
use SP\Core\Application;
|
||||
@@ -35,6 +34,9 @@ use SP\Modules\Web\Controllers\Helpers\Account\AccountHelper;
|
||||
use SP\Mvc\Controller\WebControllerHelper;
|
||||
use SP\Util\ErrorUtil;
|
||||
|
||||
/**
|
||||
* Class DeleteController
|
||||
*/
|
||||
final class DeleteController extends AccountControllerBase
|
||||
{
|
||||
private AccountHelper $accountHelper;
|
||||
|
||||
@@ -24,38 +24,16 @@
|
||||
|
||||
namespace SP\Modules\Web\Controllers\Account;
|
||||
|
||||
|
||||
use Exception;
|
||||
use SP\Core\Acl\ActionsInterface;
|
||||
use SP\Core\Application;
|
||||
use SP\Core\Events\Event;
|
||||
use SP\Core\UI\ThemeIcons;
|
||||
use SP\Domain\Account\AccountServiceInterface;
|
||||
use SP\Modules\Web\Controllers\Helpers\Account\AccountHelper;
|
||||
use SP\Mvc\Controller\WebControllerHelper;
|
||||
use SP\Util\ErrorUtil;
|
||||
|
||||
final class EditController extends AccountControllerBase
|
||||
/**
|
||||
* Class EditController
|
||||
*/
|
||||
final class EditController extends AccountViewBase
|
||||
{
|
||||
private AccountHelper $accountHelper;
|
||||
private ThemeIcons $icons;
|
||||
private AccountServiceInterface $accountService;
|
||||
|
||||
public function __construct(
|
||||
Application $application,
|
||||
WebControllerHelper $webControllerHelper,
|
||||
AccountHelper $accountHelper,
|
||||
\SP\Domain\Account\AccountServiceInterface $accountService
|
||||
) {
|
||||
parent::__construct(
|
||||
$application,
|
||||
$webControllerHelper
|
||||
);
|
||||
|
||||
$this->accountHelper = $accountHelper;
|
||||
$this->accountService = $accountService;
|
||||
$this->icons = $this->theme->getIcons();
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit action
|
||||
@@ -96,10 +74,7 @@ final class EditController extends AccountControllerBase
|
||||
} catch (Exception $e) {
|
||||
processException($e);
|
||||
|
||||
$this->eventDispatcher->notifyEvent(
|
||||
'exception',
|
||||
new Event($e)
|
||||
);
|
||||
$this->eventDispatcher->notifyEvent('exception', new Event($e));
|
||||
|
||||
if ($this->isAjax === false && !$this->view->isUpgraded()) {
|
||||
$this->upgradeView();
|
||||
|
||||
@@ -24,41 +24,18 @@
|
||||
|
||||
namespace SP\Modules\Web\Controllers\Account;
|
||||
|
||||
|
||||
use Exception;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use SP\Core\Acl\ActionsInterface;
|
||||
use SP\Core\Application;
|
||||
use SP\Core\Events\Event;
|
||||
use SP\Core\UI\ThemeIcons;
|
||||
use SP\Domain\Account\AccountServiceInterface;
|
||||
use SP\Modules\Web\Controllers\Helpers\Account\AccountHelper;
|
||||
use SP\Mvc\Controller\WebControllerHelper;
|
||||
use SP\Util\ErrorUtil;
|
||||
|
||||
final class EditPassController extends AccountControllerBase
|
||||
/**
|
||||
* Class EditPassController
|
||||
*/
|
||||
final class EditPassController extends AccountViewBase
|
||||
{
|
||||
private AccountHelper $accountHelper;
|
||||
private ThemeIcons $icons;
|
||||
private \SP\Domain\Account\AccountServiceInterface $accountService;
|
||||
|
||||
public function __construct(
|
||||
Application $application,
|
||||
WebControllerHelper $webControllerHelper,
|
||||
AccountHelper $accountHelper,
|
||||
AccountServiceInterface $accountService
|
||||
) {
|
||||
parent::__construct(
|
||||
$application,
|
||||
$webControllerHelper
|
||||
);
|
||||
|
||||
$this->accountHelper = $accountHelper;
|
||||
$this->accountService = $accountService;
|
||||
$this->icons = $this->theme->getIcons();
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtener los datos para mostrar el interface para modificar la clave de cuenta
|
||||
*
|
||||
|
||||
@@ -32,6 +32,9 @@ use SP\Modules\Web\Controllers\Helpers\Account\AccountSearchHelper;
|
||||
use SP\Mvc\Controller\WebControllerHelper;
|
||||
use SP\Util\ErrorUtil;
|
||||
|
||||
/**
|
||||
* Class IndexController
|
||||
*/
|
||||
final class IndexController extends AccountControllerBase
|
||||
{
|
||||
private AccountSearchHelper $accountSearchHelper;
|
||||
|
||||
@@ -24,36 +24,16 @@
|
||||
|
||||
namespace SP\Modules\Web\Controllers\Account;
|
||||
|
||||
|
||||
use Exception;
|
||||
use SP\Core\Acl\ActionsInterface;
|
||||
use SP\Core\Application;
|
||||
use SP\Core\Events\Event;
|
||||
use SP\Domain\Account\AccountServiceInterface;
|
||||
use SP\Modules\Web\Controllers\Helpers\Account\AccountHelper;
|
||||
use SP\Mvc\Controller\WebControllerHelper;
|
||||
use SP\Util\ErrorUtil;
|
||||
|
||||
final class RequestAccessController extends AccountControllerBase
|
||||
/**
|
||||
* Class RequestAccessController
|
||||
*/
|
||||
final class RequestAccessController extends AccountViewBase
|
||||
{
|
||||
private AccountHelper $accountHelper;
|
||||
private AccountServiceInterface $accountService;
|
||||
|
||||
public function __construct(
|
||||
Application $application,
|
||||
WebControllerHelper $webControllerHelper,
|
||||
AccountHelper $accountHelper,
|
||||
AccountServiceInterface $accountService
|
||||
) {
|
||||
parent::__construct(
|
||||
$application,
|
||||
$webControllerHelper
|
||||
);
|
||||
|
||||
$this->accountHelper = $accountHelper;
|
||||
$this->accountService = $accountService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtener los datos para mostrar el interface de solicitud de cambios en una cuenta
|
||||
*
|
||||
|
||||
@@ -24,47 +24,19 @@
|
||||
|
||||
namespace SP\Modules\Web\Controllers\Account;
|
||||
|
||||
|
||||
use Exception;
|
||||
use SP\Core\Acl\Acl;
|
||||
use SP\Core\Acl\ActionsInterface;
|
||||
use SP\Core\Application;
|
||||
use SP\Core\Events\Event;
|
||||
use SP\Core\Events\EventMessage;
|
||||
use SP\Core\Exceptions\ValidationException;
|
||||
use SP\Domain\Account\AccountServiceInterface;
|
||||
use SP\Domain\CustomField\CustomFieldServiceInterface;
|
||||
use SP\Http\JsonResponse;
|
||||
use SP\Modules\Web\Controllers\Traits\JsonTrait;
|
||||
use SP\Modules\Web\Forms\AccountForm;
|
||||
use SP\Mvc\Controller\ItemTrait;
|
||||
use SP\Mvc\Controller\WebControllerHelper;
|
||||
|
||||
final class SaveCopyController extends AccountControllerBase
|
||||
/**
|
||||
* Class SaveCopyController
|
||||
*/
|
||||
final class SaveCopyController extends AccountSaveBase
|
||||
{
|
||||
use JsonTrait, ItemTrait;
|
||||
|
||||
private AccountServiceInterface $accountService;
|
||||
private AccountForm $accountForm;
|
||||
private CustomFieldServiceInterface $customFieldService;
|
||||
|
||||
public function __construct(
|
||||
Application $application,
|
||||
WebControllerHelper $webControllerHelper,
|
||||
AccountServiceInterface $accountService,
|
||||
\SP\Domain\Account\AccountPresetServiceInterface $accountPresetService,
|
||||
CustomFieldServiceInterface $customFieldService
|
||||
) {
|
||||
parent::__construct(
|
||||
$application,
|
||||
$webControllerHelper
|
||||
);
|
||||
|
||||
$this->accountService = $accountService;
|
||||
$this->customFieldService = $customFieldService;
|
||||
$this->accountForm = new AccountForm($application, $this->request, $accountPresetService);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws \JsonException
|
||||
|
||||
@@ -24,48 +24,19 @@
|
||||
|
||||
namespace SP\Modules\Web\Controllers\Account;
|
||||
|
||||
|
||||
use Exception;
|
||||
use SP\Core\Acl\Acl;
|
||||
use SP\Core\Acl\ActionsInterface;
|
||||
use SP\Core\Application;
|
||||
use SP\Core\Events\Event;
|
||||
use SP\Core\Events\EventMessage;
|
||||
use SP\Core\Exceptions\ValidationException;
|
||||
use SP\Domain\Account\AccountPresetServiceInterface;
|
||||
use SP\Domain\Account\AccountServiceInterface;
|
||||
use SP\Domain\CustomField\CustomFieldServiceInterface;
|
||||
use SP\Http\JsonResponse;
|
||||
use SP\Modules\Web\Controllers\Traits\JsonTrait;
|
||||
use SP\Modules\Web\Forms\AccountForm;
|
||||
use SP\Mvc\Controller\ItemTrait;
|
||||
use SP\Mvc\Controller\WebControllerHelper;
|
||||
|
||||
final class SaveCreateController extends AccountControllerBase
|
||||
/**
|
||||
* Class SaveCreateController
|
||||
*/
|
||||
final class SaveCreateController extends AccountSaveBase
|
||||
{
|
||||
use JsonTrait, ItemTrait;
|
||||
|
||||
private AccountServiceInterface $accountService;
|
||||
private AccountForm $accountForm;
|
||||
private CustomFieldServiceInterface $customFieldService;
|
||||
|
||||
public function __construct(
|
||||
Application $application,
|
||||
WebControllerHelper $webControllerHelper,
|
||||
AccountServiceInterface $accountService,
|
||||
AccountPresetServiceInterface $accountPresetService,
|
||||
CustomFieldServiceInterface $customFieldService
|
||||
) {
|
||||
parent::__construct(
|
||||
$application,
|
||||
$webControllerHelper
|
||||
);
|
||||
|
||||
$this->accountService = $accountService;
|
||||
$this->customFieldService = $customFieldService;
|
||||
$this->accountForm = new AccountForm($application, $this->request, $accountPresetService);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws \JsonException
|
||||
|
||||
@@ -37,12 +37,15 @@ use SP\Modules\Web\Controllers\Traits\JsonTrait;
|
||||
use SP\Mvc\Controller\ItemTrait;
|
||||
use SP\Mvc\Controller\WebControllerHelper;
|
||||
|
||||
/**
|
||||
* Class SaveDeleteController
|
||||
*/
|
||||
final class SaveDeleteController extends AccountControllerBase
|
||||
{
|
||||
use JsonTrait, ItemTrait;
|
||||
|
||||
private \SP\Domain\Account\AccountServiceInterface $accountService;
|
||||
private CustomFieldServiceInterface $customFieldService;
|
||||
private AccountServiceInterface $accountService;
|
||||
private CustomFieldServiceInterface $customFieldService;
|
||||
|
||||
public function __construct(
|
||||
Application $application,
|
||||
|
||||
@@ -28,43 +28,16 @@ namespace SP\Modules\Web\Controllers\Account;
|
||||
use Exception;
|
||||
use SP\Core\Acl\Acl;
|
||||
use SP\Core\Acl\ActionsInterface;
|
||||
use SP\Core\Application;
|
||||
use SP\Core\Events\Event;
|
||||
use SP\Core\Events\EventMessage;
|
||||
use SP\Core\Exceptions\ValidationException;
|
||||
use SP\Domain\Account\AccountPresetServiceInterface;
|
||||
use SP\Domain\CustomField\CustomFieldServiceInterface;
|
||||
use SP\Http\JsonResponse;
|
||||
use SP\Modules\Web\Controllers\Traits\JsonTrait;
|
||||
use SP\Modules\Web\Forms\AccountForm;
|
||||
use SP\Mvc\Controller\ItemTrait;
|
||||
use SP\Mvc\Controller\WebControllerHelper;
|
||||
|
||||
final class SaveEditController extends AccountControllerBase
|
||||
/**
|
||||
* Class SaveEditController
|
||||
*/
|
||||
final class SaveEditController extends AccountSaveBase
|
||||
{
|
||||
use JsonTrait, ItemTrait;
|
||||
|
||||
private \SP\Domain\Account\AccountServiceInterface $accountService;
|
||||
private AccountForm $accountForm;
|
||||
private CustomFieldServiceInterface $customFieldService;
|
||||
|
||||
public function __construct(
|
||||
Application $application,
|
||||
WebControllerHelper $webControllerHelper,
|
||||
\SP\Domain\Account\AccountServiceInterface $accountService,
|
||||
AccountPresetServiceInterface $accountPresetService,
|
||||
CustomFieldServiceInterface $customFieldService
|
||||
) {
|
||||
parent::__construct(
|
||||
$application,
|
||||
$webControllerHelper
|
||||
);
|
||||
|
||||
$this->accountService = $accountService;
|
||||
$this->customFieldService = $customFieldService;
|
||||
$this->accountForm = new AccountForm($application, $this->request, $accountPresetService);
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves edit action
|
||||
*
|
||||
|
||||
@@ -39,6 +39,9 @@ use SP\Modules\Web\Controllers\Traits\JsonTrait;
|
||||
use SP\Modules\Web\Forms\AccountForm;
|
||||
use SP\Mvc\Controller\WebControllerHelper;
|
||||
|
||||
/**
|
||||
* Class SaveEditPassController
|
||||
*/
|
||||
final class SaveEditPassController extends AccountControllerBase
|
||||
{
|
||||
use JsonTrait;
|
||||
|
||||
@@ -36,6 +36,9 @@ use SP\Http\JsonResponse;
|
||||
use SP\Modules\Web\Controllers\Traits\JsonTrait;
|
||||
use SP\Mvc\Controller\WebControllerHelper;
|
||||
|
||||
/**
|
||||
* Class SaveEditRestoreController
|
||||
*/
|
||||
final class SaveEditRestoreController extends AccountControllerBase
|
||||
{
|
||||
use JsonTrait;
|
||||
@@ -45,7 +48,7 @@ final class SaveEditRestoreController extends AccountControllerBase
|
||||
public function __construct(
|
||||
Application $application,
|
||||
WebControllerHelper $webControllerHelper,
|
||||
\SP\Domain\Account\AccountServiceInterface $accountService
|
||||
AccountServiceInterface $accountService
|
||||
) {
|
||||
parent::__construct(
|
||||
$application,
|
||||
|
||||
@@ -33,6 +33,7 @@ use SP\Core\Bootstrap\BootstrapBase;
|
||||
use SP\Core\Events\Event;
|
||||
use SP\Core\Events\EventMessage;
|
||||
use SP\Core\Exceptions\ValidationException;
|
||||
use SP\Domain\Account\AccountServiceInterface;
|
||||
use SP\Domain\User\UserServiceInterface;
|
||||
use SP\Http\JsonResponse;
|
||||
use SP\Http\Uri;
|
||||
@@ -40,17 +41,20 @@ use SP\Modules\Web\Controllers\Traits\JsonTrait;
|
||||
use SP\Mvc\Controller\ItemTrait;
|
||||
use SP\Mvc\Controller\WebControllerHelper;
|
||||
|
||||
/**
|
||||
* Class SaveRequestController
|
||||
*/
|
||||
final class SaveRequestController extends AccountControllerBase
|
||||
{
|
||||
use JsonTrait, ItemTrait;
|
||||
|
||||
private \SP\Domain\Account\AccountServiceInterface $accountService;
|
||||
private AccountServiceInterface $accountService;
|
||||
private UserServiceInterface $userService;
|
||||
|
||||
public function __construct(
|
||||
Application $application,
|
||||
WebControllerHelper $webControllerHelper,
|
||||
\SP\Domain\Account\AccountServiceInterface $accountService,
|
||||
AccountServiceInterface $accountService,
|
||||
UserServiceInterface $userService
|
||||
) {
|
||||
parent::__construct(
|
||||
|
||||
@@ -32,6 +32,9 @@ use SP\Modules\Web\Controllers\Helpers\Account\AccountSearchHelper;
|
||||
use SP\Modules\Web\Controllers\Traits\JsonTrait;
|
||||
use SP\Mvc\Controller\WebControllerHelper;
|
||||
|
||||
/**
|
||||
* SearchController
|
||||
*/
|
||||
final class SearchController extends AccountControllerBase
|
||||
{
|
||||
use JsonTrait;
|
||||
@@ -62,9 +65,7 @@ final class SearchController extends AccountControllerBase
|
||||
|
||||
$this->eventDispatcher->notifyEvent('show.account.search', new Event($this));
|
||||
|
||||
return $this->returnJsonResponseData([
|
||||
'html' => $this->render(),
|
||||
]);
|
||||
return $this->returnJsonResponseData(['html' => $this->render()]);
|
||||
} catch (Exception $e) {
|
||||
processException($e);
|
||||
|
||||
|
||||
@@ -27,35 +27,14 @@ namespace SP\Modules\Web\Controllers\Account;
|
||||
|
||||
use Exception;
|
||||
use SP\Core\Acl\ActionsInterface;
|
||||
use SP\Core\Application;
|
||||
use SP\Core\Events\Event;
|
||||
use SP\Core\UI\ThemeIcons;
|
||||
use SP\Domain\Account\AccountServiceInterface;
|
||||
use SP\Modules\Web\Controllers\Helpers\Account\AccountHelper;
|
||||
use SP\Mvc\Controller\WebControllerHelper;
|
||||
use SP\Util\ErrorUtil;
|
||||
|
||||
final class ViewController extends AccountControllerBase
|
||||
/**
|
||||
* ViewController
|
||||
*/
|
||||
final class ViewController extends AccountViewBase
|
||||
{
|
||||
private \SP\Domain\Account\AccountServiceInterface $accountService;
|
||||
private AccountHelper $accountHelper;
|
||||
private ThemeIcons $icons;
|
||||
|
||||
public function __construct(
|
||||
Application $application,
|
||||
WebControllerHelper $webControllerHelper,
|
||||
AccountServiceInterface $accountService,
|
||||
AccountHelper $accountHelper
|
||||
) {
|
||||
parent::__construct(
|
||||
$application,
|
||||
$webControllerHelper
|
||||
);
|
||||
|
||||
$this->accountService = $accountService;
|
||||
$this->accountHelper = $accountHelper;
|
||||
$this->icons = $this->theme->getIcons();
|
||||
}
|
||||
|
||||
/**
|
||||
* View action
|
||||
|
||||
@@ -24,24 +24,27 @@
|
||||
|
||||
namespace SP\Modules\Web\Controllers\Account;
|
||||
|
||||
|
||||
use Exception;
|
||||
use SP\Core\Acl\ActionsInterface;
|
||||
use SP\Core\Application;
|
||||
use SP\Core\Events\Event;
|
||||
use SP\Domain\Account\AccountHistoryServiceInterface;
|
||||
use SP\Modules\Web\Controllers\Helpers\Account\AccountHistoryHelper;
|
||||
use SP\Mvc\Controller\WebControllerHelper;
|
||||
use SP\Util\ErrorUtil;
|
||||
|
||||
/**
|
||||
* ViewHistoryController
|
||||
*/
|
||||
final class ViewHistoryController extends AccountControllerBase
|
||||
{
|
||||
private \SP\Domain\Account\AccountHistoryServiceInterface $accountHistoryService;
|
||||
private AccountHistoryHelper $accountHistoryHelper;
|
||||
private AccountHistoryServiceInterface $accountHistoryService;
|
||||
private AccountHistoryHelper $accountHistoryHelper;
|
||||
|
||||
public function __construct(
|
||||
Application $application,
|
||||
WebControllerHelper $webControllerHelper,
|
||||
\SP\Domain\Account\AccountHistoryServiceInterface $accountHistoryService,
|
||||
AccountHistoryServiceInterface $accountHistoryService,
|
||||
AccountHistoryHelper $accountHistoryHelper
|
||||
) {
|
||||
parent::__construct(
|
||||
|
||||
@@ -35,6 +35,7 @@ use SP\Core\Events\Event;
|
||||
use SP\Core\Events\EventMessage;
|
||||
use SP\Core\UI\ThemeIcons;
|
||||
use SP\DataModel\AccountExtData;
|
||||
use SP\Domain\Account\AccountServiceInterface;
|
||||
use SP\Domain\Account\PublicLinkServiceInterface;
|
||||
use SP\Domain\Account\Services\PublicLinkService;
|
||||
use SP\Http\Uri;
|
||||
@@ -43,17 +44,20 @@ use SP\Util\ErrorUtil;
|
||||
use SP\Util\ImageUtil;
|
||||
use SP\Util\Util;
|
||||
|
||||
/**
|
||||
* Class ViewLinkController
|
||||
*/
|
||||
final class ViewLinkController extends AccountControllerBase
|
||||
{
|
||||
private \SP\Domain\Account\AccountServiceInterface $accountService;
|
||||
private ThemeIcons $icons;
|
||||
private PublicLinkService $publicLinkService;
|
||||
private ImageUtil $imageUtil;
|
||||
private AccountServiceInterface $accountService;
|
||||
private ThemeIcons $icons;
|
||||
private PublicLinkService $publicLinkService;
|
||||
private ImageUtil $imageUtil;
|
||||
|
||||
public function __construct(
|
||||
Application $application,
|
||||
WebControllerHelper $webControllerHelper,
|
||||
\SP\Domain\Account\AccountServiceInterface $accountService,
|
||||
AccountServiceInterface $accountService,
|
||||
PublicLinkServiceInterface $publicLinkService,
|
||||
ImageUtil $imageUtil
|
||||
) {
|
||||
|
||||
@@ -37,6 +37,9 @@ use SP\Modules\Web\Controllers\Helpers\Account\AccountPasswordHelper;
|
||||
use SP\Modules\Web\Controllers\Traits\JsonTrait;
|
||||
use SP\Mvc\Controller\WebControllerHelper;
|
||||
|
||||
/**
|
||||
* Class ViewPassController
|
||||
*/
|
||||
final class ViewPassController extends AccountControllerBase
|
||||
{
|
||||
use JsonTrait;
|
||||
|
||||
@@ -37,6 +37,9 @@ use SP\Modules\Web\Controllers\Helpers\Account\AccountPasswordHelper;
|
||||
use SP\Modules\Web\Controllers\Traits\JsonTrait;
|
||||
use SP\Mvc\Controller\WebControllerHelper;
|
||||
|
||||
/**
|
||||
* Class ViewPassHistoryController
|
||||
*/
|
||||
final class ViewPassHistoryController extends AccountControllerBase
|
||||
{
|
||||
use JsonTrait;
|
||||
|
||||
Reference in New Issue
Block a user