Skip to content

Conversation

@rushtong
Copy link
Contributor

@rushtong rushtong commented Apr 10, 2025

Addresses

Back end work for https://broadworkbench.atlassian.net/browse/DT-1496

Summary

Prevent users from updating their institution id via the self update endpoint.
If a user tries to do this, return a bad request response.
Relatively large change to resource test due to the removal of previous logic and some other minor cleanup efforts.
See DataBiosphere/duos-ui#2821 for related front end work.


Have you read CONTRIBUTING.md lately? If not, do that first.

  • Label PR with a Jira ticket number and include a link to the ticket
  • Label PR with a security risk modifier [no, low, medium, high]
  • PR describes scope of changes
  • Get a minimum of one thumbs worth of review, preferably two if enough team members are available
  • Get PO sign-off for all non-trivial UI or workflow changes
  • Verify all tests go green
  • Test this change deployed correctly and works on dev environment after deployment

@rushtong rushtong marked this pull request as ready for review April 10, 2025 21:03
@rushtong rushtong requested a review from a team as a code owner April 10, 2025 21:03
@rushtong rushtong requested review from fboulnois and snf2ye and removed request for a team April 10, 2025 21:03
}

@Override
public boolean equals(Object o) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was only really needed for testing.

Copy link
Member

Choose a reason for hiding this comment

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

That's good because since this is a mutable object the results aren't valid over time. It would be better to make this immutable using record so you don't have write and maintain these methods for tests. But that would require a bigger change.

Copy link
Member

@pshapiro4broad pshapiro4broad left a comment

Choose a reason for hiding this comment

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

A few comments, looks OK overall

}

@Override
public boolean equals(Object o) {
Copy link
Member

Choose a reason for hiding this comment

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

That's good because since this is a mutable object the results aren't valid over time. It would be better to make this immutable using record so you don't have write and maintain these methods for tests. But that would require a bigger change.

displayName:
description: The display name for the user
type: string
institutionId:
Copy link
Member

Choose a reason for hiding this comment

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

If this was using openapi generated code, there would be a different object type for this request (vs the admin API) so we wouldn't need to add a specific validation for this field.

We could do this here too, e.g., have both SelfUserUpdateFields and AdminUserUpdateFields. Then the 400 would be thrown when gson.fromJson() is called.

Copy link
Contributor

@fboulnois fboulnois left a comment

Choose a reason for hiding this comment

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

👍

@rushtong rushtong merged commit c559f3b into develop Apr 14, 2025
14 checks passed
@rushtong rushtong deleted the gr-DT-1496-prevent-self-update-institution branch April 14, 2025 15:25
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.

4 participants