<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^$ web/ [L]
RewriteRule ((?s).*) web/$1 [L]
</IfModule>
<?php
namespace AppBundle\Entity\Dto;
use AppBundle\Other\Arr;
/**
* User
*
*/
class UserDTO
{
/**
*
* @var int
*/
public $id;
/**
*
* @var string
*/
public $login;
/**
*
* @var int
*/
public $dzoId;
/**
*
* @var string
*/
public $dzoName;
/**
* Roles
* @var string
*/
public $roles;
/**
*
* @var string
*/
public $fullname;
/**
*
* @var string
*/
public $email;
public function __construct(\AppBundle\Entity\User $userInfo)
{
$this->id = $userInfo->getId();
$this->login = $userInfo->getUsername();
$dzo = $userInfo->getDzo();
if ($dzo != null) {
$this->dzoId = $dzo->getId();
$this->dzoName = $dzo->getName();
}
$this->roles = $this->plainRoles($userInfo);
$this->email = $userInfo->getEmail();
$this->fullname = $userInfo->getFullname();
}
private function plainRoles(\AppBundle\Entity\User $user)
{
$roles = $user->getRoles();
return join(',', $roles);
}
private function getRolesInfo($str)
{
$parts = explode('-::-', $str);
$roles = [];
foreach ($parts as $p) {
$deserialized = \unserialize($p);
$roles = array_merge($roles, $deserialized);
}
return join(',', array_unique($roles));
}
}
security:
# ***
firewalls:
# ***
refresh:
pattern: ^/api/v1/token/refresh
stateless: true
anonymous: true
# ***
api:
pattern: ^/api
stateless: true
guard:
authenticators:
- lexik_jwt_authentication.jwt_token_authenticator