Skip to content

Commit

Permalink
Added INCLUDE_BODY_TREE policy.
Browse files Browse the repository at this point in the history
  • Loading branch information
Eng3lFT committed Dec 15, 2022
1 parent 2e5f15e commit 4016cb1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Note that one policy might be used by many filters and filters might work with m
| stripProvenance | Removes the `publishReference` and `masterSource` fields from the response unless the INCLUDE_PROVENANCE policy is present | /content, /content-preview, /internalcontent-preview, /enrichedcontent, /internalcontent, /lists |
| stripLastModifiedDate | Removes the `lastModified` field from the response unless the INCLUDE_LAST_MODIFIED_DATE policy is present | /content, /content-preview, /internalcontent-preview, /enrichedcontent, /internalcontent, /lists |
| stripLite | Removes the `lite` field from the response unless the INCLUDE_LITE policy is present | /internalcontent |
| stripBodyTree | Removes the `bodyTree` field from the response unless the INCLUDE_BODY_TREE policy is present | /content, /enrichedcontent, /internalcontent |
| stripOpeningXml | Removes the `openingXML` field from the response unless the INTERNAL_UNSTABLE policy is present | /content, /content-preview, /internalcontent-preview, /enrichedcontent, /internalcontent |
| removeAccessFieldRegardlessOfPolicy | Removes the `accessLevel` field from the response | /content, /content-preview, /internalcontent-preview |
| canBeDistributedAccessFilter | Returns HTTP 403 "Access denied" response for content without `canBeDistributed=yes` field unless the INTERNAL_UNSTABLE policy is present | /content, /enrichedcontent, /internalcontent |
Expand All @@ -60,6 +61,7 @@ Note that one policy might be used by many filters and filters might work with m
| INCLUDE_PROVENANCE | Allows including information about the provenance of the content in the response | publishReference, masterSource |
| INCLUDE_LAST_MODIFIED_DATE | Allows including the `lastModified` field in the response | lastModified |
| INCLUDE_LITE | Allows including the `lite` field in the response | lite |
| INCLUDE_BODY_TREE | Allows including the `bodyTree` field in the response | bodyTree |
| FASTFT_CONTENT_ONLY | Includes events only for FastFT branded content into notification response | * |
| EXCLUDE_FASTFT_CONTENT | Excludes events for content with FastFT brand from notification response | * |
| INTERNAL_UNSTABLE | Allows including fields considered as "unstable" for internal usage | alternativeTitles, alternativeImages, alternativeStandfirsts, openingXML, accessLevel, contains, containedIn |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class ApiFilters {
private static final String PROVENANCE_JSON_PROPERTY = "publishReference";
private static final String LAST_MODIFIED_JSON_PROPERTY = "lastModified";
private static final String LITE_JSON_PROPERTY = "lite";
private static final String BODY_TREE_JSON_PROPERTY = "bodyTree";
private static final String OPENING_XML_JSON_PROPERTY = "openingXML";
private static final String ACCESS_LEVEL_JSON_PROPERTY = "accessLevel";
private static final String CONTENT_PACKAGE_CONTAINS_JSON_PROPERTY = "contains";
Expand All @@ -47,6 +48,7 @@ public class ApiFilters {
private ApiFilter brandFilter;
private ApiFilter stripLastModifiedDate;
private ApiFilter stripLite;
private ApiFilter stripBodyTree;
private ApiFilter stripOpeningXml;
private ApiFilter linkValidationFilter;
private ApiFilter mediaResourceNotificationsFilter;
Expand Down Expand Up @@ -98,6 +100,9 @@ public void initFilters(ApiPolicyConfiguration configuration, Environment enviro
stripLite =
new RemoveJsonPropertiesUnlessPolicyPresentFilter(
jsonTweaker, INCLUDE_LITE, LITE_JSON_PROPERTY);
stripBodyTree =
new RemoveJsonPropertiesUnlessPolicyPresentFilter(
jsonTweaker, INCLUDE_BODY_TREE, BODY_TREE_JSON_PROPERTY);
stripOpeningXml =
new RemoveJsonPropertiesUnlessPolicyPresentFilter(
jsonTweaker, INTERNAL_UNSTABLE, OPENING_XML_JSON_PROPERTY);
Expand Down Expand Up @@ -179,6 +184,7 @@ public ApiFilter[] internalContentFilters() {
stripProvenance,
stripLastModifiedDate,
stripLite,
stripBodyTree,
stripOpeningXml,
accessLevelPropertyFilter,
accessLevelHeaderFilter,
Expand Down Expand Up @@ -228,6 +234,7 @@ public ApiFilter[] enrichedContentFilters() {
stripCommentsFields,
stripProvenance,
stripLastModifiedDate,
stripBodyTree,
stripOpeningXml,
accessLevelPropertyFilter,
accessLevelHeaderFilter,
Expand Down Expand Up @@ -264,6 +271,7 @@ public ApiFilter[] contentIdentifiersFilters() {
removeCommentsFieldRegardlessOfPolicy,
stripProvenance,
stripLastModifiedDate,
stripBodyTree,
stripOpeningXml,
removeAccessFieldRegardlessOfPolicy,
editorialDeskFilter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public enum Policy {
INCLUDE_PROVENANCE("INCLUDE_PROVENANCE"),
INCLUDE_LAST_MODIFIED_DATE("INCLUDE_LAST_MODIFIED_DATE"),
INCLUDE_LITE("INCLUDE_LITE"),
INCLUDE_BODY_TREE("INCLUDE_BODY_TREE"),
INTERNAL_UNSTABLE("INTERNAL_UNSTABLE"),
EXPAND_RICH_CONTENT("EXPAND_RICH_CONTENT"),
RESTRICT_NON_SYNDICATABLE_CONTENT("RESTRICT_NON_SYNDICATABLE_CONTENT"),
Expand Down

0 comments on commit 4016cb1

Please sign in to comment.