chore(Refactor): Use abstract instead of trait

Signed-off-by: Rubén D <nuxsmin@syspass.org>
This commit is contained in:
Rubén D
2024-08-23 16:53:19 +02:00
parent ed5ed78dd2
commit 5b0efb61a0
4 changed files with 26 additions and 88 deletions

View File

@@ -24,7 +24,6 @@
namespace SP\Modules\Web\Controllers\AccountFile;
use JsonException;
use SP\Core\Application;
use SP\Domain\Account\Ports\AccountFileService;
use SP\Domain\Auth\Services\AuthException;
@@ -33,25 +32,20 @@ use SP\Domain\Core\Exceptions\ConstraintException;
use SP\Domain\Core\Exceptions\QueryException;
use SP\Domain\Core\Exceptions\SessionTimeout;
use SP\Domain\Core\Exceptions\SPException;
use SP\Domain\Http\Dtos\JsonMessage;
use SP\Html\DataGrid\DataGridInterface;
use SP\Modules\Web\Controllers\ControllerBase;
use SP\Modules\Web\Controllers\Helpers\Grid\FileGrid;
use SP\Modules\Web\Controllers\Traits\JsonTrait;
use SP\Modules\Web\Controllers\SearchGridControllerBase;
use SP\Mvc\Controller\ItemTrait;
use SP\Mvc\Controller\WebControllerHelper;
use function SP\__u;
/**
* Class SearchController
*
* @package SP\Modules\Web\Controllers
*/
final class SearchController extends ControllerBase
final class SearchController extends SearchGridControllerBase
{
use ItemTrait;
use JsonTrait;
/**
* @throws AuthException
@@ -68,32 +62,6 @@ final class SearchController extends ControllerBase
$this->checkLoggedIn();
}
/**
* Search action
*
* @return bool
* @throws JsonException
* @throws ConstraintException
* @throws QueryException
* @throws SPException
*/
public function searchAction(): bool
{
/** @noinspection DuplicatedCode */
if (!$this->acl->checkUserAccess(AclActionsInterface::ACCOUNT_FILE_SEARCH)) {
return $this->returnJsonResponse(
JsonMessage::JSON_ERROR,
__u('You don\'t have permission to do this operation')
);
}
$this->view->addTemplate('datagrid-table', 'grid');
$this->view->assign('index', $this->request->analyzeInt('activetab', 0));
$this->view->assign('data', $this->getSearchGrid());
return $this->returnJsonResponseData(['html' => $this->render()]);
}
/**
* getSearchGrid
*
@@ -111,4 +79,9 @@ final class SearchController extends ControllerBase
$itemSearchData
);
}
protected function getAclAction(): int
{
return AclActionsInterface::ACCOUNT_FILE_SEARCH;
}
}