Skip to content

GUACAMOLE-2311: Profile changes are not saved when a user edits their own settings. - #1235

Open
bbennett-ks wants to merge 1 commit into
apache:mainfrom
bbennett-ks:GUACAMOLE-2311-profile-changes-lost-when-user-self-edit
Open

GUACAMOLE-2311: Profile changes are not saved when a user edits their own settings.#1235
bbennett-ks wants to merge 1 commit into
apache:mainfrom
bbennett-ks:GUACAMOLE-2311-profile-changes-lost-when-user-self-edit

Conversation

@bbennett-ks

Copy link
Copy Markdown
Contributor

When a user edits their own profile, changes to full name, email, organization, and role are silently discarded and never reach the database.

In UserObjectTranslator.java, self-edits take a different path than when editing another account.

    @Override
    public void filterExternalObject(UserContext userContext,
            User existingObject, APIUser object) throws GuacamoleException {

        // If a user is editing themselves ...
        if (existingObject != null && existingObject.getIdentifier().equals(userContext.self().getIdentifier())) {
            // ... they may only edit preference attributes
            object.setAttributes(filterAttributes(userContext.getUserPreferenceAttributes(),
                    object.getAttributes()));
        }

        else {
            // In all other cases, filter object attributes by defined schema
            object.setAttributes(filterAttributes(userContext.getUserAttributes(),
                    object.getAttributes()));
        }
    }

Self-edits are filtered by UserObjectTranslator.filterExternalObject() using getUserPreferenceAttributes(). For ModeledUserContext, that currently returns no allowed fields, so filterAttributes() strips all profile attributes before the update is processed. The fix is to have ModeledUserContext expose the standard profile fields as user-editable preferences.

@necouchman

Copy link
Copy Markdown
Contributor

@bbennett-ks Is there any mechanism for this access being limited? Is it tied to the "Change own password" permission, or is it just assumed that users should always be able to edit their own attributes?

@bbennett-ks

bbennett-ks commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

@bbennett-ks Is there any mechanism for this access being limited? Is it tied to the "Change own password" permission, or is it just assumed that users should always be able to edit their own attributes?

It's a little odd... First, a non-admin user needs Create new users permission to be able to access User settings screen. And then you need Change password permission to be able to open the User settings screen. If not, you get Sorry, but this user account cannot be edited.

Maybe, one should be able to change Profile via the Preferences screen, like one can change the password (if Change passwd permission is enabled).

@necouchman Let me know if you'd like the profile data to be Preferences screen unconditionally. Seems like the best design choice,..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants