feat: demotion of user accounts via crm
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user