2026-05-14 04:30:12 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace App\Domain\Auth;
|
|
|
|
|
|
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
|
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
|
|
|
|
use Symfony\Component\Security\Core\User\UserInterface;
|
|
|
|
|
use Symfony\Component\Uid\Uuid;
|
|
|
|
|
|
|
|
|
|
#[ORM\Entity]
|
|
|
|
|
#[ORM\Table(name: 'users', schema: 'app')]
|
|
|
|
|
class User implements UserInterface, PasswordAuthenticatedUserInterface
|
|
|
|
|
{
|
|
|
|
|
#[ORM\Id]
|
|
|
|
|
#[ORM\Column(type: 'uuid')]
|
|
|
|
|
private Uuid $id;
|
|
|
|
|
|
|
|
|
|
#[ORM\Column(type: 'string', length: 255, unique: true)]
|
|
|
|
|
private string $email;
|
|
|
|
|
|
|
|
|
|
#[ORM\Column(type: 'string')]
|
|
|
|
|
private string $passwordHash;
|
|
|
|
|
|
|
|
|
|
#[ORM\Column(type: 'string', nullable: true)]
|
|
|
|
|
private ?string $totpSecret = null;
|
|
|
|
|
|
|
|
|
|
/** @var array<string, bool> */
|
|
|
|
|
#[ORM\Column(type: 'json')]
|
|
|
|
|
private array $permissions = [];
|
|
|
|
|
|
|
|
|
|
#[ORM\Column(type: 'boolean')]
|
|
|
|
|
private bool $isActive = true;
|
|
|
|
|
|
|
|
|
|
public function __construct(string $email, string $passwordHash)
|
|
|
|
|
{
|
|
|
|
|
$this->id = Uuid::v7();
|
|
|
|
|
$this->email = $email;
|
|
|
|
|
$this->passwordHash = $passwordHash;
|
|
|
|
|
}
|
|
|
|
|
|
feat: implement Plan 2 — Article Management API
- 6 new domain repository interfaces (StoragePath, ArticlePhoto, AttributeValue, ChannelField, ArticleTypePlatformConfig, AttributeMapping)
- 6 Doctrine repository implementations
- StorageManager with multi-path quota-aware file storage (LocalStorageManager)
- Application services: ArticleTypeService, ArticleService, ArticleValidator, PhotoService, PlatformService, MappingService
- REST controllers: ArticleType, Article, Photo, Platform, Mapping (all under /api prefix)
- inventory_number sequence migration
- 22 unit tests passing, PHPStan level 9 clean, CS Fixer clean
- Fixed phpdoc_to_comment CS Fixer rule (disabled) to preserve @var type annotations
- Fixed PHPStan: User::getUserIdentifier non-empty-string, AIPipelineJob nullable missingFields
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 05:19:20 +00:00
|
|
|
public function getId(): Uuid
|
|
|
|
|
{
|
|
|
|
|
return $this->id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getEmail(): string
|
|
|
|
|
{
|
|
|
|
|
return $this->email;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getPassword(): string
|
|
|
|
|
{
|
|
|
|
|
return $this->passwordHash;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** @return non-empty-string */
|
|
|
|
|
public function getUserIdentifier(): string
|
|
|
|
|
{
|
|
|
|
|
\assert('' !== $this->email);
|
|
|
|
|
|
|
|
|
|
return $this->email;
|
|
|
|
|
}
|
2026-05-14 04:30:12 +00:00
|
|
|
|
|
|
|
|
/** @return list<string> */
|
feat: implement Plan 2 — Article Management API
- 6 new domain repository interfaces (StoragePath, ArticlePhoto, AttributeValue, ChannelField, ArticleTypePlatformConfig, AttributeMapping)
- 6 Doctrine repository implementations
- StorageManager with multi-path quota-aware file storage (LocalStorageManager)
- Application services: ArticleTypeService, ArticleService, ArticleValidator, PhotoService, PlatformService, MappingService
- REST controllers: ArticleType, Article, Photo, Platform, Mapping (all under /api prefix)
- inventory_number sequence migration
- 22 unit tests passing, PHPStan level 9 clean, CS Fixer clean
- Fixed phpdoc_to_comment CS Fixer rule (disabled) to preserve @var type annotations
- Fixed PHPStan: User::getUserIdentifier non-empty-string, AIPipelineJob nullable missingFields
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 05:19:20 +00:00
|
|
|
public function getRoles(): array
|
|
|
|
|
{
|
|
|
|
|
return ['ROLE_USER'];
|
|
|
|
|
}
|
2026-05-14 04:30:12 +00:00
|
|
|
|
feat: implement Plan 2 — Article Management API
- 6 new domain repository interfaces (StoragePath, ArticlePhoto, AttributeValue, ChannelField, ArticleTypePlatformConfig, AttributeMapping)
- 6 Doctrine repository implementations
- StorageManager with multi-path quota-aware file storage (LocalStorageManager)
- Application services: ArticleTypeService, ArticleService, ArticleValidator, PhotoService, PlatformService, MappingService
- REST controllers: ArticleType, Article, Photo, Platform, Mapping (all under /api prefix)
- inventory_number sequence migration
- 22 unit tests passing, PHPStan level 9 clean, CS Fixer clean
- Fixed phpdoc_to_comment CS Fixer rule (disabled) to preserve @var type annotations
- Fixed PHPStan: User::getUserIdentifier non-empty-string, AIPipelineJob nullable missingFields
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 05:19:20 +00:00
|
|
|
public function eraseCredentials(): void
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getTotpSecret(): ?string
|
|
|
|
|
{
|
|
|
|
|
return $this->totpSecret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function setTotpSecret(?string $secret): void
|
|
|
|
|
{
|
|
|
|
|
$this->totpSecret = $secret;
|
|
|
|
|
}
|
2026-05-14 04:30:12 +00:00
|
|
|
|
feat: implement Plan 2 — Article Management API
- 6 new domain repository interfaces (StoragePath, ArticlePhoto, AttributeValue, ChannelField, ArticleTypePlatformConfig, AttributeMapping)
- 6 Doctrine repository implementations
- StorageManager with multi-path quota-aware file storage (LocalStorageManager)
- Application services: ArticleTypeService, ArticleService, ArticleValidator, PhotoService, PlatformService, MappingService
- REST controllers: ArticleType, Article, Photo, Platform, Mapping (all under /api prefix)
- inventory_number sequence migration
- 22 unit tests passing, PHPStan level 9 clean, CS Fixer clean
- Fixed phpdoc_to_comment CS Fixer rule (disabled) to preserve @var type annotations
- Fixed PHPStan: User::getUserIdentifier non-empty-string, AIPipelineJob nullable missingFields
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 05:19:20 +00:00
|
|
|
public function isActive(): bool
|
|
|
|
|
{
|
|
|
|
|
return $this->isActive;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function setIsActive(bool $active): void
|
|
|
|
|
{
|
|
|
|
|
$this->isActive = $active;
|
|
|
|
|
}
|
2026-05-14 04:30:12 +00:00
|
|
|
|
|
|
|
|
/** @return array<string, bool> */
|
feat: implement Plan 2 — Article Management API
- 6 new domain repository interfaces (StoragePath, ArticlePhoto, AttributeValue, ChannelField, ArticleTypePlatformConfig, AttributeMapping)
- 6 Doctrine repository implementations
- StorageManager with multi-path quota-aware file storage (LocalStorageManager)
- Application services: ArticleTypeService, ArticleService, ArticleValidator, PhotoService, PlatformService, MappingService
- REST controllers: ArticleType, Article, Photo, Platform, Mapping (all under /api prefix)
- inventory_number sequence migration
- 22 unit tests passing, PHPStan level 9 clean, CS Fixer clean
- Fixed phpdoc_to_comment CS Fixer rule (disabled) to preserve @var type annotations
- Fixed PHPStan: User::getUserIdentifier non-empty-string, AIPipelineJob nullable missingFields
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 05:19:20 +00:00
|
|
|
public function getPermissions(): array
|
|
|
|
|
{
|
|
|
|
|
return $this->permissions;
|
|
|
|
|
}
|
2026-05-14 04:30:12 +00:00
|
|
|
|
|
|
|
|
public function hasPermission(string $permission): bool
|
|
|
|
|
{
|
|
|
|
|
return $this->permissions[$permission] ?? false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function grantPermission(string $permission): void
|
|
|
|
|
{
|
|
|
|
|
$this->permissions[$permission] = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function revokePermission(string $permission): void
|
|
|
|
|
{
|
|
|
|
|
unset($this->permissions[$permission]);
|
|
|
|
|
}
|
|
|
|
|
}
|