The SSH host key has changed on 8 April, 2022 to this one: SHA256:573uTBSeh74kvOo0HJXi5ijdzRm8me27suzNEDlGyrQ

Changed service_container to router in UserDataSpan Twig extension

Actually, only router was used by retrieving it from the container. Now
injecting only what is necessary.

Signed-off-by: Gergely Polonkai <polesz@w00d5t0ck.info>
master
Polonkai Gergely 11 years ago
parent cc7ce78787
commit 7f83e2f9c4
  1. 2
      src/KekRozsak/SecurityBundle/Resources/config/services.xml
  2. 10
      src/KekRozsak/SecurityBundle/Twig/UserDataSpanExtension.php

@ -9,7 +9,7 @@
<tag name="kernel.event_listener" event="security.authentication.success" />
</service>
<service id="kek_rozsak_security.twig_extension.userdataspan" class="KekRozsak\SecurityBundle\Twig\UserDataSpanExtension">
<argument type="service" id="service_container" />
<argument type="service" id="router" />
<argument type="service" id="security.context" />
<tag name="twig.extension" />
</service>

@ -3,18 +3,18 @@
namespace KekRozsak\SecurityBundle\Twig;
use Symfony\Component\Security\Core\SecurityContextInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Bundle\FrameworkBundle\Routing\Router;
use KekRozsak\SecurityBundle\Entity\User;
class UserDataSpanExtension extends \Twig_Extension
{
protected $_securityContext;
protected $_serviceContainer;
protected $_router;
public function __construct(ContainerInterface $container, SecurityContextInterface $security)
public function __construct(Router $router, SecurityContextInterface $security)
{
$this->_serviceContainer = $container;
$this->_router = $router;
$this->_securityContext = $security;
}
@ -30,7 +30,7 @@ class UserDataSpanExtension extends \Twig_Extension
if (!is_object($this->_securityContext->getToken()) || !is_object($this->_securityContext->getToken()->getUser()))
return '<span class="userdata-secret" title="|Felhasználó|A felhasználóink kiléte szigorúan bizalmas, csak a tagok számára elérhető.">[nem jelenhet meg]</span>';
return '<span class="userdata" rel="' . $this->_serviceContainer->get('router')->generate('KekRozsakSecurityBundle_ajaxUserdata', array('id' => $user->getId(), '_format' => 'html')) . '">' . $user->getDisplayName() . '</span>';
return '<span class="userdata" rel="' . $this->_router->generate('KekRozsakSecurityBundle_ajaxUserdata', array('id' => $user->getId(), '_format' => 'html')) . '"><a href="">' . $user->getDisplayName() . '</a></span>';
}
public function getName()

Loading…
Cancel
Save