@@ -429,51 +429,49 @@ public static function unauthorized($request)
429429 */
430430 protected function getSPAttributes ($ spEntityID )
431431 {
432+ $ attrNames = [
433+ $ this ->facilityCheckGroupMembershipAttr ,
434+ $ this ->facilityVoShortNamesAttr ,
435+ $ this ->facilityDynamicRegistrationAttr ,
436+ $ this ->facilityRegisterUrlAttr ,
437+ $ this ->facilityAllowRegistrationToGroupsAttr ,
438+ ];
439+
432440 try {
433441 $ facility = $ this ->rpcAdapter ->getFacilityByEntityId ($ spEntityID );
434442
435443 if ($ facility === null ) {
436444 return ;
437445 }
438446
439- $ checkGroupMembership = $ this ->rpcAdapter ->getFacilityAttribute (
447+ $ facilityAttrValues = $ this ->rpcAdapter ->getFacilityAttributesValues (
440448 $ facility ,
441- $ this -> facilityCheckGroupMembershipAttr
449+ $ attrNames
442450 );
443- if ($ checkGroupMembership !== null ) {
444- $ this ->checkGroupMembership = $ checkGroupMembership ;
451+
452+ if (array_key_exists ($ this ->facilityCheckGroupMembershipAttr , $ facilityAttrValues )) {
453+ $ this ->checkGroupMembership = $ facilityAttrValues [$ this ->facilityCheckGroupMembershipAttr ];
445454 }
446455
447- $ facilityVoShortNames = $ this ->rpcAdapter ->getFacilityAttribute (
448- $ facility ,
449- $ this ->facilityVoShortNamesAttr
450- );
451- if (!empty ($ facilityVoShortNames )) {
452- $ this ->facilityVoShortNames = $ facilityVoShortNames ;
456+ if (array_key_exists ($ this ->facilityVoShortNamesAttr , $ facilityAttrValues ) &&
457+ !empty ($ facilityAttrValues [$ this ->facilityVoShortNamesAttr ])) {
458+ $ this ->facilityVoShortNames = $ facilityAttrValues [$ this ->facilityVoShortNamesAttr ];
453459 }
454460
455- $ dynamicRegistration = $ this ->rpcAdapter -> getFacilityAttribute (
456- $ facility ,
457- $ this -> facilityDynamicRegistrationAttr
458- );
459- if ($ dynamicRegistration !== null ) {
460- $ this ->dynamicRegistration = $ dynamicRegistration ;
461+ if ( array_key_exists ( $ this ->facilityDynamicRegistrationAttr , $ facilityAttrValues )) {
462+ $ this -> dynamicRegistration = $ facilityAttrValues [ $ this -> facilityDynamicRegistrationAttr ];
463+ }
464+
465+ if (array_key_exists ( $ this -> facilityRegisterUrlAttr , $ facilityAttrValues ) ) {
466+ $ this ->registerUrl = $ facilityAttrValues [ $ this -> facilityRegisterUrlAttr ] ;
461467 }
462468
463- $ this ->registerUrl = $ this ->rpcAdapter ->getFacilityAttribute (
464- $ facility ,
465- $ this ->facilityRegisterUrlAttr
466- );
467469 if ($ this ->registerUrl === null ) {
468470 $ this ->registerUrl = $ this ->defaultRegisterUrl ;
469471 }
470472
471- $ allowRegistartionToGroups = $ this ->rpcAdapter ->getFacilityAttribute (
472- $ facility ,
473- $ this ->facilityAllowRegistrationToGroupsAttr
474- );
475- if ($ allowRegistartionToGroups !== null ) {
476- $ this ->allowRegistrationToGroups = $ allowRegistartionToGroups ;
473+ if (array_key_exists ($ this ->facilityAllowRegistrationToGroupsAttr , $ facilityAttrValues )) {
474+ $ this ->allowRegistrationToGroups = $ facilityAttrValues [$ this ->facilityAllowRegistrationToGroupsAttr ];
477475 }
478476 } catch (\Exception $ ex ) {
479477 Logger::warning ('perun:PerunIdentity: ' . $ ex );
0 commit comments