-
Notifications
You must be signed in to change notification settings - Fork 2
DT-1496: Prevent update self from updating institution id #2477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object o) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
pshapiro4broad
left a comment
There was a problem hiding this 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) { |
There was a problem hiding this comment.
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.
src/main/java/org/broadinstitute/consent/http/models/UserUpdateFields.java
Outdated
Show resolved
Hide resolved
| displayName: | ||
| description: The display name for the user | ||
| type: string | ||
| institutionId: |
There was a problem hiding this comment.
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.
fboulnois
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
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.