Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kohinos-tav
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
agplv3
kohinos-tav
Commits
c210e423
Commit
c210e423
authored
Apr 04, 2022
by
Julien Jorry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix redirection after changing role
parent
4792371e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
7 deletions
+11
-7
IndexController.php
src/Controller/IndexController.php
+9
-7
MLCEventListener.php
src/EventListener/MLCEventListener.php
+2
-0
No files found.
src/Controller/IndexController.php
View file @
c210e423
...
...
@@ -33,6 +33,7 @@ use Symfony\Component\HttpFoundation\Request;
use
Symfony\Component\HttpFoundation\Response
;
use
Symfony\Component\HttpFoundation\Session\SessionInterface
;
use
Symfony\Component\Routing\Annotation\Route
;
use
Symfony\Component\Routing\RouterInterface
;
use
Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface
;
use
Symfony\Component\Security\Core\Security
as
Secur
;
use
Symfony\Component\Security\Csrf\CsrfTokenManagerInterface
;
...
...
@@ -49,8 +50,9 @@ class IndexController extends AbstractController
private
$authenticator
;
private
$session
;
private
$tokenStorage
;
private
$router
;
public
function
__construct
(
EventDispatcherInterface
$eventDispatcher
,
EntityManagerInterface
$em
,
UserManagerInterface
$userManager
,
CsrfTokenManagerInterface
$tokenManager
=
null
,
GuardAuthenticatorHandler
$guard
,
SessionInterface
$session
,
LoginAuthenticator
$authenticator
,
TokenStorageInterface
$tokenStorage
)
public
function
__construct
(
EventDispatcherInterface
$eventDispatcher
,
EntityManagerInterface
$em
,
UserManagerInterface
$userManager
,
CsrfTokenManagerInterface
$tokenManager
=
null
,
GuardAuthenticatorHandler
$guard
,
SessionInterface
$session
,
LoginAuthenticator
$authenticator
,
TokenStorageInterface
$tokenStorage
,
RouterInterface
$router
)
{
$this
->
eventDispatcher
=
$eventDispatcher
;
$this
->
em
=
$em
;
...
...
@@ -60,6 +62,7 @@ class IndexController extends AbstractController
$this
->
authenticator
=
$authenticator
;
$this
->
session
=
$session
;
$this
->
tokenStorage
=
$tokenStorage
;
$this
->
router
=
$router
;
}
/**
...
...
@@ -434,13 +437,12 @@ class IndexController extends AbstractController
$this
->
removeOldSessionParams
();
$this
->
reloadUserTokenFromGroup
(
$group
,
$request
);
// @TODO : On redirige sur l'index (ou en fonction du rôle?)
$referer
=
$request
->
headers
->
get
(
'referer'
);
if
(
$referer
&&
!
$request
->
isXmlHttpRequest
())
{
return
$this
->
redirect
(
$referer
);
}
elseif
(
!
$request
->
isXmlHttpRequest
())
{
return
$this
->
redirectToRoute
(
'index'
);
if
(
in_array
(
'ROLE_SUPER_ADMIN'
,
$this
->
getUser
()
->
getRoles
(),
true
))
{
// c'est un administrateur
return
new
RedirectResponse
(
$this
->
router
->
generate
(
'sonata_admin_dashboard'
));
}
return
new
RedirectResponse
(
$this
->
router
->
generate
(
'index'
));
}
private
function
removeOldSessionParams
()
...
...
src/EventListener/MLCEventListener.php
View file @
c210e423
...
...
@@ -60,6 +60,7 @@ class MLCEventListener implements EventSubscriberInterface
MLCEvents
::
REGISTRATION_PRESTATAIRE
=>
'onRegistrationPrestataire'
,
MLCEvents
::
REGISTRATION_CAISSIER
=>
'onRegistrationCaissier'
,
MLCEvents
::
FLUX
=>
'onFlux'
,
// @TODO : checker si VALIDATE_DEMANDE_ACHAT_EMLC c'est toujours d'actualité et utile ?
MLCEvents
::
VALIDATE_DEMANDE_ACHAT_EMLC
=>
'onValidateDemandeAchatEmlc'
,
MLCEvents
::
CHANGE_PRESTATAIRE_COMPTOIR
=>
'onChange'
,
MLCEvents
::
CHANGE_ADHERENT_COMPTOIR
=>
'onChange'
,
...
...
@@ -257,6 +258,7 @@ class MLCEventListener implements EventSubscriberInterface
$template
=
'@kohinos/email/flux/'
.
$type
.
'_'
.
$flux
->
getParentType
()
.
'-'
.
$flux
->
getType
()
.
'.html.twig'
;
}
}
return
$template
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment