@@ -123,24 +123,17 @@ public function process(&$request)
123123 $ this ->voShortName = $ request ['SPMetadata ' ][self ::VO_SHORTNAME ];
124124 }
125125
126- $ vo = $ this ->adapter ->getVoByShortName ( $ this -> voShortName );
126+ $ user = $ this ->adapter ->getPerunUser ( $ idpEntityId , $ uids );
127127
128- $ spGroups = $ this ->adapter ->getSpGroups ($ spEntityId , $ vo );
128+ if ($ user === null ) {
129+ SimpleSAML_Logger::info ('Perun user with identity/ies: ' . implode (', ' , $ uids ).' has NOT been found. He is being redirected to register. ' );
129130
130- if (empty ($ spGroups )) {
131- SimpleSAML_Logger::warning ('No Perun groups in VO ' .$ vo ->getName ().'are assigned with SP entityID ' .$ spEntityId .'. ' .
132- 'Hint1: create facility in Perun with attribute entityID of your SP. ' .
133- 'Hint2: assign groups in VO ' .$ vo ->getName ().' to resource of the facility in Perun. '
134- );
135- $ this ->unauthorized ($ request );
136- }
131+ $ vo = $ this ->adapter ->getVoByShortName ($ this ->voShortName );
137132
138- SimpleSAML_Logger:: debug ( " SP GROUPs - " . var_export ( $ spGroups , true ) );
133+ $ spGroups = $ this -> adapter -> getSpGroups ( $ spEntityId , $ vo );
139134
140- $ user = $ this -> adapter -> getPerunUser ( $ idpEntityId , $ uids );
135+ SimpleSAML_Logger:: debug ( " SP GROUPs - " . var_export ( $ spGroups , true ) );
141136
142- if ($ user === null ) {
143- SimpleSAML_Logger::info ('Perun user with identity/ies: ' . implode (', ' , $ uids ).' has NOT been found. He is being redirected to register. ' );
144137 $ this ->register ($ request , $ this ->registerUrl , $ this ->callbackParamName , $ vo , $ spGroups , $ this ->interface );
145138 }
146139
@@ -256,6 +249,9 @@ protected function registerChooseGroup($registerUrl, $callbackParamName, $callba
256249 */
257250 private function containsMembersGroup ($ entities )
258251 {
252+ if (empty ($ entities )){
253+ return false ;
254+ }
259255 foreach ($ entities as $ entity ) {
260256 if (preg_match ('/[^:]*:members$/ ' , $ entity ->getName ())) {
261257 return true ;
0 commit comments