File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed
src/Symfony/Component/Workflow/EventListener Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -76,15 +76,8 @@ private function getVariables(GuardEvent $event): array
7676 {
7777 $ token = $ this ->tokenStorage ->getToken ();
7878
79- if (null === $ token ) {
80- throw new InvalidTokenConfigurationException (sprintf ('There are no tokens available for workflow "%s". ' , $ event ->getWorkflowName ()));
81- }
82-
8379 $ variables = [
84- 'token ' => $ token ,
85- 'user ' => $ token ->getUser (),
8680 'subject ' => $ event ->getSubject (),
87- 'role_names ' => $ this ->roleHierarchy ->getReachableRoleNames ($ token ->getRoleNames ()),
8881 // needed for the is_granted expression function
8982 'auth_checker ' => $ this ->authorizationChecker ,
9083 // needed for the is_* expression function
@@ -93,6 +86,18 @@ private function getVariables(GuardEvent $event): array
9386 'validator ' => $ this ->validator ,
9487 ];
9588
96- return $ variables ;
89+ if (null === $ token ) {
90+ return $ variables + [
91+ 'token ' => null ,
92+ 'user ' => null ,
93+ 'role_names ' => [],
94+ ];
95+ }
96+
97+ return $ variables + [
98+ 'token ' => $ token ,
99+ 'user ' => $ token ->getUser (),
100+ 'role_names ' => $ this ->roleHierarchy ->getReachableRoleNames ($ token ->getRoleNames ()),
101+ ];
97102 }
98103}
You can’t perform that action at this time.
0 commit comments