Commit bb88433e authored by hlarget's avatar hlarget 👹
Browse files

Merge branch '2-add-impersonate' into 'master'

Resolve "add impersonate"

Closes #2

See merge request open-source/konnect-bundle!3
parents 1ed2fbd9 e2091b48
......@@ -81,6 +81,11 @@ class Client
return $this->getKonnectInstance()->user()->getLogoutUrl();
}
public function getDeimpersonateUrl(): string
{
return $this->getKonnectInstance()->user()->getDeimpersonateUrl();
}
public function getRedirectionUrl(): string
{
return $this->configuration["redirectTo"];
......
......@@ -64,4 +64,13 @@ class LoginController extends Controller
$logoutUrl = $this->get('konnect.client')->getLogoutUrl();
return new RedirectResponse($logoutUrl);
}
/**
* @Route("/deimpersonate", name="konnect.deimpersonate")
* @return RedirectResponse
*/
public function deimpersonate() {
$deimpersonateUrl = $this->get('konnect.client')->getDeimpersonateUrl();
return new RedirectResponse($deimpersonateUrl);
}
}
\ No newline at end of file
......@@ -33,7 +33,7 @@ class ExtractUserFromAuthorization
->setlocale($user->getLocale())
->addRole("ROLE_USER")
;
if ($authorization->getIsInpersonated() === "true"){
if (true === $authorization->getIsInpersonated()){
$userModel->addRole("ROLE_PREVIOUS_ADMIN");
}
return $userModel;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment