-
Notifications
You must be signed in to change notification settings - Fork 30
Implement permission checks to prevent unnecessary overwrit… #2506
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
…es in recursive field processing
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 suggestions for readability related things in the implementation
src/main/java/uk/gov/hmcts/ccd/domain/service/common/RestrictedFieldProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/uk/gov/hmcts/ccd/domain/service/common/RestrictedFieldProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/uk/gov/hmcts/ccd/domain/service/common/RestrictedFieldProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/uk/gov/hmcts/ccd/domain/service/common/RestrictedFieldProcessor.java
Outdated
Show resolved
Hide resolved
private boolean isNullId(JsonNode newItem) { | ||
return newItem.get(ID) == null | ||
|| newItem.get(ID).equals(NullNode.getInstance()) | ||
|| "null".equalsIgnoreCase(newItem.get(ID).asText()); | ||
} |
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.
Wondering whether we can delete this method and sufficiently use newItem.hasNonNull(ID)
in the single place this is being used instead, or are we treating the string "null"
as null
elsewhere in CCD too? While it's an edge case and would be strange for anyone to try, from a quick look at CollectionValidator
we just verify it's some text so technically one item could be set to "null"
!
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.
The check for null values and the string "null" is used in CompoundAccessControlService. You can see the method here.
When I started testing the delete permission, I was able to reproduce the issue by passing "null". While this might be an edge case, it is considered in the original code. So, I decided to keep this check, but I understand if it seems unusual or rare.
src/main/java/uk/gov/hmcts/ccd/domain/service/common/RestrictedFieldProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/uk/gov/hmcts/ccd/domain/service/common/RestrictedFieldProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/uk/gov/hmcts/ccd/domain/service/common/RestrictedFieldProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/uk/gov/hmcts/ccd/domain/service/common/RestrictedFieldProcessor.java
Outdated
Show resolved
Hide resolved
src/main/java/uk/gov/hmcts/ccd/domain/service/common/RestrictedFieldProcessor.java
Outdated
Show resolved
Hide resolved
…ex and collection types.
combined with ccd-5344 in #2545 |
JIRA link (if applicable)
https://tools.hmcts.net/jira/browse/CCD-6022
Change description
Does this PR introduce a breaking change? (check one with "x")