Symfony 7.4 / Twig / Doctrine DBAL auf herkömmlichem PHP-Webhosting. Versionierte Blockdokumente (v1-v3) mit unveränderlichen Revisionen, getrennten Entwürfen/Veröffentlichungen und optimistischer Konflikterkennung. Visueller Editor mit Strukturbaum, Live-Vorschau, responsiven Gerätewerten, Abschnittsvorlagen, Bildmediathek, Galerien und Effekten. Öffentliche Ausgabe ohne Editor-JavaScript. Geprüft: 41 PHP-Tests / 155 Assertions, 10 JavaScript-Modelltests. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
47 lines
1.2 KiB
PHP
47 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Domain;
|
|
|
|
use Symfony\Component\Security\Core\User\EquatableInterface;
|
|
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
|
use Symfony\Component\Security\Core\User\UserInterface;
|
|
|
|
final class CmsUser implements UserInterface, PasswordAuthenticatedUserInterface, EquatableInterface
|
|
{
|
|
public function __construct(public readonly string $id, private string $username, private string $password, private array $roles)
|
|
{
|
|
}
|
|
|
|
public function getUserIdentifier(): string
|
|
{
|
|
return $this->username;
|
|
}
|
|
|
|
public function getPassword(): string
|
|
{
|
|
return $this->password;
|
|
}
|
|
|
|
public function setPasswordHash(string $hash): void
|
|
{
|
|
$this->password = $hash;
|
|
}
|
|
|
|
public function getRoles(): array
|
|
{
|
|
return $this->roles;
|
|
}
|
|
|
|
public function eraseCredentials(): void
|
|
{
|
|
}
|
|
|
|
public function isEqualTo(UserInterface $user): bool
|
|
{
|
|
return $user instanceof self && $this->id === $user->id
|
|
&& $this->username === $user->username
|
|
&& hash_equals($this->password, $user->password)
|
|
&& $this->roles === $user->roles;
|
|
}
|
|
}
|