jmuehlner commented on code in PR #751:
URL: https://github.com/apache/guacamole-client/pull/751#discussion_r957912741


##########
guacamole/src/main/frontend/src/app/settings/directives/guacSettingsPreferences.js:
##########
@@ -197,7 +240,84 @@ 
angular.module('settings').directive('guacSettingsPreferences', [function guacSe
 
             };
 
+
+            /**
+             * Saves the current user, displaying an acknowledgement message if
+             * saving was successful, or an error if the save failed.
+             */
+            $scope.saveUser = function saveUser() {
+                return userService.saveUser(dataSource, $scope.user)
+                    .then(() =>  guacNotification.showStatus({
+                        text    : {
+                            key : 
'SETTINGS_PREFERENCES.INFO_PREFERENCE_ATTRIBUTES_CHANGED'
+                        },
+
+                        // Reload the user on successful save in case any 
attributes changed
+                        actions : [ ACKNOWLEDGE_ACTION_RELOAD ]
+                    }),
+                    guacNotification.SHOW_REQUEST_ERROR);
+            };
+
+            // Fetch the user record
+            userService.getUser(dataSource, username).then(function 
saveUserData(user) {
+                $scope.user = user;
+            })
+
+            // Get all datasources that are available for this user
+            authenticationService.getAvailableDataSources().forEach(function 
loadAttributesForDataSource(dataSource) {
+
+                // Fetch all user attribute forms defined for the datasource
+                
schemaService.getUserPreferenceAttributes(dataSource).then(function 
saveAttributes(attributes) {

Review Comment:
   Yeah, looking closer at this, this is messy and unnecessary. I was thinking 
that I'd want to save the value of the attributes that are defined on the KSM 
extension to the JDBC auth extension that provided the user, but I don't need 
to go fetching the attributes from all extensions anyway - the KSM attributes 
are exposed on every user context anyway.
   
   I'll get rid of all this logic around fetching attributes from every 
extension, which luckily has the side effect of obviating the `Map` issue.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to