@@ -147,7 +147,6 @@ public function process(&$request)
147147 Logger::debug (
148148 self ::DEBUG_PREFIX . 'No facility found for SP \'' . $ spEntityId . '\', skip processing filter '
149149 );
150-
151150 return ;
152151 }
153152 $ facilityAttributes = $ this ->getSPAttributes ($ facility );
@@ -156,22 +155,20 @@ public function process(&$request)
156155 self ::DEBUG_PREFIX . 'Could not fetch SP attributes, user will be redirected to unauthorized for security reasons '
157156 );
158157 $ this ->unauthorized ($ request );
159-
160158 return ;
161159 }
162160
163161 $ checkGroupMembership = $ facilityAttributes [self ::CHECK_GROUP_MEMBERSHIP ];
164162 if (!$ checkGroupMembership ) {
165163 Logger::info (self ::DEBUG_PREFIX . 'Group membership check not requested by the service. ' );
166-
167164 return ;
168165 }
169166
170- $ userGroups = $ this ->adapter ->getUsersGroupsOnFacility ($ spEntityId , $ user ->getId ());
167+ $ userGroups = $ this ->adapter ->getUsersGroupsOnFacility ($ facility , $ user ->getId ());
171168 if (!empty ($ userGroups )) {
172169 Logger::info (self ::DEBUG_PREFIX . 'User satisfies the group membership check. ' );
173170 } else {
174- $ this ->handleUnsatisfiedMembership ($ request , $ user , $ spEntityId , $ facilityAttributes );
171+ $ this ->handleUnsatisfiedMembership ($ request , $ user , $ spEntityId , $ facility , $ facilityAttributes );
175172 }
176173 }
177174
@@ -188,6 +185,7 @@ public function handleUnsatisfiedMembership(
188185 array $ request ,
189186 User $ user ,
190187 string $ spEntityId ,
188+ Facility $ facility ,
191189 array $ facilityAttributes
192190 ) {
193191 $ allowRegistration = $ facilityAttributes [self ::ALLOW_REGISTRATION ] ?? false ;
@@ -208,11 +206,10 @@ public function handleUnsatisfiedMembership(
208206 exit ;
209207 }
210208 try {
211- $ registrationData = $ this ->getRegistrationData ($ user , $ spEntityId , $ facilityAttributes );
209+ $ registrationData = $ this ->getRegistrationData ($ user , $ facility , $ spEntityId , $ facilityAttributes );
212210 if (!empty ($ registrationData )) {
213211 $ skipNotification = in_array ($ spEntityId , $ this ->skipNotificationSps , true );
214212 $ this ->register ($ request , $ registrationData , $ skipNotification );
215-
216213 return ;
217214 }
218215 Logger::debug (
@@ -223,7 +220,7 @@ public function handleUnsatisfiedMembership(
223220 Logger::warning (
224221 self ::DEBUG_PREFIX . 'Caught exception, user will be redirected to unauthorized for security reasons '
225222 );
226- Logger::debug ($ ex );
223+ Logger::debug ($ ex-> getMessage () );
227224 }
228225 } else {
229226 Logger::debug (
@@ -354,7 +351,7 @@ protected function registerChooseVoAndGroup(array &$request, array $registration
354351 ]);
355352 }
356353
357- private function getRegistrationData ($ user , $ spEntityId , array $ facilityAttributes ): array
354+ private function getRegistrationData ($ user , Facility $ facility , string $ spEntityId , array $ facilityAttributes ): array
358355 {
359356 if (null === $ this ->rpcAdapter ) {
360357 throw new Exception (self ::DEBUG_PREFIX . 'No RPC adapter available, cannot fetch registration data ' );
@@ -367,7 +364,7 @@ private function getRegistrationData($user, $spEntityId, array $facilityAttribut
367364 }
368365 $ voShorNamesForRegistration = $ this ->getRegistrationVoShortNames ($ user , $ voShortNames );
369366
370- return $ this ->getRegistrationGroups ($ spEntityId , $ voShorNamesForRegistration );
367+ return $ this ->getRegistrationGroups ($ facility , $ voShorNamesForRegistration );
371368 }
372369
373370 private function getRegistrationVoShortNames (User $ user , array $ voShortNames ): array
0 commit comments