mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2026-04-01 01:25:39 +00:00
implement user moderation tools
This commit is contained in:
parent
42cef39589
commit
8d258c677b
5 changed files with 365 additions and 26 deletions
|
|
@ -162,4 +162,49 @@ class UserService
|
|||
$this->entityManagerInterface->flush();
|
||||
}
|
||||
}
|
||||
|
||||
public function toggleUserModerator(
|
||||
int $userId
|
||||
): void
|
||||
{
|
||||
if ($user = $this->getUser($userId))
|
||||
{
|
||||
$user->setModerator(
|
||||
!$user->isModerator()
|
||||
);
|
||||
|
||||
$this->entityManagerInterface->persist($user);
|
||||
$this->entityManagerInterface->flush();
|
||||
}
|
||||
}
|
||||
|
||||
public function toggleUserStatus(
|
||||
int $userId
|
||||
): void
|
||||
{
|
||||
if ($user = $this->getUser($userId))
|
||||
{
|
||||
$user->setStatus(
|
||||
!$user->isStatus()
|
||||
);
|
||||
|
||||
$this->entityManagerInterface->persist($user);
|
||||
$this->entityManagerInterface->flush();
|
||||
}
|
||||
}
|
||||
|
||||
public function toggleUserApproved(
|
||||
int $userId
|
||||
): void
|
||||
{
|
||||
if ($user = $this->getUser($userId))
|
||||
{
|
||||
$user->setApproved(
|
||||
!$user->isApproved()
|
||||
);
|
||||
|
||||
$this->entityManagerInterface->persist($user);
|
||||
$this->entityManagerInterface->flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue