mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-21 07:46:50 +01:00
chore: Remove unneeded classes
Signed-off-by: Rubén D <nuxsmin@syspass.org>
This commit is contained in:
@@ -1,210 +0,0 @@
|
||||
<?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\DataModel;
|
||||
|
||||
use SP\Domain\Common\Models\Model;
|
||||
|
||||
/**
|
||||
* Class AccountSearchData
|
||||
*
|
||||
* @package SP\DataModel
|
||||
*/
|
||||
class AccountSearchVData extends Model
|
||||
{
|
||||
public ?string $publicLinkHash = null;
|
||||
protected ?int $id = 0;
|
||||
protected ?string $name = '';
|
||||
protected ?int $clientId = 0;
|
||||
protected ?string $clientName = null;
|
||||
protected ?int $categoryId = null;
|
||||
protected ?string $categoryName = null;
|
||||
protected ?int $userId = 0;
|
||||
protected ?string $userName = null;
|
||||
protected ?string $userLogin = null;
|
||||
protected ?int $userGroupId = 0;
|
||||
protected ?string $userGroupName = null;
|
||||
protected ?int $userEditId = 0;
|
||||
protected ?string $userEditName = null;
|
||||
protected ?string $userEditLogin = null;
|
||||
protected ?string $login = null;
|
||||
protected ?string $url = null;
|
||||
protected ?string $notes = null;
|
||||
protected ?int $otherUserEdit = null;
|
||||
protected ?int $otherUserGroupEdit = null;
|
||||
protected ?int $dateEdit = null;
|
||||
protected ?int $isPrivate = null;
|
||||
protected ?int $isPrivateGroup = null;
|
||||
protected ?int $passDate = null;
|
||||
protected ?int $passDateChange = null;
|
||||
protected ?int $parentId = null;
|
||||
protected ?int $num_files = null;
|
||||
protected ?int $publicLinkDateExpire = null;
|
||||
protected ?int $publicLinkTotalCountViews = null;
|
||||
|
||||
public function getPublicLinkHash(): ?string
|
||||
{
|
||||
return $this->publicLinkHash;
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getUserId(): ?int
|
||||
{
|
||||
return $this->userId;
|
||||
}
|
||||
|
||||
public function getUserGroupId(): ?int
|
||||
{
|
||||
return $this->userGroupId;
|
||||
}
|
||||
|
||||
public function getUserEditId(): ?int
|
||||
{
|
||||
return $this->userEditId;
|
||||
}
|
||||
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getClientId(): ?int
|
||||
{
|
||||
return $this->clientId;
|
||||
}
|
||||
|
||||
public function getCategoryId(): ?int
|
||||
{
|
||||
return $this->categoryId;
|
||||
}
|
||||
|
||||
public function getLogin(): ?string
|
||||
{
|
||||
return $this->login;
|
||||
}
|
||||
|
||||
public function getUrl(): ?string
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
public function getNotes(): ?string
|
||||
{
|
||||
return $this->notes;
|
||||
}
|
||||
|
||||
public function getOtherUserEdit(): ?int
|
||||
{
|
||||
return $this->otherUserEdit;
|
||||
}
|
||||
|
||||
public function getOtherUserGroupEdit(): ?int
|
||||
{
|
||||
return $this->otherUserGroupEdit;
|
||||
}
|
||||
|
||||
public function getIsPrivate(): ?int
|
||||
{
|
||||
return $this->isPrivate;
|
||||
}
|
||||
|
||||
public function getIsPrivateGroup(): ?int
|
||||
{
|
||||
return $this->isPrivateGroup;
|
||||
}
|
||||
|
||||
public function getDateEdit(): ?int
|
||||
{
|
||||
return $this->dateEdit;
|
||||
}
|
||||
|
||||
public function getPassDate(): ?int
|
||||
{
|
||||
return $this->passDate;
|
||||
}
|
||||
|
||||
public function getPassDateChange(): ?int
|
||||
{
|
||||
return $this->passDateChange;
|
||||
}
|
||||
|
||||
public function getParentId(): ?int
|
||||
{
|
||||
return $this->parentId;
|
||||
}
|
||||
|
||||
public function getCategoryName(): ?string
|
||||
{
|
||||
return $this->categoryName;
|
||||
}
|
||||
|
||||
public function getClientName(): ?string
|
||||
{
|
||||
return $this->clientName;
|
||||
}
|
||||
|
||||
public function getUserGroupName(): ?string
|
||||
{
|
||||
return $this->userGroupName;
|
||||
}
|
||||
|
||||
public function getUserName(): ?string
|
||||
{
|
||||
return $this->userName;
|
||||
}
|
||||
|
||||
public function getUserLogin(): ?string
|
||||
{
|
||||
return $this->userLogin;
|
||||
}
|
||||
|
||||
public function getUserEditName(): ?string
|
||||
{
|
||||
return $this->userEditName;
|
||||
}
|
||||
|
||||
public function getUserEditLogin(): ?string
|
||||
{
|
||||
return $this->userEditLogin;
|
||||
}
|
||||
|
||||
public function getNumFiles(): ?int
|
||||
{
|
||||
return $this->num_files;
|
||||
}
|
||||
|
||||
public function getPublicLinkDateExpire(): ?int
|
||||
{
|
||||
return $this->publicLinkDateExpire;
|
||||
}
|
||||
|
||||
public function getPublicLinkTotalCountViews(): ?int
|
||||
{
|
||||
return $this->publicLinkTotalCountViews;
|
||||
}
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
<?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\DataModel;
|
||||
|
||||
use SP\Domain\Common\Models\Model;
|
||||
|
||||
defined('APP_ROOT') || die();
|
||||
|
||||
/**
|
||||
* Class GroupAccountsData
|
||||
*
|
||||
* @package SP\DataModel
|
||||
*/
|
||||
class AccountToUserGroupData extends Model
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $userGroupId = 0;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $accountId = 0;
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $groups = [];
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getUserGroupId()
|
||||
{
|
||||
return $this->userGroupId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $userGroupId
|
||||
*/
|
||||
public function setUserGroupId($userGroupId)
|
||||
{
|
||||
$this->userGroupId = $userGroupId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getAccountId()
|
||||
{
|
||||
return $this->accountId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $accountId
|
||||
*/
|
||||
public function setAccountId($accountId)
|
||||
{
|
||||
$this->accountId = $accountId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getGroups()
|
||||
{
|
||||
return $this->groups;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $groups
|
||||
*/
|
||||
public function setGroups(array $groups)
|
||||
{
|
||||
$this->groups = $groups;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $group
|
||||
*/
|
||||
public function addGroup($group)
|
||||
{
|
||||
$this->groups[] = (int)$group;
|
||||
}
|
||||
}
|
||||
@@ -1,222 +0,0 @@
|
||||
<?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\DataModel;
|
||||
|
||||
use SP\Domain\Common\Models\Model;
|
||||
|
||||
/**
|
||||
* Class AccountVData
|
||||
*
|
||||
* @package SP\DataModel
|
||||
*/
|
||||
class AccountVData extends Model
|
||||
{
|
||||
protected ?int $id = null;
|
||||
protected ?int $userId = null;
|
||||
protected ?int $userGroupId = null;
|
||||
protected ?int $userEditId = null;
|
||||
protected ?string $name = null;
|
||||
protected ?int $clientId = null;
|
||||
protected ?int $categoryId = null;
|
||||
protected ?string $login = null;
|
||||
protected ?string $url = null;
|
||||
protected ?string $pass = null;
|
||||
protected ?string $key = null;
|
||||
protected ?string $notes = null;
|
||||
protected ?int $otherUserEdit = null;
|
||||
protected ?int $otherUserGroupEdit = null;
|
||||
protected ?int $dateAdd = null;
|
||||
protected ?int $dateEdit = null;
|
||||
protected ?int $countView = null;
|
||||
protected ?int $countDecrypt = null;
|
||||
protected ?int $isPrivate = null;
|
||||
protected ?int $isPrivateGroup = null;
|
||||
protected ?int $passDate = null;
|
||||
protected ?int $passDateChange = null;
|
||||
protected ?int $parentId = null;
|
||||
protected ?string $categoryName = null;
|
||||
protected ?string $clientName = null;
|
||||
protected ?string $userGroupName = null;
|
||||
protected ?string $userName = null;
|
||||
protected ?string $userLogin = null;
|
||||
protected ?string $userEditName = null;
|
||||
protected ?string $userEditLogin = null;
|
||||
protected ?string $publicLinkHash = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getUserId(): ?int
|
||||
{
|
||||
return $this->userId;
|
||||
}
|
||||
|
||||
public function getUserGroupId(): ?int
|
||||
{
|
||||
return $this->userGroupId;
|
||||
}
|
||||
|
||||
public function getUserEditId(): ?int
|
||||
{
|
||||
return $this->userEditId;
|
||||
}
|
||||
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getClientId(): ?int
|
||||
{
|
||||
return $this->clientId;
|
||||
}
|
||||
|
||||
public function getCategoryId(): ?int
|
||||
{
|
||||
return $this->categoryId;
|
||||
}
|
||||
|
||||
public function getLogin(): ?string
|
||||
{
|
||||
return $this->login;
|
||||
}
|
||||
|
||||
public function getUrl(): ?string
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
public function getPass(): ?string
|
||||
{
|
||||
return $this->pass;
|
||||
}
|
||||
|
||||
public function getKey(): ?string
|
||||
{
|
||||
return $this->key;
|
||||
}
|
||||
|
||||
public function getNotes(): ?string
|
||||
{
|
||||
return $this->notes;
|
||||
}
|
||||
|
||||
public function getOtherUserEdit(): ?int
|
||||
{
|
||||
return $this->otherUserEdit;
|
||||
}
|
||||
|
||||
public function getOtherUserGroupEdit(): ?int
|
||||
{
|
||||
return $this->otherUserGroupEdit;
|
||||
}
|
||||
|
||||
public function getDateAdd(): ?int
|
||||
{
|
||||
return $this->dateAdd;
|
||||
}
|
||||
|
||||
public function getDateEdit(): ?int
|
||||
{
|
||||
return $this->dateEdit;
|
||||
}
|
||||
|
||||
public function getCountView(): ?int
|
||||
{
|
||||
return $this->countView;
|
||||
}
|
||||
|
||||
public function getCountDecrypt(): ?int
|
||||
{
|
||||
return $this->countDecrypt;
|
||||
}
|
||||
|
||||
public function getIsPrivate(): ?int
|
||||
{
|
||||
return $this->isPrivate;
|
||||
}
|
||||
|
||||
public function getIsPrivateGroup(): ?int
|
||||
{
|
||||
return $this->isPrivateGroup;
|
||||
}
|
||||
|
||||
public function getPassDate(): ?int
|
||||
{
|
||||
return $this->passDate;
|
||||
}
|
||||
|
||||
public function getPassDateChange(): ?int
|
||||
{
|
||||
return $this->passDateChange;
|
||||
}
|
||||
|
||||
public function getParentId(): ?int
|
||||
{
|
||||
return $this->parentId;
|
||||
}
|
||||
|
||||
public function getCategoryName(): ?string
|
||||
{
|
||||
return $this->categoryName;
|
||||
}
|
||||
|
||||
public function getClientName(): ?string
|
||||
{
|
||||
return $this->clientName;
|
||||
}
|
||||
|
||||
public function getUserGroupName(): ?string
|
||||
{
|
||||
return $this->userGroupName;
|
||||
}
|
||||
|
||||
public function getUserName(): ?string
|
||||
{
|
||||
return $this->userName;
|
||||
}
|
||||
|
||||
public function getUserLogin(): ?string
|
||||
{
|
||||
return $this->userLogin;
|
||||
}
|
||||
|
||||
public function getUserEditName(): ?string
|
||||
{
|
||||
return $this->userEditName;
|
||||
}
|
||||
|
||||
public function getUserEditLogin(): ?string
|
||||
{
|
||||
return $this->userEditLogin;
|
||||
}
|
||||
|
||||
public function getPublicLinkHash(): ?string
|
||||
{
|
||||
return $this->publicLinkHash;
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,6 @@
|
||||
namespace SP\Domain\Account\Dtos;
|
||||
|
||||
use SP\Domain\Account\Ports\AccountSearchConstants;
|
||||
use SP\Mvc\Model\QueryCondition;
|
||||
|
||||
/**
|
||||
* Class AccountSearchFilter
|
||||
@@ -214,7 +213,7 @@ final class AccountSearchFilterDto
|
||||
|
||||
public function getFilterOperator(): string
|
||||
{
|
||||
return $this->filterOperator ?? QueryCondition::CONDITION_AND;
|
||||
return $this->filterOperator ?? AccountSearchConstants::FILTER_CHAIN_AND;
|
||||
}
|
||||
|
||||
public function setFilterOperator(?string $filterOperator): void
|
||||
|
||||
@@ -26,8 +26,8 @@ namespace SP\Infrastructure\Account\Repositories;
|
||||
|
||||
use Aura\SqlQuery\Common\SelectInterface;
|
||||
use Aura\SqlQuery\QueryFactory;
|
||||
use SP\DataModel\AccountSearchVData;
|
||||
use SP\Domain\Account\Dtos\AccountSearchFilterDto;
|
||||
use SP\Domain\Account\Models\AccountSearchView;
|
||||
use SP\Domain\Account\Ports\AccountFilterBuilder;
|
||||
use SP\Domain\Account\Ports\AccountSearchConstants;
|
||||
use SP\Domain\Account\Ports\AccountSearchRepository;
|
||||
@@ -47,10 +47,10 @@ final class AccountSearch extends BaseRepository implements AccountSearchReposit
|
||||
private readonly SelectInterface $query;
|
||||
|
||||
public function __construct(
|
||||
DatabaseInterface $database,
|
||||
ContextInterface $session,
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
QueryFactory $queryFactory,
|
||||
DatabaseInterface $database,
|
||||
ContextInterface $session,
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
QueryFactory $queryFactory,
|
||||
private readonly AccountFilterBuilder $accountFilterUser
|
||||
) {
|
||||
parent::__construct($database, $session, $eventDispatcher, $queryFactory);
|
||||
@@ -118,7 +118,7 @@ final class AccountSearch extends BaseRepository implements AccountSearchReposit
|
||||
}
|
||||
|
||||
return $this->db->doSelect(
|
||||
QueryData::build($this->query)->setMapClassName(AccountSearchVData::class),
|
||||
QueryData::build($this->query)->setMapClassName(AccountSearchView::class),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* sysPass
|
||||
*
|
||||
* @author nuxsmin
|
||||
* @link https://syspass.org
|
||||
* @copyright 2012-2021, 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\Mvc\Model;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Class QueryCondition
|
||||
*
|
||||
* @package SP\Mvc\Model
|
||||
*/
|
||||
final class QueryCondition
|
||||
{
|
||||
public const CONDITION_AND = ' AND ';
|
||||
public const CONDITION_OR = ' OR ';
|
||||
|
||||
protected array $query = [];
|
||||
protected array $param = [];
|
||||
|
||||
public function addFilter(
|
||||
string $query,
|
||||
?array $params = null
|
||||
): QueryCondition
|
||||
{
|
||||
$this->query[] = "($query)";
|
||||
|
||||
if ($params !== null) {
|
||||
$this->param = array_merge($this->param, $params);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFilters(string $type = self::CONDITION_AND): ?string
|
||||
{
|
||||
if ($type !== self::CONDITION_AND && $type !== self::CONDITION_OR) {
|
||||
throw new RuntimeException(__u('Invalid filter type'));
|
||||
}
|
||||
|
||||
return $this->hasFilters()
|
||||
? '(' . implode($type, $this->query) . ')'
|
||||
: null;
|
||||
}
|
||||
|
||||
public function hasFilters(): bool
|
||||
{
|
||||
return count($this->query) !== 0;
|
||||
}
|
||||
|
||||
public function getParams(): array
|
||||
{
|
||||
return $this->param;
|
||||
}
|
||||
|
||||
public function getFiltersCount(): int
|
||||
{
|
||||
return count($this->query);
|
||||
}
|
||||
}
|
||||
@@ -22,13 +22,13 @@
|
||||
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Infrastructure\Account\Repositories;
|
||||
namespace SPT\Infrastructure\Account\Repositories;
|
||||
|
||||
use Aura\SqlQuery\QueryFactory;
|
||||
use PHPUnit\Framework\Constraint\Callback;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use SP\DataModel\AccountSearchVData;
|
||||
use SP\Domain\Account\Dtos\AccountSearchFilterDto;
|
||||
use SP\Domain\Account\Models\AccountSearchView;
|
||||
use SP\Domain\Account\Ports\AccountFilterBuilder;
|
||||
use SP\Domain\Account\Ports\AccountSearchConstants;
|
||||
use SP\Infrastructure\Account\Repositories\AccountSearch;
|
||||
@@ -192,7 +192,7 @@ class AccountSearchTest extends UnitaryTestCase
|
||||
->with(
|
||||
new Callback(static function (QueryData $data) {
|
||||
return !empty($data->getQuery()->getStatement()) &&
|
||||
$data->getMapClassName() === AccountSearchVData::class;
|
||||
$data->getMapClassName() === AccountSearchView::class;
|
||||
}),
|
||||
true
|
||||
);
|
||||
@@ -213,7 +213,7 @@ class AccountSearchTest extends UnitaryTestCase
|
||||
->with(
|
||||
new Callback(static function (QueryData $data) {
|
||||
return !empty($data->getQuery()->getStatement()) &&
|
||||
$data->getMapClassName() === AccountSearchVData::class;
|
||||
$data->getMapClassName() === AccountSearchView::class;
|
||||
}),
|
||||
true
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user