mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-02 22:54:08 +01:00
@@ -35,115 +35,36 @@ defined('APP_ROOT') || die();
|
||||
*/
|
||||
class UserData extends UserPassData implements DataModelInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $login;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $ssoLogin;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $email;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $notes;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $userGroupId = 0;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $userProfileId = 0;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $isAdminApp = 0;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $isAdminAcc = 0;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $isDisabled = 0;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $isChangePass = 0;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $isChangedPass = 0;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $isLdap = 0;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $loginCount = 0;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $lastLogin;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $lastUpdate;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $isMigrate = 0;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $preferences;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $userGroupName;
|
||||
public ?string $login = null;
|
||||
public ?string $ssoLogin = null;
|
||||
public ?string $name = null;
|
||||
public ?string $email = null;
|
||||
public ?string $notes = null;
|
||||
public ?int $userGroupId = null;
|
||||
public ?int $userProfileId = null;
|
||||
public ?int $isAdminApp = null;
|
||||
public bool $isAdminAcc = false;
|
||||
public bool $isDisabled = false;
|
||||
public bool $isChangePass = false;
|
||||
public bool $isChangedPass = false;
|
||||
public bool $isLdap = false;
|
||||
public ?int $loginCount = null;
|
||||
public ?string $lastLogin = null;
|
||||
public ?string $lastUpdate = null;
|
||||
public ?bool $isMigrate = false;
|
||||
public ?string $preferences = null;
|
||||
public ?string $userGroupName = null;
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getLoginCount()
|
||||
public function getLoginCount(): int
|
||||
{
|
||||
return (int)$this->loginCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $loginCount
|
||||
*/
|
||||
public function setLoginCount($loginCount)
|
||||
{
|
||||
$this->loginCount = (int)$loginCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLastLogin()
|
||||
public function getLastLogin(): ?string
|
||||
{
|
||||
return $this->lastLogin;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $lastLogin
|
||||
*/
|
||||
public function setLastLogin($lastLogin)
|
||||
{
|
||||
$this->lastLogin = $lastLogin;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
@@ -152,266 +73,142 @@ class UserData extends UserPassData implements DataModelInterface
|
||||
return $this->lastUpdate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $lastUpdate
|
||||
*/
|
||||
public function setLastUpdate($lastUpdate)
|
||||
{
|
||||
$this->lastUpdate = $lastUpdate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function isMigrate()
|
||||
public function isMigrate(): int
|
||||
{
|
||||
return (int)$this->isMigrate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $isMigrate
|
||||
*/
|
||||
public function setIsMigrate($isMigrate)
|
||||
{
|
||||
$this->isMigrate = (int)$isMigrate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPreferences()
|
||||
public function getPreferences(): ?string
|
||||
{
|
||||
return $this->preferences;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $preferences
|
||||
*/
|
||||
public function setPreferences($preferences)
|
||||
{
|
||||
$this->preferences = $preferences;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getEmail()
|
||||
public function getEmail(): ?string
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $email
|
||||
*/
|
||||
public function setEmail($email)
|
||||
public function setEmail(string $email)
|
||||
{
|
||||
$this->email = $email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getNotes()
|
||||
public function getNotes(): ?string
|
||||
{
|
||||
return $this->notes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $notes
|
||||
*/
|
||||
public function setNotes($notes)
|
||||
public function setNotes(string $notes)
|
||||
{
|
||||
$this->notes = $notes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getUserGroupId()
|
||||
public function getUserGroupId(): int
|
||||
{
|
||||
return (int)$this->userGroupId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $userGroupId
|
||||
*/
|
||||
public function setUserGroupId($userGroupId)
|
||||
public function setUserGroupId(int $userGroupId)
|
||||
{
|
||||
$this->userGroupId = (int)$userGroupId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getUserProfileId()
|
||||
public function getUserProfileId(): int
|
||||
{
|
||||
return (int)$this->userProfileId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $userProfileId
|
||||
*/
|
||||
public function setUserProfileId($userProfileId)
|
||||
public function setUserProfileId(int $userProfileId)
|
||||
{
|
||||
$this->userProfileId = (int)$userProfileId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function isAdminApp()
|
||||
public function isAdminApp(): int
|
||||
{
|
||||
return (int)$this->isAdminApp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $isAdminApp
|
||||
*/
|
||||
public function setIsAdminApp($isAdminApp)
|
||||
public function setIsAdminApp(bool $isAdminApp)
|
||||
{
|
||||
$this->isAdminApp = (int)$isAdminApp;
|
||||
$this->isAdminApp = $isAdminApp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function isAdminAcc()
|
||||
public function isAdminAcc(): int
|
||||
{
|
||||
return (int)$this->isAdminAcc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $isAdminAcc
|
||||
*/
|
||||
public function setIsAdminAcc($isAdminAcc)
|
||||
public function setIsAdminAcc(bool $isAdminAcc)
|
||||
{
|
||||
$this->isAdminAcc = (int)$isAdminAcc;
|
||||
$this->isAdminAcc = $isAdminAcc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function isDisabled()
|
||||
public function isDisabled(): int
|
||||
{
|
||||
return (int)$this->isDisabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $isDisabled
|
||||
*/
|
||||
public function setIsDisabled($isDisabled)
|
||||
public function setIsDisabled(bool $isDisabled)
|
||||
{
|
||||
$this->isDisabled = (int)$isDisabled;
|
||||
$this->isDisabled = $isDisabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function isChangePass()
|
||||
public function isChangePass(): int
|
||||
{
|
||||
return (int)$this->isChangePass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $isChangePass
|
||||
*/
|
||||
public function setIsChangePass($isChangePass)
|
||||
public function setIsChangePass(bool $isChangePass)
|
||||
{
|
||||
$this->isChangePass = (int)$isChangePass;
|
||||
$this->isChangePass = $isChangePass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function isLdap()
|
||||
public function isLdap(): int
|
||||
{
|
||||
return (int)$this->isLdap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $isLdap
|
||||
*/
|
||||
public function setIsLdap(bool $isLdap)
|
||||
{
|
||||
$this->isLdap = (int)$isLdap;
|
||||
$this->isLdap = $isLdap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLogin()
|
||||
public function getLogin(): ?string
|
||||
{
|
||||
return $this->login;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $login
|
||||
*/
|
||||
public function setLogin($login)
|
||||
public function setLogin(string $login)
|
||||
{
|
||||
$this->login = $login;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*/
|
||||
public function setName($name)
|
||||
public function setName(string $name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUserGroupName()
|
||||
public function getUserGroupName(): ?string
|
||||
{
|
||||
return $this->userGroupName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $userGroupName
|
||||
*/
|
||||
public function setUserGroupName($userGroupName)
|
||||
{
|
||||
$this->userGroupName = $userGroupName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function isChangedPass()
|
||||
public function isChangedPass(): int
|
||||
{
|
||||
return (int)$this->isChangedPass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $isChangedPass
|
||||
*/
|
||||
public function setIsChangedPass($isChangedPass)
|
||||
{
|
||||
$this->isChangedPass = (int)$isChangedPass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSsoLogin()
|
||||
public function getSsoLogin(): ?string
|
||||
{
|
||||
return $this->ssoLogin;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $ssoLogin
|
||||
*/
|
||||
public function setSsoLogin($ssoLogin)
|
||||
public function setSsoLogin(string $ssoLogin)
|
||||
{
|
||||
$this->ssoLogin = $ssoLogin;
|
||||
}
|
||||
|
||||
@@ -33,123 +33,64 @@ use SP\Domain\Common\Out\DataModelBase;
|
||||
*/
|
||||
class UserPassData extends DataModelBase
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $id = 0;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $pass;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $hashSalt;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $mPass;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $mKey;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $lastUpdateMPass = 0;
|
||||
protected ?int $id = null;
|
||||
protected ?string $pass = null;
|
||||
protected ?string $hashSalt = null;
|
||||
protected ?string $mPass = null;
|
||||
protected ?string $mKey = null;
|
||||
protected ?int $lastUpdateMPass = null;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPass()
|
||||
public function getPass(): ?string
|
||||
{
|
||||
return $this->pass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $pass
|
||||
*/
|
||||
public function setPass($pass)
|
||||
public function setPass(string $pass)
|
||||
{
|
||||
$this->pass = $pass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getHashSalt()
|
||||
public function getHashSalt(): ?string
|
||||
{
|
||||
return $this->hashSalt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $hashSalt
|
||||
*/
|
||||
public function setHashSalt($hashSalt)
|
||||
{
|
||||
$this->hashSalt = $hashSalt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMPass()
|
||||
public function getMPass(): ?string
|
||||
{
|
||||
return $this->mPass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $mPass
|
||||
*/
|
||||
public function setMPass($mPass)
|
||||
public function setMPass(string $mPass)
|
||||
{
|
||||
$this->mPass = $mPass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMKey()
|
||||
public function getMKey(): ?string
|
||||
{
|
||||
return $this->mKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $mKey
|
||||
*/
|
||||
public function setMKey($mKey)
|
||||
public function setMKey(string $mKey)
|
||||
{
|
||||
$this->mKey = $mKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getLastUpdateMPass()
|
||||
public function getLastUpdateMPass(): int
|
||||
{
|
||||
return (int)$this->lastUpdateMPass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $lastUpdateMPass
|
||||
*/
|
||||
public function setLastUpdateMPass($lastUpdateMPass)
|
||||
public function setLastUpdateMPass(int $lastUpdateMPass)
|
||||
{
|
||||
$this->lastUpdateMPass = (int)$lastUpdateMPass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
public function getId(): ?int
|
||||
{
|
||||
return (int)$this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
*/
|
||||
public function setId($id)
|
||||
public function setId(int $id)
|
||||
{
|
||||
$this->id = (int)$id;
|
||||
}
|
||||
|
||||
@@ -36,23 +36,14 @@ defined('APP_ROOT') || die();
|
||||
*/
|
||||
class UserProfileData extends DataModelBase implements DataModelInterface
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $id = 0;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $name = '';
|
||||
/**
|
||||
* @var ProfileData
|
||||
*/
|
||||
public $profile;
|
||||
protected ?int $id = null;
|
||||
protected ?string $name = null;
|
||||
protected ?ProfileData $profile = null;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @return string|null
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
@@ -66,9 +57,9 @@ class UserProfileData extends DataModelBase implements DataModelInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
* @return int|null
|
||||
*/
|
||||
public function getId()
|
||||
public function getId(): ?int
|
||||
{
|
||||
return (int)$this->id;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace SP\Tests\Services\Backup;
|
||||
namespace SP\Tests\Domain\Export\Services;
|
||||
|
||||
use SP\Core\PhpExtensionChecker;
|
||||
use SP\Domain\Export\Services\BackupFiles;
|
||||
@@ -41,7 +41,6 @@ use SP\Tests\UnitaryTestCase;
|
||||
class FileBackupServiceTest extends UnitaryTestCase
|
||||
{
|
||||
private FileBackupService $fileBackupService;
|
||||
private BackupFiles $backupFiles;
|
||||
|
||||
/**
|
||||
* @throws \SP\Domain\Common\Services\ServiceException
|
||||
@@ -77,18 +76,18 @@ class FileBackupServiceTest extends UnitaryTestCase
|
||||
FileBackupService::BACKUP_INCLUDE_REGEX
|
||||
);
|
||||
|
||||
$this->backupFiles = $this->getMockBuilder(BackupFiles::class)
|
||||
$backupFiles = $this->getMockBuilder(BackupFiles::class)
|
||||
->onlyMethods(['getDbBackupArchiveHandler', 'getAppBackupArchiveHandler'])
|
||||
->setConstructorArgs([new PhpExtensionChecker()])
|
||||
->getMock();
|
||||
$this->backupFiles->method('getDbBackupArchiveHandler')->willReturn($archiveHandler);
|
||||
$this->backupFiles->method('getAppBackupArchiveHandler')->willReturn($archiveHandler);
|
||||
$backupFiles->method('getDbBackupArchiveHandler')->willReturn($archiveHandler);
|
||||
$backupFiles->method('getAppBackupArchiveHandler')->willReturn($archiveHandler);
|
||||
|
||||
$this->fileBackupService = new FileBackupService(
|
||||
$this->application,
|
||||
$database,
|
||||
$this->createStub(DatabaseUtil::class),
|
||||
$this->backupFiles
|
||||
$backupFiles
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@
|
||||
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace SP\Tests\Services\Install;
|
||||
namespace SP\Tests\Domain\Install\Services;
|
||||
|
||||
use Exception;
|
||||
use SP\Core\Exceptions\InvalidArgumentException;
|
||||
@@ -22,7 +22,7 @@
|
||||
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace SP\Tests\Services\Install;
|
||||
namespace SP\Tests\Domain\Install\Services;
|
||||
|
||||
use PDOException;
|
||||
use SP\Core\Exceptions\SPException;
|
||||
@@ -1,4 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ 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/>.
|
||||
-->
|
||||
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
backupGlobals="false"
|
||||
backupStaticAttributes="false"
|
||||
@@ -41,8 +64,8 @@
|
||||
<directory suffix=".php">./SP/Modules/Cli</directory>
|
||||
</testsuite>
|
||||
<testsuite name="unitary">
|
||||
<directory suffix=".php">./SP/Services/Install</directory>
|
||||
<directory suffix=".php">./SP/Services/Backup</directory>
|
||||
<directory suffix=".php">./SP/Domain</directory>
|
||||
<directory suffix=".php">./SP/Infrastructure</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<logging/>
|
||||
|
||||
Reference in New Issue
Block a user