Skip to content

Prepare v6.0.1 maintenance release - #3626

Merged
alasdair-macleod merged 6 commits into
mainfrom
release/6.0.1
Nov 4, 2026
Merged

alasdair-macleod merged 6 commits into
mainfrom
release/6.0.1

Conversation

@alasdair-macleod

@alasdair-macleod alasdair-macleod commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Security and maintenance fixes for v6.0.1, with regression coverage and compatibility updates.

No database migration is required. Detailed security advisories and disclosure credits will be published separately after the release is available.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
1 Warning
⚠️ There are code changes, but no corresponding tests. Please include tests if this PR introduces any modifications in behavior. \n
Ignore this warning if the PR ONLY contains translation.io synced updates.

Generated by 🚫 Danger

def edit
@user = User.find(params[:id])
authorize @user
authorize @user, :super_admin_edit?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job including these actions in the fix. 🙏

@aaronskiba

Copy link
Copy Markdown
Contributor

Thank you for digging into this one. I think I just found some buggy behaviour that can occur if a super-admin attempts to update a department and org together. #3627

@alasdair-macleod alasdair-macleod changed the title Fix cross-organization user administration for v6.0.1 Prepare v6.0.1 maintenance release Nov 4, 2026
Update user administration checks and record validation, with regression coverage and compatibility fixes. Detailed advisories will be published after release.
aaronskiba and others added 5 commits November 4, 2026 09:07
Add request coverage for super admins changing a user's organization and department in the same update. This exposes a validation-order issue where the department is checked against the user's current organization.
Super-admin user updates saved the permitted attributes first, then applied the selected organization in a separate `@user.update(org_id: ...)` call.

With department membership now validated against the user's organization, a request that changed the organization and department together was rejected: the department was checked against the user's current organization, and the organization change was never applied.

Assign `org_id` from the organization lookup before updating, so a single `@user.update` validates the organization and department together. The follow-up update call is removed.

Reload `@departments` after the update. It was previously built before the update, so after an organization change the re-rendered form listed the previous organization's departments. After a failed update, `@user.org` holds the unsaved organization, so the dropdown now matches the form's selected organization.
Add a TODO to verify whether the new-organization save block is still needed.

When org creation is allowed, org_from_params saves new organizations and identifiers before returning. When org creation is restricted, it returns an existing organization or nil. In either case, the controller's new-record fallback appears unreachable.
Refresh department options after successful and failed edits, preserve stored attributes on validation errors, and return HTTP 422 for invalid updates. Remove duplicate organization persistence now that selection-service coverage verifies organization and identifier creation.
fix(super_admin): update user org and department in a single save

@aaronskiba aaronskiba left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

NOTE: At the moment, it shows that the Postgres action still running, but when I go to https://github.com/DMPRoadmap/roadmap/actions/runs/41859726642/job/126685229635?pr=3626 it shows that all tests have passed and the action completed successfully.

@alasdair-macleod
alasdair-macleod merged commit 3ed368e into main Nov 4, 2026
8 of 12 checks passed
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