feat: demotion of user accounts via crm

This commit is contained in:
Björn Fromme
2026-08-10 13:01:01 +02:00
parent b01c2e84c7
commit b39a78da82
11 changed files with 240 additions and 3 deletions
+21
View File
@@ -387,6 +387,27 @@ class User implements UserInterface, TimestampableEntityInterface
return null !== $this->disabledAt;
}
/**
* Blocks or unblocks the account, keeping the reasons in sync. Unchanged state is a
* no-op so that saving an unrelated change does not reset the timestamp.
*/
public function setDisabled(bool $disabled): static
{
if ($disabled === $this->isDisabled()) {
return $this;
}
if (false === $disabled) {
return $this
->setDisabledAt(null)
->setDisabledReason(null)
->setDisabledReasonInternal(null)
;
}
return $this->setDisabledAt(new \DateTimeImmutable());
}
public function getDisabledReason(): ?string
{
return $this->disabledReason;