File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 41
41
$ domxml ->loadXML ($ request );
42
42
$ xpath = new DOMXPath ($ domxml );
43
43
44
- // Attributes provided by the Behat step.
45
- $ attributes = [
46
- 'uid ' => $ USER ->username ,
47
- 'email ' => $ USER ->email ,
48
- 'firstname ' => $ USER ->firstname ,
49
- 'lastname ' => $ USER ->lastname
50
- ];
44
+ // Load profile fields into attributes.
45
+ $ authplugin = get_auth_plugin ('saml2 ' );
46
+ $ userfields = array_merge ($ authplugin ->userfields , $ authplugin ->get_custom_user_profile_fields ());
47
+ profile_load_data ($ USER );
48
+ // Add username as `uid` as many services look for `uid` by default.
49
+ $ attributes = ['uid ' => $ USER ->username ];
50
+ foreach ($ userfields as $ field ) {
51
+ $ attributes [$ field ] = $ USER ->$ field ? $ USER ->$ field : '' ;
52
+ }
51
53
52
54
// Get data from input request.
53
55
$ id = $ xpath ->evaluate ('normalize-space(/*/@ID) ' );
You can’t perform that action at this time.
0 commit comments