2022-10-24 22:24:40 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
2022-11-04 22:45:47 +01:00
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
2022-10-24 22:24:40 +02:00
|
|
|
*
|
2022-11-04 22:45:47 +01:00
|
|
|
* https://www.d3data.de
|
2022-10-24 22:24:40 +02:00
|
|
|
*
|
|
|
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
2022-11-04 22:45:47 +01:00
|
|
|
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
|
|
|
* @link https://www.oxidmodule.com
|
2022-10-24 22:24:40 +02:00
|
|
|
*/
|
|
|
|
|
2022-11-04 22:02:44 +01:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2022-10-31 00:11:06 +01:00
|
|
|
namespace D3\Webauthn\Application\Model;
|
2022-10-24 22:24:40 +02:00
|
|
|
|
2022-12-01 23:46:09 +01:00
|
|
|
use D3\TestingTools\Production\IsMockable;
|
2022-11-03 13:18:02 +01:00
|
|
|
use D3\Webauthn\Application\Model\Exceptions\WebauthnException;
|
2022-10-24 22:24:40 +02:00
|
|
|
use OxidEsales\Eshop\Application\Model\User;
|
|
|
|
use Webauthn\PublicKeyCredentialUserEntity;
|
|
|
|
|
2022-11-03 13:18:02 +01:00
|
|
|
class UserEntity extends PublicKeyCredentialUserEntity
|
2022-10-24 22:24:40 +02:00
|
|
|
{
|
2022-12-01 23:46:09 +01:00
|
|
|
use IsMockable;
|
|
|
|
|
2022-10-31 00:11:06 +01:00
|
|
|
/**
|
|
|
|
* @param User $user
|
|
|
|
* @throws WebauthnException
|
|
|
|
*/
|
2022-10-24 22:24:40 +02:00
|
|
|
public function __construct(User $user)
|
|
|
|
{
|
2022-10-31 00:11:06 +01:00
|
|
|
if (!$user->isLoaded() || !$user->getId()) {
|
2022-11-03 13:18:02 +01:00
|
|
|
/** @var WebauthnException $e */
|
2022-11-04 22:02:44 +01:00
|
|
|
$e = oxNew(WebauthnException::class, 'D3_WEBAUTHN_ERR_NOTLOADEDUSER');
|
2022-11-03 13:18:02 +01:00
|
|
|
throw $e;
|
2022-10-31 00:11:06 +01:00
|
|
|
}
|
|
|
|
|
2022-12-07 12:03:24 +01:00
|
|
|
$this->d3CallMockableFunction(
|
|
|
|
[
|
|
|
|
PublicKeyCredentialUserEntity::class,
|
2022-12-13 22:24:33 +01:00
|
|
|
'__construct',
|
2022-12-07 12:03:24 +01:00
|
|
|
],
|
2022-12-01 23:46:09 +01:00
|
|
|
[
|
|
|
|
strtolower($user->getFieldData('oxusername')),
|
|
|
|
$user->getId(),
|
2022-12-13 22:24:33 +01:00
|
|
|
$user->getFieldData('oxfname') . ' ' . $user->getFieldData('oxlname'),
|
2022-12-01 23:46:09 +01:00
|
|
|
]
|
2022-10-24 22:24:40 +02:00
|
|
|
);
|
|
|
|
}
|
2022-12-13 22:24:33 +01:00
|
|
|
}
|