42 lines
1.3 KiB
PHP
42 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Service;
|
|
|
|
use App\Entity\User;
|
|
use App\Form\Model\Filter\AbstractListFilterDto;
|
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
|
|
|
/**
|
|
* Where to send somebody who should act on a role nomination.
|
|
*
|
|
* Deliberately not app_admin_user_permissions. That route renders the approval modal, which
|
|
* extends htmx_modal_admin.html.twig — a bare <div> with no page chrome, meant to be swapped
|
|
* into a page that is already open. Following it as a normal navigation, which is what a link
|
|
* in an email or a dashboard does, yields an unstyled fragment.
|
|
*
|
|
* The user list filtered down to the one account is one click away from the modal and shows the
|
|
* nomination badge on the way. The query string is flat because the list filter forms declare no
|
|
* block prefix.
|
|
*/
|
|
class RoleApprovalUrlGenerator
|
|
{
|
|
public function __construct(
|
|
private readonly UrlGeneratorInterface $urlGenerator,
|
|
) {
|
|
}
|
|
|
|
public function forUser(User $user, int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH): string
|
|
{
|
|
return $this->urlGenerator->generate(
|
|
'app_admin_user',
|
|
[
|
|
AbstractListFilterDto::MARKER => 1,
|
|
'q' => $user->getEmail(),
|
|
],
|
|
$referenceType,
|
|
);
|
|
}
|
|
}
|