@@ -80,9 +80,15 @@ public function process(&$request)
8080 } elseif ($ this ->mode === self ::MODE_PARTIAL ) {
8181 // Check if attribute has some value
8282 foreach ($ this ->attrMap as $ attrName => $ attrValue ) {
83+ if (empty ($ attrValue )) {
84+ array_push ($ attributes , $ attrName );
85+ break ;
86+ }
87+
8388 if (!is_array ($ attrValue )) {
8489 $ attrValue = [$ attrValue ];
8590 }
91+
8692 foreach ($ attrValue as $ value ) {
8793 if (empty ($ request ['Attributes ' ][$ value ])) {
8894 array_push ($ attributes , $ attrName );
@@ -96,7 +102,11 @@ public function process(&$request)
96102 return ;
97103 }
98104
99- $ this ->processAttributes ($ user , $ attributes );
105+ $ attrs = $ this ->processAttributes ($ user , $ attributes );
106+
107+ foreach ($ attrs as $ attrName => $ attrValue ) {
108+ $ request ['Attributes ' ][$ attrName ] = $ attrValue ;
109+ }
100110 }
101111
102112 private function hasStringKeys ($ array ): bool
@@ -109,13 +119,14 @@ private function hasStringKeys($array): bool
109119
110120 /**
111121 * Method process attributes from Perun system and store them to request
122+ * @param $request
112123 * @param User $user
113124 * @param array $attributes List of attributes which will be loaded from Perun system
114125 * @throws Exception
115126 */
116- private function processAttributes (User $ user , array $ attributes ): void
127+ private function processAttributes (User $ user , array $ attributes ): array
117128 {
118-
129+ $ result = [];
119130 $ attrs = $ this ->adapter ->getUserAttributesValues ($ user , $ attributes );
120131
121132 foreach ($ attrs as $ attrName => $ attrValue ) {
@@ -155,10 +166,10 @@ private function processAttributes(User $user, array $attributes): void
155166 ' is being setted to ssp attributes ' . implode (', ' , $ attrArray ));
156167
157168
158- // write $value to all SP attributes
159169 foreach ($ attrArray as $ attribute ) {
160- $ request [ ' Attributes ' ] [$ attribute ] = $ value ;
170+ $ result [$ attribute ] = $ value ;
161171 }
162172 }
173+ return $ result ;
163174 }
164175}
0 commit comments