Skip to content

Commit ba36b1e

Browse files
committed
Merge branch '6.4' into 7.0
* 6.4: [Security] Make `impersonation_path()` argument mandatory and add `impersonation_url()`
2 parents e16868d + f169c5a commit ba36b1e

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ CHANGELOG
1212
* Allow an array to be passed as the first argument to the `importmap()` Twig function
1313
* Add `TemplatedEmail::locale()` to set the locale for the email rendering
1414
* Add `AppVariable::getEnabledLocales()` to retrieve the enabled locales
15+
* Add `impersonation_path()` and `impersonation_url()` Twig functions
1516

1617
6.3
1718
---

Extension/SecurityExtension.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,16 @@ public function getImpersonateExitPath(string $exitTo = null): string
6969
return $this->impersonateUrlGenerator->generateExitPath($exitTo);
7070
}
7171

72-
public function getImpersonatePath(string $identifier = null): string
72+
public function getImpersonateUrl(string $identifier): string
73+
{
74+
if (null === $this->impersonateUrlGenerator) {
75+
return '';
76+
}
77+
78+
return $this->impersonateUrlGenerator->generateImpersonationUrl($identifier);
79+
}
80+
81+
public function getImpersonatePath(string $identifier): string
7382
{
7483
if (null === $this->impersonateUrlGenerator) {
7584
return '';
@@ -84,6 +93,7 @@ public function getFunctions(): array
8493
new TwigFunction('is_granted', $this->isGranted(...)),
8594
new TwigFunction('impersonation_exit_url', $this->getImpersonateExitUrl(...)),
8695
new TwigFunction('impersonation_exit_path', $this->getImpersonateExitPath(...)),
96+
new TwigFunction('impersonation_url', $this->getImpersonateUrl(...)),
8797
new TwigFunction('impersonation_path', $this->getImpersonatePath(...)),
8898
];
8999
}

0 commit comments

Comments
 (0)