Skip to content

fix: update user.changed_on when roles are modified#2423

Merged
dpgaspar merged 3 commits intodpgaspar:masterfrom
Alok-kumar-priyadarshi:fix-user-changed-on-role-update
Feb 3, 2026
Merged

fix: update user.changed_on when roles are modified#2423
dpgaspar merged 3 commits intodpgaspar:masterfrom
Alok-kumar-priyadarshi:fix-user-changed-on-role-update

Conversation

@Alok-kumar-priyadarshi
Copy link
Copy Markdown
Contributor

This PR fixes an issue where the User.changed_on field is not updated when user roles are modified.

Role changes update the user.roles relationship, but SQLAlchemy does not trigger onupdate for relationship-only changes. As a result, the user audit timestamp becomes stale.

The fix explicitly updates changed_on in SecurityManager.update_user(), ensuring user audit metadata stays accurate when roles or groups change.

A small regression test is included.

@Alok-kumar-priyadarshi Alok-kumar-priyadarshi changed the title Fix user.changed_on not updating on role changes fix: update user.changed_on when roles are modified Jan 15, 2026
@dpgaspar dpgaspar merged commit c1314c7 into dpgaspar:master Feb 3, 2026
11 checks passed
@Alok-kumar-priyadarshi Alok-kumar-priyadarshi deleted the fix-user-changed-on-role-update branch February 3, 2026 12:40
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