webauthn/src/Application/Model/UserEntity.php

41 regels
1.2 KiB
PHP

2022-10-24 22:24:40 +02:00
<?php
/**
* This Software is the property of Data Development and is protected
* by copyright law - it is NOT Freeware.
*
* Any unauthorized use of this software without a valid license
* is a violation of the license agreement and will be prosecuted by
* civil and criminal law.
*
* http://www.shopmodule.com
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
* @link http://www.oxidmodule.com
*/
2022-10-31 00:11:06 +01:00
namespace D3\Webauthn\Application\Model;
2022-10-24 22:24:40 +02:00
use OxidEsales\Eshop\Application\Model\User;
use Webauthn\PublicKeyCredentialUserEntity;
2022-10-31 00:11:06 +01:00
class UserEntity extends publicKeyCredentialUserEntity
2022-10-24 22:24:40 +02:00
{
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()) {
throw oxNew(WebauthnException::class, 'can not create webauthn user entity from not loaded user');
}
2022-10-24 22:24:40 +02:00
parent::__construct(
2022-10-31 00:11:06 +01:00
strtolower($user->getFieldData('oxusername')),
2022-10-24 22:24:40 +02:00
$user->getId(),
2022-10-31 00:11:06 +01:00
$user->getFieldData('oxfname') . ' ' . $user->getFieldData('oxlname')
2022-10-24 22:24:40 +02:00
);
}
}