-
Couldn't load subscription status.
- Fork 0
S28 3951 Allow SuperUsers to perform more edit actions #1178
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
base: master
Are you sure you want to change the base?
Conversation
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.
looks good, just a small suggestion. Looks like there might be some checkstyle fixes needed too
src/test/java/uk/gov/hmcts/reform/preapi/dto/validators/NotPastDateValidatorTest.java
Outdated
Show resolved
Hide resolved
…/allow-admins-extra-api-actions-2
…/allow-admins-extra-api-actions-2
src/test/java/uk/gov/hmcts/reform/preapi/controller/BookingControllerTest.java
Show resolved
Hide resolved
…/allow-admins-extra-api-actions-2
| ZoneId.of("Europe/London")).toLocalDate(); | ||
| var today = LocalDate.now(); | ||
|
|
||
| if (localDateField.isBefore(today) |
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.
I think this adds a restriction to the API that wasn't there before, i.e. it adds a guard to make sure bookings are in the future. That's fine, but we need to create a separate ticket for this piece of code and put it in front of Jacob to make sure it's been signed off by service as its a behavioural change. edit: sorry I should have read the whole PR first!
I agree we need the Super User exception to allow us to recover cases.
| .orElseThrow(() -> new NotFoundException("Case: " + createBookingDTO.getCaseId())); | ||
|
|
||
| if (caseEntity.getState() != CaseState.OPEN) { | ||
| if (caseEntity.getState() != CaseState.OPEN && !auth.hasRole("ROLE_SUPER_USER")) { |
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.
I disagree that we should have this exception, as I think we need to avoid modifying closed cases altogether
| } | ||
| if (foundCase.get().getState() != CaseState.OPEN | ||
| && foundCase.get().getState() == createCaseDTO.getState() | ||
| && !auth.hasRole("ROLE_SUPER_USER") |
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.
Ditto - I don't like this superpower
|
|
||
| @DisplayName("Create/update a booking when case is not OPEN but user is Super Admin") | ||
| @Test | ||
| void upsertCreateBookingCaseNotOpenWithSuperAdmin() { |
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.
I don't like this 😬
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.
I would rather re-open the case, create the retrospective booking, then close the case again
|
|
||
| @DisplayName("Create a booking in the past as a superuser") | ||
| @Test | ||
| void upsertBookingInPastSuperuserCreated() { |
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 is useful 👍
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.
See comments
Change description
Allows Super Users to perform edits that are not allowed by normal admins. These actions are required as part of incident resolution processes when not having direct edit access to DB: